Hello Experts,
I have an issue I hope you can help me with. I have an API call to try and get the list of companies in Business Central using an OAUTH2 token.
GET REQUEST from Postman: api.businesscentral.dynamics.com/.../<environment name>/api/v2.0/companies
When I send this request in postman I am getting a 200 OK response which is good, but there are no company values available to me. (the response reads "Value": []) In order to try and solve this issue I was playing around with connecting with Web Service Access Key and I was able to pull a list of production environments, so I thought maybe I could sneak by and enter the company as I already know it and try to access Companies(CompanyID)/customers but I got an error that I do not have access to the company.
I was wondering where I went wrong in setup? I have added my Azure AD app to Business Central in the Azure AD application card, Is it a problem with the user who is accessing the token? Are they unable to reach the company? truthfully, I am cobbling together my knowledge from lots of different MS articles that I have read on the subject and am a little out of my element.
If you can point me in the direction of the problem, and/or additional reading that will help me solve this issue, and get a better understanding of API and Business Central in general that would be much appreciated.
Thanks for your time,
Hey ZHU, thanks for this. This was 100% the problem. I was SO SURE that this was already correct I never went back to double check. Thanks!
Hi, It looks like you already have access to BC, but don't have access to all companies.
Please check, is the Company Name set in the Azure Active Directory Application Card?
Hope this will help.
Thanks.
ZHU
Hi
Please see this article for OAUTH connection. I followed it before and had sucess https://yzhums.com/20690/
I think code for company name is something like api.businesscentral.dynamics.com/.../companies which is v2.0/ environment id / environment name etc.
See this article for more info https://yzhums.com/6117/ specifically below section.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,524 Super User 2024 Season 2
Martin Dráb 228,469 Most Valuable Professional
nmaenpaa 101,148