CLOSE
CLOSE
https://www.sikich.com

Dynamics 365 Finance and Supply Chain Management OData for Integrating Applications

Microsoft Dynamics 365 Finance and Supply Chain Management (also known as Finance and Operations) provides many options for integration with different strengths. One of the strengths of OData is that it is a common standard (https://www.odata.org/) with libraries available in many different languages or platforms.

Be sure to evaluate the integration technology to match the size and scale of your operations.

More general information about OData in Dynamics 365 can be found here: https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/odata

Per https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/integration-overview, be sure to evaluate the volume of records and the volume of service calls to determine if OData is a good match.

When an OData integration covers multiple operations (sales order lines from an ecommerce system, for example), it may be useful to combine multiple OData requests into a batch operation:

Note: this is separate and distinct from the “Batch” API which is available for integration with data packages (https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/data-management-api)

Understand OData Batching:

  • OData allows grouping multiple operations into a single HTTP request payload using batching (https://www.odata.org/documentation/odata-version-2-0/batch-processing/).
  • Batch requests are submitted as a single HTTP POST request to the $batch endpoint of an OData service.
  • The batch request contains multiple operations, each represented as a separate part within the request.

 Format of a Batch Request:

  • An OData batch request is represented as a Multipart MIME v1.0 message.
  • The batch request must have a Content-Type header specifying a content type of “multipart/mixed” and a boundary specification.
  • The boundary acts as a delimiter between different parts of the batch request.

Example header:

ContentType "multipart/mixed; boundary=batch_618971e6"

Example body:

--batch_618971e6Content-Type: multipart/mixed;boundary=changeset_618971e6

Content-Transfer-Encoding: binary

--changeset_618971e6

Content-Type: application/http

Content-Transfer-Encoding: binary

Content-ID: 1

PATCH /data/EntityName(dataAreaId='dat',ContainerId='CONL000022187') HTTP/1.1

OData-Version: 4.0

OData-MaxVersion: 4.0

Content-Type: application/json;odata.metadata=minimal

Accept: application/json;odata.metadata=minimal

Accept-Charset: UTF-8

User-Agent: Microsoft.OData.Client/7.5.4

Authorization: Bearer {Bearer Token}

{

"SikDownloaded":"Yes"

}

--changeset_618971e6

Content-Type: application/http

Content-Transfer-Encoding: binary

Content-ID: 2

PATCH /data/EntityName(dataAreaId='dat',ContainerId='CONL000022189') HTTP/1.1

OData-Version: 4.0

OData-MaxVersion: 4.0

Content-Type: application/json;odata.metadata=minimal

Accept: application/json;odata.metadata=minimal

Accept-Charset: UTF-8

User-Agent: Microsoft.OData.Client/7.5.4

Authorization: Bearer {Bearer Token}

{

"SikDownloaded":"Yes"

}

--changeset_618971e6--

--batch_618971e6--

429 Throttle Handling

When creating an integration, it is key to evaluate volume and throughput to ensure successful operations. One of the ways that D365 Supply Chain Management ensures availability of services and consistency of response times is by recognizing when an integrating application has exceeded the available resources. When the webservices are over-allocated. it will respond with a 429 Too Many Requests (https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429).

 Throttling Overview

  • Throttling is when the number of requests exceeds the rate at which the system allows over a period of time.
  • When your OData request experiences throttling, you’ll receive an HTTP 429 Too Many Requests error.
  • Throttling can lead to delayed data processing, reduced performance, and potential issues with retry policies.

Dynamics provides a “wait” value—but depending on the scale and nature of your integration it may make sense to evaluate other wait models. One common approach which provides some resiliency, and helps prevent all “waiting” clients from retrying at the same time in mutli-client scenarios is Exponential back off and jitter https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/

OData Paging

When you make an OData request to an entity it is possible to specify a page size—if you do not specify one and there are a large number of records in the related tables then Dynamics will default in a page size for you.

When there are more pages of data to retrieve, the service response includes an @odata.nextlink property which is a URL for the next page.

Dynamics 365 Odata paging

Cross-company

By default Dynamics 365 operations OData requests will execute in the data area/company context of the default company for the user (https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/odata#cross-company-behavior ). One can override that default by passing a query parameter on the URL.

?cross-company=true

This error typically manifests as users or applications, “seeing no data” when the Entra app id may have been associated to a user with DAT as the default company. Any integration using OData should be aware of this.

For more technical D365 Finance and Supply Chain Management advice, please contact us here.

This publication contains general information only and Sikich is not, by means of this publication, rendering accounting, business, financial, investment, legal, tax, or any other professional advice or services. This publication is not a substitute for such professional advice or services, nor should you use it as a basis for any decision, action or omission that may affect you or your business. Before making any decision, taking any action or omitting an action that may affect you or your business, you should consult a qualified professional advisor. In addition, this publication may contain certain content generated by an artificial intelligence (AI) language model. You acknowledge that Sikich shall not be responsible for any loss sustained by you or any person who relies on this publication.

About the Author