
I have to implement the apis of microsoft dynamic 365 into my website but not able to access it. I have implemented authentication by using this https://github.com/thephpleague/oauth2-client, which is working fine. Microsoft graph apis are working but I can't use microsoft dynamic 365. In app also I added the permission of microsoft dynamic 365 business central.As per this documentation With refference of this documentation https://docs.microsoft.com/en-us/dynamics-nav/api-reference/v1.0/api/dynamics_companies_get to fetch company detail I tried following:
endpoint - https://api.businesscentral.dynamics.com/v2.0/production/abc.onmicrosoft.com/api/v1.0/companies
Method - Get
With token that I got from authentication
I am getting this error -
{
"error": {
"code": "RequestDataInvalid",
"message": "Request data is invalid."
}
}
Please let me know what I am doing wrong, am I missing something ?
I think it's the wrong URL , it should be like this :
api.businesscentral.dynamics.com/.../companies
For production , you can remove the domain name as using AAD authentication the account you are using is already associated to tenant.
https://api.businesscentral.dynamics.com/v2.0/production/api/v1.0/companies
check below post for more explanation :
https://docs.microsoft.com/en-us/dynamics-nav/api-reference/v1.0/endpoints-apis-for-dynamics