
Hi,
I have a situation with using OData in Business Central (CU3). I tried this example provided by Microsoft: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-creating-and-interacting-with-odatav4-bound-action
Everything is ok, the code is with no errors but when I tried to reach the exposed method "Copy" with URL as mentioned in the post I can't reach it. My question is how to reach this kind of methods with API? What am I missing in Microsoft's example?
My request looks like that, the same as in example but it doesn't work: {baseurl}/ODataV4/Company('CRONUS')/SalesInvoiceCopy('S-ORD101001')/NAV.Copy
I get this error: {"error":{"code":"BadRequest_NotFound","message":"Bad Request - Error in query syntax."}}
The only request which gives some positive result are:
{baseurl}/ODataV4/Company('Konverzija')/SalesInvoiceCopy/NAV.SalesInvoiceCopy (return list of all invoices)
{baseurl}/ODataV4/Company('Konverzija')/SalesInvoiceCopy (return list of all invoices)
This one also works:
{baseurl}/ODataV4/Company('CRONUS')
{baseurl}/ODataV4/$metadata
Can anyone please show me how to make this request working? I would like to do the same as in Microsoft's example, I would like to reach a specific Invoice and perform a "Copy" action. If anyone can give me some pieces of information or link to some useful webpages where I could see more (real) examples of OData API I would be really happy.
I tried many combinations to combine request but no luck.
I hope someone can help me.
Thank you!