Guide to API Authentication and Request Handling Using Postman
Note: OAuth API Authentication was required before to executing Request via Postman. For that, kindly click on this link. (Comprehensive Guide to OAuth API Authentication in Microsoft Dynamics 365 Business Central)
Launch the Postman application. To log in, enter your credentials.
Select Collections. Next, select “Plus” to add the Blank collection.
Following the addition of a collection You can make changes to a Collection name as seen in the image below. Then, as seen in the image, click “Add Request”.
Enter the URL https://api.businesscentral.dynamics.com/v2.0/{SandboxName}/api/V2.0/Companies as it appears in the image.
If you send a GET request directly, you will receive an error message.
<error xmlns="http://docs.oasis-open.org/odata/ns/metadata">
<code>Unauthorized</code>
<message>The credentials provided are incorrect</message>
</error>
Therefore, you must go to the Authorization section, where.
Authentication Type: OAuth 2.0
Add authorization data to: Request Headers
Navigate to the “Configure new token” area.
Token Name: feel free to enter any name, I am giving Testing.
Grant Type: Client Credentials
Access Token URL: The URL for the access token is available at Azure portal Proceed to App Registration, pick your application, and then navigate to the Overview area. There, you will see an “Endpoints” action; click on it to get data.
Client ID: Client ID can be found at Azure portal
Client Secret: A client secret that you create on Azure portal
Scope: https://api.businesscentral.dynamics.com/.default
Client Authentication: Send as Basic Auth header
After entering all the details. Select the option “Get New Access Token” to obtain a fresh access token for authentication.
Now, click on the Proceed and Use Recently Created Token.
“Thank you for your time and attention”.