Hi,
I have a external Application , can i instert data in Contact (5050) Table outside of Business Central ?
Thanks.
Hi,
I have a external Application , can i instert data in Contact (5050) Table outside of Business Central ?
Thanks.
Thank you for your help and for sharing the links.
=)
Fine! :)
I learnt this by calling BC api with PowerApps the first time, using standard API: you can find the documentation here:
When I saw your question I went to this page to give you an answer (I think you went to there too). As there was no standard api for Contact, I thought that maybe api page could answers your question. I just made some tests following Customer api, but applying to my api page (contacts):
docs.microsoft.com/.../dynamics_customer
Also, I wen to NavTechDays2019, I used the notes from what I saw there, from the "{ConnectApp}² conference given by Waldo (his blog here: https://www.waldo.be/)
The conference here: https://www.youtube.com/watch?v=9yg-8tLNjzg
You can also see all the conference here: https://www.youtube.com/watch?v=pl0LAvep6WE&list=PLI1l3dMI8xlCkFC0S4q8VxPiBt30VQ4w0
There is also a lot of blogs that can help you (as they help me), as:
Stefano Demiliani's blog: https://demiliani.com/tag/dynamics-365-business-central/
Vjeko's blog: http://vjeko.com/
MyNav's blog (not mine, this is the name of the blog ;) ) : http://www.mynavblog.com/
Freddy Kristiansen's blog: https://freddysblog.com/
I gave you the ones I follow the most. You will find more.
You can also type key words in the AL issues GitHub research: (https://github.com/Microsoft/AL/issues ). You will find some piece of code (for example) that can help you doing what you want.
Google is also your friend, starting with "Business Central <you key words>", you will find maybe some piece of code, at least some clues to do what you want. As a puzzle game you will assemble what you find!
Thanks .
I could already make the POST and PATCH .
Where did you learn all this? or where can I learn more about Business Central? .
Yes, you should select a contact precisely, here you try to update a list.
You have to reference the SystemId field in your Page API, and set the property ODataKeyField to SystemID. Your page should looks like this:
page 50100 "API Contacts" { PageType = API; Caption = 'contact'; APIPublisher = 'someApiPublisher'; APIGroup = 'testapi'; APIVersion = 'v1.0'; EntityName = 'contact'; EntitySetName = 'contacts'; SourceTable = Contact; DelayedInsert = true; ODataKeyFields = SystemId; // <<< new property Editable = true; layout { area(Content) { repeater(GroupName) { field(id; SystemId) // <<< new field reference { Caption = 'SystemId'; Editable = false; } field(name; Name) { Caption = 'name'; } field(address; Address) { Caption = 'address'; } } } } }
Then, make a Get request to your contacts/ endpoint.
Look for the customer you want to modify
copy the ETAG value
copy the id Value (systemId)
In the patch request, you need to specify the contact's systemId you want to update in the url. So Your Url should looks like this:
http://.../companies(<companyId>)/contacts(<systemId>)
In the Headers, you need to specify the Etag value in If-Match header:
if in your response you got:
"@odata.etag": "W/\"JzQ0O05LcU5NbitQREdPOTViWGlrWnBPYjlNYmxZY3BXc2RWREhiSXo1R0VuN0U9MHtPMDsn\""
you'll have to remove the escape characters (\). In postman your If-Match header will be:
W/"JzQ0O05LcU5NbitQREdPOTViWGlrWnBPYjlNYmxZY3BXc2RWREhiSXo1R0VuN0U9MHtPMDsn"
Also provide as Header the following:
Content-Type: "application/json"
Accept: "application/json"
Finaly in the body you provide the fields you want to update, for example:
{
"address": "updatedAddress"
}
Hit send and it should be ok
Im use PATCH method and return this :
{
"error": {
"code": "BadRequest_MethodNotAllowed",
"message": "'PATCH' requests for 'contacts' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services. CorrelationId: f86724-94f-429-9829-d83853db."
}
}
No , but yo need in Contact the field "No." in page extension you cant's use this column.
"The name of field controls in pages of the type API must be alphanumeric.AL(AL0528) " o how to do the UPDATE
Did you try to use PATCH method instead of POST ?
Thanks .
I could already make the post .
but i need UPDATE data in the same way , how to do this?
In Sandbox environment you can use Basic authentication:
Username = Your BC UserName in your user card page
Password = API Key field of your user card.
For production you'll need OAUTH Authentication
Thanks , I could already make the post
Sohail Ahmed
669
YUN ZHU
646
Super User 2025 Season 1
Mansi Soni
495