OData in Dynamics 365 Finance and Operations

OData in Dynamics 365 Finance and Operations

Introduction

This article aims to explore OData quickly and easily, providing a clear and detailed view of how this technology works and the accessibility of data in enterprise applications.


OData Protocol

OData (Open Data Protocol) is a standard created by Microsoft that allows the creation and consumption of data services in a RESTful manner. It provides a uniform way to interact with data, facilitating operations such as queries, filtering, sorting, inserts or modifications through HTTP requests.


Entities

To integrate OData with D365Fo, you need to configure or validate that the data entities needed for the integration.

Data entities in D365FO must have the IsPublic property set to "yes". These entities represent sets of data that can be accessed and manipulated using the OData protocol.

Article content

Authentication and Authorization

Article content

Integration with OData requires robust authentication and authorization mechanisms to ensure that only authorized users can access and manipulate data. So we will use OAuth to manage authentication, allowing client applications to obtain secure access tokens to interact with OData services.

To do this we just have to create an app registration in our Azure portal and a secret that we will use later to obtain the access token. Once created, the next step is to create the record with that client id (App registration) in our FO environment (Microsoft Entra ID applications Form) and assign it a user according to its permissions.

I won't explain how to get the token in this article, but now we've all needed to get it.


Construction of HTTP Requests

OData requests are made over HTTP, using standard methods such as GET, POST, PUT, and DELETE. Understanding how to construct these requests is essential for interacting with OData services:

  • GET: To read data.
  • POST: To create new data.
  • PUT/PATCH: To update existing data.
  • DELETE: To delete data.

We will use each one at different times and we will need to adapt it according to our request.

Article content

Query Formatting

  • OData queries allow you to efficiently filter, sort, and paginate data. Some of the key functionalities include:
  • Filters: Use $filter to specify conditions that the data must meet.
  • Sorting: Use $orderby to sort the results.
  • Field Selection: Use $select to specify the fields you want to retrieve.
  • Pagination: Use $top and $skip to paginate the results.

https://base-url/data/CustomersV3?cross-company=true&$filter=CustomerAccount eq '00001' and dataAreaId eq 'AAA'&$count=true&$select=CustomerAccount,LanguageId        

Use case OData example:

A typical example of integration might involve creating an application that pulls customers data from D365FO for real-time analysis. This process would involve:

  • Authenticate the application using OAuth to obtain an access token.
  • Construct and send a GET request to a published data entity (for example, CustomersV3).
  • Process the response to extract the relevant data and use it in the application.


External refecences:

Microsoft OData documentation

Public Postman Workspace for Integrations (OData) Credit to: Anthony Blake

Odata query options with D365FO Credit to: Anitha Eswaran



I hope these key concepts have been helpful to you.

Kamesh Kamalanathan

Lead Digital Engineer at Sonata Software

10mo

Great explanation. Thanks a ton

Rupesh Khater

Microsoft Dynamics 365 F&O | Commerce| Retail Consultant| MPOS| CSU| TypeScript | Store Commerce | CPOS | Technical Consultant/ POS Developer/ Freelancer.

10mo

Very informative, Thanks for sharing

Krishna Kant Bhardwaj

D365 F&O ERP Senior Technical Consultant at Crowe | Power Apps | Integration | AI | Dynamics 365 CRM | Copilot

10mo

Insightful!

To view or add a comment, sign in

More articles by Aitor Rescalvo Ribes

Insights from the community

Others also viewed

Explore topics