I'm just working things out in the off-the-shelf Cronos Ltd. sandbox account and I feel like I'm banging my head against the wall this afternoon. I'm working in Postman and simply mocking up some basic JSON payloads using the API v2.0.
I have succeeded in authenticating, POSTing a sales order to the endpoint /salesOrders
and keeping hold of the new sales order ID. So that's great.
But I'm struggling with the salesOrderLines endpoint documented here: https://learn.microsoft.com/en-us/dynamics-nav/api-reference/v1.0/resources/dynamics_salesorderline
Could anyone give me a boost by showing me an example of where I might POST new sales order line items given I have a sales order ID? (Or embed them in the first call with 'deep insert'?) I'm reading through the documentation and have tried every which way, but I must be missing something.
I'm not extremely familiar with the Web Services section of Business Central yet. Published in my account are the two default endpoints with 'Object Name': 'APIV2 - Sales Orders' and 'APIV2 - Sales Order Lines'.
I cracked it, well I found my mistake. I had misunderstood the difference between the common endpoint service and the OData service which is much more customisable through the Web Services page in Business Central. I was using the wrong API URL.