API

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. See how to enable API in on-prem installation.

  • Business Central 14.0:
    1. Open the service settings and set Enable API Servicies in tab OData Servicies.
    2. Restart the service

Base url

Cloud

https://api.businesscentral.dynamics.com/v2.0/{Environment}/api/{API Publisher}/{API group}/{API version}

Environment is the name of the environment in the Business Central Admin panel. Typically, it is Production.

Example:

https://api.businesscentral.dynamics.com/v2.0/Production/api/pimics/publication/v2.0

On-premise

http[s]://{server}:{port}/{instance}/api/{API Publisher}/{API group}/{API version}

Example:

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.
    1. Set NavUserPassword on the service
    2. Restart the service
    3. Go to Business Central and search for Users and open the list
    4. 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:
    1. Open the service settings and set Use NTLM authentication in tab General.
    2. Restart the service
    3. Use NTLM authentication with the domain user and password.
  • Use AccessControlService and follow Microsoft's instructions.

Reading published data

Metadata:

{baseurl}/api/pimics/publication/v2.0

Available serviceses:

Definition of services in YAML

Here is a Yaml file for Swagger that contains the description of available services.

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.

Title: API, Author: Pimics Team