Hi,
I am programmatically creating Sales Invoices through API. But can't see a lot of fields exposed through API
for instance "Payment Method Code"
Is there a way to update this field Programmatically?
Thanks and Regards,
Amit
Hi,
I am programmatically creating Sales Invoices through API. But can't see a lot of fields exposed through API
for instance "Payment Method Code"
Is there a way to update this field Programmatically?
Thanks and Regards,
Amit
Thanks everyone for all the help. This is now resolved.
Missing part was
Hi,
It does and actually should work, but when I fetch the whole list it works fine as listed below.
When I use Id in result listed below and call it with Id. HttpClient returns not found.
My API Page code looks like this
I think you have to use the Id field when you want the patch the sales order - here is an example from the standard API
PATCH businesscentralPrefix/companies({id})/salesOrders({id})
Does that make sense?
Hi Inge,
Thanks for guidance. I exposed the field and am getting List of Sales Invoices now. I want to update Payment Method on one of them so I tried applying filter like
api.businesscentral.dynamics.com/.../SalesInvoiceExtensions(No='S-INV000111)
but getting Not Found
then I tried
api.businesscentral.dynamics.com/.../SalesInvoiceExtensions?$filter=No eq 'S-INV000111'
this works but again it returns Collection with 1 item and I get following error on PATCH operation
PATCH requests for '' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services
How can I perform update operation here please?
Thanks and Regards,
Amit
Hi, hope the following helps.
Can we extend standard APIs? – Download Standard Source Code for APIs
https://yzhums.com/20960/
Thanks.
ZHU
If you need a field available in he API that you do not find there you will have to create a custom API.
The custom API needs to be created on the BC side before you can use it from C#.
And you are correct that payment method is not a part of the standard API.
API page creation I asked you on BC AL code side, so not sure how you can achieve it on C#
Thanks.
Thanks Nitin,
Do you have any example, how to do this in C#?
Regards,
Amit
If the required fields is not available in the standard api, you can export your custom api.
Follow below link