2 days ago Microsoft has announced the availability of Dynamics 365 Business Central APIs in Microsoft Graph. Microsoft Graph is an interesting platform that permits you to have a unique gateway for REST APIs that spans across multiple Microsoft services (I’ve talked about it some days ago in my post about the interaction with Teams).
Dynamics 365 Business Central is now one of the available endpoints in Microsoft Graph and I think this is a great way (and alternative to standard APIs) for interacting with the platform.
To work with Dynamics 365 Business Central in Microsoft Graph, you first need to change your D365BC user’s permission in Graph and then enable the Financials.ReadWrite.All permission scope. Here I’m using the Graph Explorer tool:
Afer that, you can start using the Dynamics 365 Business Central APIs available in Microsoft Graph (actually you need to use the BETA API endpoint).
For example, to retrieve the available companies in your Dynamics 365 Business Central tenant, you need to send a GET http request to the following URL:
You can parse this JSON response and retrieve the company’s ID, that you will use in all the next API calls.
For example, to retrieve the list of Customers for the selected company (CRONUS IT in my case), you need to send a GET http request to the following URL:
and you’ll have as response a JSON content that contains the list of all your customers:
You can then perform other queries inside your Dynamics 365 Business Central tenant. For example, to retrieve the General Ledger Entries for a given company ordered by Posting Date descending, you can perform a GET http request to the following URL:
To retrieve for example the details for a certain Currency (for example USD), you need to send a GET http request to the following URL:
https://graph.microsoft.com/beta/financials/companies('80d28ea6-02a3-4ec3-98f7-936c2000c7b3')/currencies?$filter=code eq 'USD'
From this response, I retrieve the ID of the currency because I’ll use it later to create a new Customer record in Dynamics 365 Business Central by using Microsoft Graph APIs.
To create a Customer record in a given company with the desired Currency Code set as USD, you need to send a POST http request to the following endpoint (by setting also the Content-type as application/json):
The request body of this POST request must be a JSON content with the customer’s details to create, like the following:
"displayName": "Graph Customer",
"street": "V.le Kennedy 8",
"blocked": " ",
This is the response (full JSON of the created Customer record):
and this is your new Customer in Dynamics 365 Business Central:
Having Dynamics 365 Business Central native APIs in Microsoft Graph is a great feature and it opens the platform to a complete integration with all the Microsoft’s ecosystem.
The available Dynamics 365 Business Central APIs in Microsoft Graph are actually listed here. Consider them as a BETA, they will be improved for sure in the upcoming future.
What I would like to have “out of the box” as APIs for Dynamics 365 Business Central in Microsoft Graph and that actually we don’t have are APIs for:
These are often data that we need to bulk insert in the ERP or that we have to load from external sources. Having native Microsoft Graph APIs for these entities could be extremely useful (as someone of you already knows, I would like to totally replace Rapidstart packages that are too slow for massive data import scenarios). There’s an opened idea here if you want to support.
This is just the beginning…