Post

1 follower Follow
0
Avatar

Internal server error when attempting to create a Sales Order via the API

Hi All,

I'm attempting to create a Sales Order via the API but I keep receiving "There was an internal server error." as a response. I've triple checked by JSON object and it appear to comply with the required format. Does anybody have any ideas?

 

Sample Object

 

{
"SalesOrderLines": [
{
"LineNumber": 1,
"LineType": null,
"Product": {
"Guid": "59622bae-fa45-485f-9a16-d5119ef77983",
"ProductCode": "Can 24 x 375ml",
"ProductDescription": "Can 24 x 375ml"
},
"OrderQuantity": 10,
"UnitPrice": 59.09,
"DiscountRate": 0,
"LineTotal": 590.9,
"Weight": null,
"Comments": "",
"TaxRate": 0.1,
"LineTax": 59.09,
"XeroTaxCode": "G.S.T.",
"LineTaxCode": null,
"XeroSalesAccount": null,
"SerialNumbers": null,
"BatchNumbers": null,
"Guid": "091ea482-eaa6-42aa-a80e-820f25a96cec"
}
],
"OrderDate": null,
"RequiredDate": null,
"CompletedDate": null,
"OrderStatus": "Parked",
"Customer": {
"CustomerCode": "A customer",
"Guid": "f1f2b627-c8d5-403a-8f64-7a48e2512b8e"
},
"CustomerRef": null,
"Comments": null,
"Warehouse": {
"WarehouseCode": "A Warehouse",
"WarehouseName": "A warehouse",
"Guid": "88c1dc94-938e-4488-8a1a-f8686272cc34"
},
"ReceivedDate": null,
"DeliveryInstruction": "Handle with care.",
"DeliveryName": null,
"DeliveryStreetAddress": null,
"DeliveryStreetAddress2": null,
"DeliverySuburb": null,
"DeliveryCity": null,
"DeliveryRegion": null,
"DeliveryCountry": null,
"DeliveryPostCode": null,
"Currency": {
"CurrencyCode": "AUD",
"Description": "Australia, Dollars",
"Guid": "d33ba476-c12a-485a-aaa6-27e95b899856"
},
"ExchangeRate": 1,
"DiscountRate": 0,
"Tax": {
"TaxCode": "G.S.T.",
"TaxRate": 0.1,
"Guid": "00000000-0000-0000-0000-000000000000"
},
"TaxRate": 0.1,
"XeroTaxCode": "G.S.T.",
"SubTotal": 1145.8,
"TaxTotal": 114.58,
"Total": 1260.38,
"TotalVolume": 0.302,
"TotalWeight": 0,
"SalesPerson": null,
"SendAccountingJournalOnly": false,
"SourceId": null,
"CreatedBy": "adrian",
"Guid": "953924f9-0e4a-43e5-a041-0773aa67038f",
}

Admin

Please sign in to leave a comment.

1 comment

0
Avatar

Hi All,

I discovered the problem. There were two issues.

 

1. Date format.

Unleashed returns results from the API in this format "/Date(1590470219751)/" but requires that the special forward-slash character be escaped on insertion (POST) e.g. "\/Date(1590470219751)\/".

2. Trailing commas when the element is the last one in the object can cause an internal server error.

 

Hope this helps someone.

Admin 0 votes
Comment actions Permalink