POST [..] InboundJobQuotes { "jobno":"JO001", }..and a subform line as follows:
POST [..] InboundJobQuotesserviceLines { "jobno": "JO001", "lineno": 1, "description":, "Description JO001" }But that's two round trips. Ideally (And surely it should support this) I want this:
POST [..] InboundJobQuotes { "jobno":"JO001", InboundJobQuotesserviceLines: [ { "lineno": 1, "description":, "Description JO001" } ] }I get no error, but no lines are created either.
Answers
I use a page with one field, a global text variable. And I post the json payload to this variable and parse the payload myself with json.net in OnInsert trigger of the page.
This is called a 'deep insert'
for example: https://forum.mibuso.com/discussion/72423/api-deep-insert-not-working-in-custom-entity
My main API page has an EntitySetName of 'jobQuotes', the subform has an EntitySetName of 'serviceLines':
I added it to the Web Service table as per usual as InboundJobQuotes, I'm not sure if that's the right way to reference the API /shrug
When I call it from Postman I use the usual endpoint (As specified in Web Services), when I do the deep insert it insists I call it InboundJobQuotesserviceLines rather than serviceLines.
EG.
When I was expecting...
Postman will complain about untyped values if I use serviceLine.
I know I'm doing something wrong based upon my misunderstanding of how this works. I wish they'd let me use SOAP lol.
Bonus question: Can we use batch requests with ODATA?
Thanks
H
So in NAV, ODATA and API are different endpoints.
See https://docs.microsoft.com/en-us/dynamics-nav/api-reference/v1.0/endpoints-apis-for-dynamics
API does not use the webservice table to be configured.
Batch requests are not supported afaik.
(I have never tried it myself)
It makes so much more sense now lol.
Thanks again!