API
We apologize but this page is not finished so it can contain incomplete or wrong information.
How to connect
Please follow instructions in the Microsoft documentation: Endpoints for the APIs for Dynamics 365 Business Central On-Premises and Online. In the cloud it is always enabled.
An on-premise installation has to be set up to allow connections.
- Business Central 14.0:
- Open the service settings and set Enable API Servicies in tab OData Servicies.
- Restart the service
Base url
Cloud
https://api.businesscentral.dynamics.com/v2.0/
Environment is the name of the environment in the Business Central Admin panel. Typically, it is Production.
On-premise
http[s]://{server}:{port}/{instance}/api/{API version}
Example:
http://pimics:7048/BC/api/v2.0
The version of the API should be in the end of the path, so for Pimics metadata the URL is:
http://pimics:7048/BC/api/pimics/publication/v2.0
Security
Cloud
Cloud use OAuth2.0, so you need to get the access token first. The description is in the Microsoft documentation.
On-premise
Usually you have these possibilities:
- Use NavUserPassword and follow Microsoft's instructions.
- Set NavUserPassword on the service
- Restart the service
- Go to Business Central and search for Users and open the list
- On the user Card set up Web Service Access Key
- Use Windows authentication on the service. In that case you need to follow these settings:
- Open the service settings and set Use NTLM authentication in tab General.
- Restart the service
- Use NTLM authentication with the domain user and password.
- Use AccessControlService and follow Microsoft's instructions.
Postman Example
Windows authentication
Reading published data
Metadata:
{baseurl}/api/pimics/publication/v2.0
Available serviceses:
Modify data in Pimics
External Digital Asset Management
Custom API
It is possible to expose every page or codeunit as a web service. For this topic follow instructions in How publish web service.