
Hi community,
I am exposing the codeunit 74 Purch.-Get Receipt as a webservice. My goal is to add purchase receipt lines to a purchase invoice via a webservice call.
This I want to achieve both with a SOAP request AND with an Odata request. (Reason: i have to set this up in a NAV16 and BC).
I gave the the webservice the name PurchGetReceipt.
Current Odata:
URL: api.businesscentral.dynamics.com/.../PurchGetReceipt_CreateInvLines DE'
Body: not sure what to put here.
Response: "Resource not found for the segment 'PurchGetReceipt_CreateInvLines'.
Current SOAP:
URL: api.businesscentral.dynamics.com/.../PurchGetReceipt
SOAPAction: urn:microsoft-dynamics-schemas/page/PurchGetReceipt:CreateInvLines
Body:
Response: Parameter purchRcptLine2 of the type INavRecordHandle in method CreateInvLines in service PurchGetReceipt is invalid!
I can't figure out how to construct the HTTP calls, neither in SOAP nor in OData in order to make this run.
Can you give me some pointers about the bodies and params I am missing.
I am attaching a screenshot of the codeunit, found in the AL Object Designer in Vscode.
Thanks Sven
Hello,
You can see metadata like this:
api.businesscentral.dynamics.com/.../$metadata
Then search that for PurchGetReceipt and see if this gives you any ideas about how to call it.
I think what you are looking for, is unbound actions (if not bound to a table but a function), for example:
Or if you want to add data, then usually it wold be via an api that exposes a page, which is bound to the table. A list of apis available in standard:
docs.microsoft.com/.../endpoints-apis-for-dynamics
Then use POST call to insert a record:
docs.microsoft.com/.../devenv-connect-apps-tips
another good resource for this is https://www.hougaard.com/
I hope this helps you?