Forum Discussion

akhilawin009's avatar
6 years ago

An error has occured when create sales order via API

I'm trying to create sales order via API.

So using POST for https://exo.api.myob.com/salesorder

JSON request is

{ "id": -1, "branchid": "0", "contactid": "68971", "debtorid": "29306", "defaultlocationid": "1", "deliveryaddress": { "line1": "Rudney Visser", "line2": "", "line3": "94 McMurtrie Road", "line4": "", "line5": "McLaren Vale SA", "line6": "AU 5171" }, "duedate": "2019-11-27T00:04:24+00:00", "instructions": "", "lines": [ { "stockcode": "01130027", "stocktype": "LinkedItem", "description": "Floozie Sang Rose 2019 - BLACK SHEEP CLUB", "unitprice": 20.83, "linetotal": 159.161936, "listprice": 159.161936, "orderquantity": 1, "releasequantity": 1, "discount": 0, "locationid": 1, "branchid": 0, "taxrateid": 20, "linetype": 0, "isoriginatedfromtemplate": false, "ispriceoverridden": false, "duedate": "2019-11-27", "narrative": "", "batchcode": "" } ], "orderdate": "2019-11-27T00:04:24+00:00", "reference": "", "customerordernumber": "", "salespersonid": "2", "status": "NotProcessed", "narrative": "", "currencyid": 0, "exchangerate": 1 }

 

This is passed in validate test and it is creating new sales order as well if not include Lines info.

But with this json, only showing error 

{ "message": "An error has occurred." }

 

Not sure what is the reason.

Please help me.