Header Ads Widget

🌐 Simple OData Integration with D365FO Using Postman

 

🔐 Prerequisites

Before you begin, ensure you have the following setup:

  • ✅ Postman installed

  • ✅ Your Azure Tenant ID

  • ✅ Registered Client ID (App ID)

  • Client Secret value

  • ✅ D365 F&O environment URL


🏗️ Register Your App in D365FO

  1. Navigate to:
    System administration → Setup → Microsoft Entra ID applications

  2. Click New, then enter:

    • App ID → Your Client ID from Azure

    • Name → Any friendly display name

    • User ID → A user with relevant security permissions (e.g., Admin)



🔑 Step 1: Acquire Access Token in Postman

Method: POST
URL:

bash
https://login.microsoftonline.com/<TenantID>/oauth2/v2.0/token

🔸 Headers Tab





Set these headers (most are defaults):

KeyValue
Hostlogin.microsoftonline.com
Content-Typeapplication/x-www-form-urlencoded

🔸 Body Tab (x-www-form-urlencoded)




KeyValue (example)
client_idYOUR_CLIENT_ID
client_secretYOUR_CLIENT_SECRET
grant_typeclient_credentials
scopehttps://YOUR_ENVIRONMENT_URL/.default

➡️ Click Send and you’ll receive an access token in the response. This token will be used in subsequent OData calls.


🔄 Step 2: Call OData Endpoints

Use the token received above in Authorization tab → Type = Bearer Token.

✅ GET: Read Data




Retrieve records from a data entity:

perl
GET https://<YOUR_ENVIRONMENT>/data/SalesOrderHeadersV2

➕ POST: Insert a Record




Create a new record (e.g., Sales order):

perl
POST https://<YOUR_ENVIRONMENT>/data/SalesOrderHeadersV2 Body: { "SalesOrderNumber": "12345", "CustomerAccount": "US-001" }

📝 PATCH: Update a Record



Update fields in an existing record:

css
PATCH https://<YOUR_ENVIRONMENT>/data/SalesOrderHeadersV2(SalesOrderNumber='12345') Body: { "CustomerReference": "UpdatedRef" }

❌ DELETE: Remove a Record





Delete a record by key:

perl
DELETE https://<YOUR_ENVIRONMENT>/data/SalesOrderHeadersV2(SalesOrderNumber='12345')

🧩 Expand and Filter Data (Advanced Querying)

Use $expand and $select to fetch related records and specific fields:

http
GET https://<YOUR_ENVIRONMENT>/data/PurchaseOrderHeadersV2? $filter=dataAreaId eq 'USMF'& Cross-company=true& $select=PurchaseOrderNumber,VendorOrderReference& $expand=PurchaseOrderLinesV2($select=PurchaseOrderNumber,LineNumber)




📚 Reference

  • Microsoft Docs:
    OData in D365FO
    (Official source for all OData authentication, metadata, and usage patterns)


✅ Summary

You’ve now seen how to:

  • Register an app in D365FO

  • Use Postman to acquire an access token

  • Perform CRUD operations on D365 F&O OData endpoints

  • Use advanced querying features like $expand and $select

This setup is essential for integrating external systems or building custom apps that connect to Dynamics 365 data securely.

Post a Comment

0 Comments