web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :

Accessing Business Central Data

gunavs Profile Picture gunavs 15

Accessing data inside Business Central

 

Now that we don’t have access to our Back end sql server of traditional NAV, how do we access Business Central data hosted on Microsoft cloud.

Few different ways

1.       Out of the box APIs

2.       OData Web services

3.       Custom API extension pages

In this post, I am going to walk you through setting up the authentication for accessing these various endpoints

Setup Basic Authentication

In your Business Central tenant, Go to Users – Click on the Arrow to create a Web Service Access Key

You can now use this combination of User Name and Web Service Access Key to access the data inside Business Central.

 image001.png

 

To Test the APIs, Download/Open Postman.

 

Here is a sample GET request with Basic Authentication in Postman. My demo tenant Id is M365x817160.onmicrosoft.com. And I use a tenant specific end point to access the data. In your case, you will be replacing M365x817160.onmicrosoft.com with your AAD tenant ID.

https://api.businesscentral.dynamics.com/v1.0/M365x817160.onmicrosoft.com/api/beta

image002.png

 

 

You can also get your AAD Tenant GUID from the Business Central URL, after you Login

 image003.png

 

Setup AAD access

In Portal.Azure.com, Navigate to Azure Active Directory - App Registration

image004.png

 

Create a New Application registration

image005.png

 

 

Once you Create the Web app, Navigate to the App Settings and the required permissions

image006.png

+Add

image007.png

 

Here, Select Dynamics 365

 

 image008.png

 

In the App’s Settings – Required Permissions, check the Delegated Permissions for Dynamics 365

image009.png

 

image010.png

In the Settings again, Create a Key. Make sure you copy the Key once you create it. As you will not be able to access it again.

image011.png

 

Specify the Reply URLs in Settings

 

image012.png

 

For AAD access, you will use the common endpoint

https://api.businesscentral.dynamics.com/v1.0/api/beta

In your Postman, Under Authorization, Select OAuth 2.0

Select Get Access New Token

image013.png

 

In the Grant Type, Select Authorization Code.

1.       In the Callback URL field, specify the URL specified as the sign-on URL/Reply URL in the Azure Portal.

2.       In the Auth URL field, enter

https://login.windows.net/<your tenant domain>/oauth2/authorize?resource=https://api.businesscentral.dynamics.com

3.       In the Access Token , enter the URL

https://login.windows.net/<your tenant domain>/oauth2/token?resource=https://api.businesscentral.dynamics.com

4.       Specify the Application Id Generated in the App registration in Azure portal and the Key you copied in the Client Secret

image014.png

Choose the Request token button.

The first time you log in, you will get prompted for consent. (If you have authenticated to a different tenant before, you can clear the cookies under the Send button)

Now you can use the Token to access the Business Central APIs with AAD authentication

image015.png

 

 

Comments

*This post is locked for comments