Hi,
I can Post a Sales Order through REST v1 perfectly fine. but i am really struggling with v2.
I have attached the ‘input’ and the ‘response’
the API key seems to be working ok as if i remove it, it asks for a valid API Key.
Hi,
I can Post a Sales Order through REST v1 perfectly fine. but i am really struggling with v2.
I have attached the ‘input’ and the ‘response’
the API key seems to be working ok as if i remove it, it asks for a valid API Key.
What is the type of DiscountPercent and SellingQuantity? maybe try to remove quotes around them?
They are decimal. I did try your suggestion but the issue persists.
I was going to suggest the same as Olga, no idea why it doesn’t work. I tried below and it does.
Replace company/customer and give it a try.
{
“OrderNum”: 0,
“Company”: “EPIC06”,
“CustNum”: 2,
“OrderDtls”: [
{
“Company”: “EPIC06”,
“OrderNum”: 0,
“OrderLine”: 1,
“PartNum”: “05760”,
“DocUnitPrice”: 200,
“SellingQuantity”: 15
}
]
}
In OData3 decimals must be in quotes. In OData4 they work without quotes
Unfortunately, i get the same issue once i lay it out the way you specified.
Is there anything in the API Key or Access Scope that would prevent this from working as expected?
no, the error means it is something wrrong with data you send. Is there anything in server Event Viewer for app server?
Can you post your exact json and the URL you call?
Base on the difference between Jonathan’s example and yours, try replacing OrderDtl with OrderDtls. Thats the only other difference I can see.
Nice catch, hopefully that is it.
I’m going to piggy-back on this one. I am also having the same issue on 10.2.500. Changing to OrderDtls did not work for me.
I tried the same json I pasted earlier and it worked fine in 10.2.500, just fix the double quotes because the characters are different if copying from the post.
This was the final change and the order has now posted.
Thank you everyone who posted
Ricky,
I am using Postman to test this but I still get the error. Can you post what Json you have? Sorry I am new to REST. Thank you.
Ok I got this to work. Originally, the suggested resolution did not have double quotes on Selling Quantity but I tried it with one and it works.
{
“Company”: “TWG-OK”,
“PONum”: “TESTEC11”,
“OrderNum”: 0,
“CustNum”: “581”,
“PrcConNum”: 8,
“ShpConNum”: 8,
“ShipToNum”: “WEL1”,
“OrderHeld”: false,
“ShipOrderComplete”: false,
“WebOrder”: true,
“OrderDtls”:
[
{
“Company”: “TWG-OK”,
“OrderNum”: 0,
“OrderLine” : 4,
“PartNum”: “20524”,
“SellingQuantity”: “5”,
“ShipComment”: “”,
“ShipLineComplete”: false,
“NeedByDate”: “2021-03-28T00:00:00-06:00”
}
]
}
if you use REST v1, you need quotes.
Related question, what’s the format to add another line to this json?
Thank you Olga.