On Tue, 26 Apr 2016 16:00:06 GMT, John More wrote:
Hi,
I am trying to use the
auto client = RestInterfaceClient!Zoho("https://creator.zoho.com/api/zoho_xxx/json/testapi/form/Orders/record/add");where the interface is as follows:
module zoho;struct orderToSubmit {
string authtoken; string scope_; string Depot; string RTU; string Order_Date_Time; string Device_Id; string Device_Serial_Number; int Days_Left; string Supply_Code;
}
interface Zoho {
ubyte[][] postOrder(orderToSubmit theOrder);
}
the call looks like auto theResponse = client.postOrder(theOrder);
The server requires the data(theOrder) to be passed as form data. The data is actually passed as JSON.
How can I get the data to be encoded as form data using this method?
Any suggestions are definitely appreciated.
Thanks
John
I got it to work by foregoing the RestInterfaceClient and using
HTTPClientResponse res = requestHTTP(completeURL,
(scope req)
{ req.method = HTTPMethod.POST;
req.writeFormBody(form);}
);
I would still like to see if there is a way to make the Interface work.
John