Get started developing Connect apps for Dynamics 365 Business Central

Note

Azure Active Directory is now Microsoft Entra ID. Learn more

A Connect app establishes a point-to-point connection between Dynamics 365 Business Central and a third-party solution or service and is typically created using standard REST API to interchange data. Any coding language capable of calling REST APIs can be used to develop your Connect app. In the following section, you can read about how you get started exploring the available APIs for Dynamics 365 Business Central.

Shows the API stack in Business Central

To explore and develop against REST APIs in Dynamics 365 Business Central, you must first sign up for a trial tenant, and then you must connect and authenticate. To do that, follow these steps:

  1. Sign up for Dynamics 365 Business Central.
    When you have your tenant, you can sign into the UI to explore the product and the APIs
  2. There are two different ways to connect to and authenticate against the APIs.
    • Use Microsoft Entra ID based authentication against the common API endpoint: https://api.businesscentral.dynamics.com/v2.0/<environment name>/api/v2.0
    • Use basic authentication with username and password (a so-called web service access key) against the common API endpoint that includes the user domain, for example https://api.businesscentral.dynamics.com/v2.0/production/cronus.com/api/v2.0.

      Important

      When going into production, you should use Microsoft Entra/OAuth v2 authentication and the common endpoint https://api.businesscentral.dynamics.com/v2.0/production/api/v2.0. For exploring and initial development, you can use basic authentication.

      Important

      Basic authentication is deprecated with Business Central 2022, release wave 1 for SaaS. Learn more in Deprecated features in the platform - clients, server, and database.

To construct the URL for the environment, the path needs to contain the environment name. To learn how to get a list of environments deployed on the tenant, see Getting a list of environments. OAuth is required for this endpoint.

APIs can also be explored through the OpenAPI specification for Business Central.

Set up Microsoft Entra ID based authentication

Sign in to the Azure portal to register Dynamics 365 Business Central as an app and thereby provide access to Dynamics 365 Business Central for users in the directory.

  1. Follow the instructions in the Integrating applications with Microsoft Entra ID article. The next steps elaborate on some of the specific settings you must enable.

  2. On the API permissions page for your app, select the Add a permission button.

  3. Make sure the Microsoft APIs tab is selected. In the Commonly used Microsoft APIs section, select Dynamics 365 Business Central and select Delegated permissions.

  4. Ensure that the right permission is checked: Financials.ReadWrite.All. Use the search box if necessary.

  5. Choose the Add permissions button.

    Note

    If Dynamics 365 doesn't show up in search, it's because the tenant doesn't have any knowledge of Dynamics 365. To make it visible, an easy way is to register for a free trial for Dynamics 365 Business Central with a user from the directory.

  6. From the Certificates & secrets page, in the Client secrets section, choose New client secret:

    • Type a key description (of instance app secret),
    • Select a key duration of either In 1 year, In 2 years, or Never Expires.
    • When you select the Add button, the key value is displayed, then copy, and save the value in a safe location.

    Note

    You'll need this key later to configure the project in Visual Studio. This key value won't be displayed again, nor is it retrievable by any other means, so record it as soon as it's visible from the Azure portal.

You have now set up the Microsoft Entra ID based authentication. Next, you can go exploring the APIs.

Set up basic authentication (only for on-premises)

Important

Starting October, 2022, the use of access keys (Basic Auth) for web service authentication is deprecated and not supported in Business Central online. We recommend that you use OAuth2 instead. For more information, see Using OAuth to Authorize Business Central Web Services.

If you prefer to set up an environment with basic authentication just to explore the APIs, you can skip setting up the Microsoft Entra ID based authentication for now and proceed with the steps below. If you, however, want to go into production, you must use Microsoft Entra ID/Oauth v2 authentication, see the section Setting up Microsoft Entra ID based authentication.

  1. To set up basic authentication, log into your tenant, and in the Search field, enter Users and then select the relevant link.
  2. Select the user to add access for, and on the User Card page, in the Web Service Access Key field, generate a key.
  3. Copy the generated key and use it as the password for the username.

Now that we have the username and password, we can connect and authenticate, which you can do from code, or API explorers such as Insomnia, Bruno, or Insomnium.

API developer overview Using filtering with APIs
Tips for working with APIs
Troubleshooting API calls
API performance