Articles in this section

Set up an OAuth 2.0 HTTP connection to Microsoft Dynamics 365 Business Central, export, and import data via custom APIs

Microsoft Dynamics 365 Business Central is a business management solution that automates and streamlines business processes. It helps small and mid-sized organizations to manage their business, including finance, manufacturing, sales, shipping, project management, services, and more. With Microsoft Dynamics 365 Business Central, companies can easily add functionality that is relevant to the region of operation and it is customized to support highly specialized industries.

This article demonstrates how to connect to Microsoft Dynamics 365 Business Central through custom APIs by setting up a universal HTTP connection with OAuth 2.0 based authentication and leads you through prerequisites for creating imports and exports using Microsoft Dynamics 365 Business Central custom APIs.

Microsoft Dynamics 365 Business Central documentation: API guide, Authentication, Developing a custom API

A. Prerequisites

  1. Developing a Custom API according to your business requirements.
  2. Create an iClient (application) in Microsoft Dynamics 365 Business Central.

B. Set up an HTTP connection

Start establishing an HTTP connection to Microsoft Dynamics 365 Business Central in either of the following ways:

  • From the Resources menu, select Connections. Then, click + Create connection at the top right.
        – or –
  • While working in a new or existing integration, you can add an application to a flow simply by clicking Add source or Add destination/lookup

In the resulting Application list, select HTTP.

The Create connection panel opens with required and advanced settings.

C. Describe the general HTTP connection settings

Edit the General settings specific to your account and this connection resource.

Name (required): Provide a clear and distinguishable name. Throughout integrator.io imports and exports, you will have the option to choose this new connection, and a unique identifier will prove helpful later when selecting among a list of connections that you’ve created.

Application (required, non-editable): A reminder of the app you’re editing. 

Mode (required): Select one of the following options:

  • Cloud to connect to a publicly accessible server application
  • On-premise to connect to a server that is publicly inaccessible and has integrator.io agent installed on it

D. Provide required HTTP account information

Note: This article is concerned only with the settings needed for the Microsoft Dynamics 365 Business Central through a custom API connection. For complete field documentation, see Set up an OAuth 2.0 HTTP connection.

At this point, you’re presented with a series of options for providing HTTP authentication.

Application.png

Base URI (required): Enter the Microsoft Dynamics 365 Business Central base URI: https://api.businesscentral.dynamics.com/v2.0.

Media type (required): Select JSON.

Override media type for success responses: Accept the default value: Do not override.

Override media type for error responses: Accept the default value: Do not override.

E. Configure authentication settings

In the Configure authentication section, select OAuth 2.0 and configure the authentication. 

Configure.png

Auth type (required): Select OAuth 2.0.

OAuth 2.0 client (required):Select the iClient that stores the client ID and client secret provided to you by Microsoft Dynamics 365 Business Central. To add an iClient and configure your credentials, click the plus (+) button. Click the edit ( Edit button ) button to modify a selected iclient. Provide a clear and distinguishable Name along with the Client ID and Client secret from your Microsoft Dynamics 365 Business Central account. Click Save & close to add the iClient to your integrator.io account and select it for this connection.

Grant type (required): Select Authorization code.

Send client credentials via (required): Accept the default value: HTTP body.

Authorization URL (required): Enter the Microsoft Dynamics 365 Business Central authorization URL: https://login.microsoftonline.com/common/oauth2/authorize.

Redirect URL (read-only): Copy this integrator.io redirect URL to provide directions to Microsoft Dynamics 365 Business Central for where to go after authentication. (This URL should be whitelisted with the authorization server.)

Access token URL (required): Enter the Microsoft Dynamics 365 Business Central access token URL: https://login.microsoftonline.com/common/oauth2/token.

Oauth.png

Send token via (required): Select HTTP header.

Header name (required): Accept the default value: Authorization.

Header scheme: Select Bearer.

  1. Sign in to your Azure portal.
Azure.png
  1. Navigate to Microsoft Entra ID > App registrations and click the required app.
Navigate.png
  1. Copy your client ID.
client.png
  1. Navigate to Certificates & secrets and copy your client secret.
secret.png

F. Specify how to test this connection

Expand the How to test this connection? section.

Test.png

HTTP method: Select GET.

Relative URI: Enter the relative URI in this format: /[user_domain_name]/api/[API_publisher]/[API_group]/[API_version]/entityDefinitions. For example:/Sandbox/api/bctech/demo/v1.0/companies.

G. Save and authorize

To save and authorize the Microsoft Dynamics 365 Business Central connection:

  1. Click the Save & authorize button to commit your changes and proceed to log in with Microsoft Dynamics 365 Business Central.
  2. Enter the email address of your registered Microsoft Dynamics 365 Business Central account.
  3. Click Next.
MS.png
  1. Enter the password for your Microsoft Dynamics 365 Business Central account.
  2. Click Sign in.
  3. Review the permission and click Accept to grant permission and establish the connection.
MSDBC_365_HTTP_COnnection.png

H. Exports

Below is an example on how to configure the export using the Get Billing operation for Microsoft Dynamics Business Central custom API and extract data from Microsoft Dynamics Business Central.

The relative URI is: /[user_domain_name]/api/[API_publisher]/[API_group]/[API_version]/billingExport.

Export.png

I. Imports

Below is an example on how to configure the lookup using the Get Shipment methods operation.

The relative URI is: /[user_domain_name]/api/[API_publisher]/[API_group]/[API_version]/companies(company_id))/ShippingMethodMapping?$filter=Name eq '{{record.shipping_lines.0.title}}'.

Look.png

Below is an example on how to configure the dynamic lookup using the Get Shipping Lines operation.

DL.png

Below is an example on how to configure the import using the Post Sales Orders operation.

The POST relative URI is: /[user_domain_name]/api/[API_publisher]/[API_group]/[API_version]/companies(company_id))/salesOrders.

The PATCH relative URI is: /[user_domain_name]/api/[API_publisher]/[API_group]/[API_version]/companies(company_id))/salesOrders({{{lookup.GetSalesOrderId}}}).

import.png

Below is an example of HTTP request body:

HTTP.png
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.