Tuesday, March 11, 2025

 

Integrating Microsoft Dynamics 365 Finance and Operations (D365 FO) OData with Postman



Introduction

Microsoft Dynamics 365 Finance and Operations (D365 FO) provides OData (Open Data Protocol) APIs, allowing developers to interact with D365 FO data programmatically. Using Postman, we can test these APIs for retrieving, creating, updating, and deleting data without writing any code.

This guide will walk you through the process of integrating D365 FO OData APIs with Postman, covering:

  • Registering an app in Azure Active Directory (AAD)
  • Obtaining an access token
  • Making API calls to D365 FO OData endpoints

Step 1: Register an Application in Azure Active Directory (AAD)

Since D365 FO is secured using Azure AD, you must create an Azure AD App Registration to authenticate API requests.

1.1 Register the App

  1. Go to Azure Portal: https://portal.azure.com
  2. Navigate to: Azure Active DirectoryApp registrations
  3. Click "New Registration"
    • Enter a name (e.g., "D365FO_Postman")
    • Choose Accounts in this organizational directory only
    • Redirect URI: Set it as https://login.microsoftonline.com/common/oauth2/nativeclient
    • Click Register

1.2 Get Client Credentials

  1. Copy the "Application (client) ID"
  2. Generate a Client Secret:
    • Go to Certificates & secrets
    • Click New client secret → Set expiry → Copy the generated secret

1.3 Set API Permissions

  1. Navigate to "API Permissions"
  2. Click "Add a Permission"APIs my organization uses
  3. Search for Dynamics ERP → Select Delegated Permissions
  4. Add permissions: user_impersonation
  5. Click Grant admin consent

Step 2: Obtain an Access Token in Postman

To interact with D365 FO OData APIs, you need an OAuth 2.0 access token.

2.1 Configure OAuth in Postman

  1. Open Postman and create a new request
  2. Go to the Authorization tab
  3. Select OAuth 2.0 as the type
  4. Click Get New Access Token
  5. Fill in the details:
    • Token Name: D365FO Token
    • Grant Type: Client Credentials or Authorization Code
    • Access Token URL: https://login.microsoftonline.com/{tenant_id}/oauth2/token
    • Client ID: Your app's Client ID
    • Client Secret: Your app's Client Secret
    • Scope: https://<your-d365fo-instance>/user_impersonation
    • Audience: https://<your-d365fo-instance>
  6. Click Request Token
  7. Once the token is generated, click Use Token

Step 3: Making OData API Calls in Postman

Once you have an access token, you can start querying D365 FO data using OData endpoints.

3.1 Get a List of Customers

  • Method: GET
  • URL: https://<your-d365fo-instance>/data/CustomersV3
  • Headers:
    • Authorization: Bearer {access_token}
    • Content-Type: application/json

3.2 Create a New Customer

  • Method: POST
  • URL: https://<your-d365fo-instance>/data/CustomersV3
  • Headers:
    • Authorization: Bearer {access_token}
    • Content-Type: application/json
  • Body (JSON):
{
  "CustomerAccount": "C0001234",
  "Name": "John Doe",
  "AddressStreet": "123 Main St",
  "City": "Seattle",
  "State": "WA",
  "ZipCode": "98101"
}

3.3 Update Customer Information

  • Method: PATCH
  • URL: https://<your-d365fo-instance>/data/CustomersV3(CustomerAccount='C0001234')
  • Headers:
    • Authorization: Bearer {access_token}
    • Content-Type: application/json
  • Body (JSON):
{
  "Name": "John Doe Updated"
}

3.4 Delete a Customer

  • Method: DELETE
  • URL: https://<your-d365fo-instance>/data/CustomersV3(CustomerAccount='C0001234')
  • Headers:
    • Authorization: Bearer {access_token}

Conclusion

By following these steps, you can easily integrate D365 FO OData APIs with Postman. This allows you to test API calls, automate processes, and interact with D365 FO data programmatically.

If you encounter issues, check:

  • Azure AD Permissions: Ensure your app has the correct user_impersonation permissions
  • Access Token Validity: Regenerate if expired
  • Correct OData Endpoint: Verify the URL structure

Happy coding! 🚀

  Integrating Microsoft Dynamics 365 Finance and Operations (D365 FO) OData with Postman Introduction Microsoft Dynamics 365 Finance and O...