This article will help you understand the basic structure of REST APIs to manage your data packages using Data Management Framework REST API.

You will also be introduced to Microsoft Dynamics 365 and its amazing features that make it so popular among businesses.

In addition, you understand the need for Microsoft Dynamics Integration REST API. At the end of this article, you will explore some of the key benefits offered by these APIs.

Introduction to Microsoft Dynamics 365

  • Microsoft Dynamics 365 is a Cloud application platform that incorporates CRM (Customer Relationship Management) and ERP (Enterprise Resource Planning), as well as productivity apps and Artificial Intelligence features.
  • Key Features of Microsoft Dynamics 365
    • Develop No-Code Applications
    • Detailed Sales Insights
    • Intelligent Analytics
    • Smart Search
    • Seamless Integrations

Introduction to Microsoft Dynamics Integration REST API

  • REST APIs is an acronym for Representational State Transfer Application Programming Interface.
  • A REST API is a data source’s frontend, allowing users to create, retrieve, update, and delete data items. An API is typically a portal to the rest of the world for developer teams.
Solve your data replication problems with Hevo’s reliable, no-code, automated pipelines with 150+ connectors.
Get Your Customized Demo Now!

How Do I Connect Data management package REST API

  • Data Management Framework (DMF) is Microsoft’s new all-in-one solution for Dynamics 365 for Finance and Operations.
  • DMF REST API allows you to manipulate data packages to interact with Finance and Operations applications. This REST API can be used to interact with the DMF programmatically, allowing you to do tasks like:
    • Importing a data package.
    • Exporting a data package.
    • Monitoring the status of the above operations.

Understand some basic API syntax to manage your import and export of data packages.

  • Microsoft Dynamics Integration REST API: Import APIs
  • Microsoft Dynamics Integration REST API: Export APIs
  • Microsoft Dynamics Integration REST API: Check Status of APIs

Method 1- How to Import API

Step 1 – The ImportFromPackage API is used to start the process of importing a data package.

The data package is uploaded to Blob storage. The import for on-premises will commence from the local storage file that was previously uploaded.

Step 2 – An example of code for importing data packages is shown below:

POST /data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.ImportFromPackage
BODY
{
    "packageUrl":"<string>",
    "definitionGroupId":"<string>",
    "executionId":"<string>",
    "execute":<bool>,
    "overwrite":<bool>,
    "legalEntityId":"<string>"
}

Step 3 -The following is a list of the above code components:

  • ImportFromPackage: It is used to start the import process.
  • packageurl: Blob IDs are tracked using this unique file name. To ensure a unique file name, you can include a Globally Unique IDentifier (GUID).
  • definitionGroupID: It contains the name of the data project that will be imported.
  • executionId: It represents the job’s unique ID. A new execution ID will be established automatically if an empty ID is supplied.
  • execute: It’s a Boolean expression. The target step will be executed if the parameter is set to True.
  • overwrite: When a composite entity is included in a package, this Boolean value must be set to False, otherwise, it should be set to True.
  • legalentityId: This ID represents the import’s legal entity.

You will get a JSON success response if the import is completed successfully. Below is an example of a successful response.

Build And Monitor, Connect MS Dynamics 365 Integration REST API and Data Management Get Started For Free

HTTP/1.1 200 OK
{
    "@odata.context":"https://<baseurl>/data/$metadata#Edm.String",
    "value":"<executionId>"
}

TStep 4 – he following diagram explains how to import data packages using the DMF package REST API.

Microsoft Dynamics Integration REST API - Import Data Packages

Method 2 – Export APIs

The ExportToPackage API is used to commence a data package export. This API is compatible with both Cloud and on-premises setups. Before calling this API, you must first establish the export data project. A call to the API gives an error if the project does not exist.

An example of code to begin the export process is shown below:

POST /data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.ExportToPackage
BODY
{
    "definitionGroupId":"<Data project name>",
    "packageName":"<Name to use for downloaded file.>",
    "executionId":"<Execution Id if it is a rerun>",
    "reExecute":<bool>,
    "legalEntityId":"<Legal entity Id>"
}

You will receive a JSON success response if the export was successful. Below is an example of a successful response. You will receive a JSON success response if the export was successful. Below is an example of a successful response.

HTTP/1.1 200 OK
{
    "@odata.context":"https://<baseurl>/data/$metadata#Edm.String",
    "value":{
        "value":"<executionId>"
    }
}

GetExportedPackageUrl

The GetExportedPackageUrl API returns the URL of the data package that was exported using the ExportToPackage command. This API is compatible with both Cloud and on-premises setups.

The following is code can be used for obtaining the URL of an exported data package:

POST /data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExportedPackageUrl
BODY
{"executionId":"<Execution Id>"}

The following diagram explains how to export data packages using the DMF package REST APIs.

Microsoft Dynamics Integration REST API - Export Data Packages
Image Source

Method 3 – Check Status of APIs

For both import and export jobs, the GetExecutionSummaryStatus API is used to monitor the status of your data project execution. This API can be used in both Cloud and on-premises setups. Remember that the file will be stored in Blob storage for 7 days before being automatically discarded.

Use GetExecutionSummaryStatus and the executionId to verify the status of the API. The following code can be used to track the status of your execution:

POST /data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExecutionSummaryStatus
BODY
{"executionId":"<executionId>"}

The above code should return the execution status and a JSON successful response message.  An example of response is shown below:

HTTP/1.1 200 OK
{
    "@odata.context":"https://<baseurl>/data/$metadata#Edm.String",
    "value":"<executionStatus>"
}

The following are possible values for the executionStatus:

  • Executing
  • Succeeded
  • PartiallySucceeded
  • Unknown
  • NotRun
  • Failed
  • Canceled

The Benefits of Integrating with Dynamics 365

  • Dynamic Web and Mobile Applications: Companies can leverage Microsoft Dynamics Integration REST API to keep bidirectional conversations going, develop loyalty, target customers for marketing campaigns, and improve customer service.
  • Streamlined Management: Dynamics 365 REST API integration delivers significant cost savings, minimizes the need for manual data entry, gives real-time inventory statistics, and allows wiser business choices.
  • Robust Connections to Third-party Resources: Shippers, supply chain participants, and BI resources can all be accessed using robust Dynamic 365 REST APIs. To monitor and enhance the company, your team can observe every aspect of operations. With Dynamics 365 API integration, it’s simple to add and upgrade tools and technologies.

Learn More About:

Setting Up HubSpot Dynamics Integration

Conclusion

  • You learned more about Microsoft Dynamics 365 and discovered its various features.
  • In addition, you understood how to create Microsoft Dynamics Data Management REST APIs.
  • At the end of this article, you explored some of the benefits of this integration to create more streamlined workflows and robust integrations.
Shubhnoor Gill
Research Analyst, Hevo Data

Shubhnoor is a data analyst with a proven track record of translating data insights into actionable marketing strategies. She leverages her expertise in market research and product development, honed through experience across diverse industries and at Hevo Data. Currently pursuing a Master of Management in Artificial Intelligence, Shubhnoor is a dedicated learner who stays at the forefront of data-driven marketing trends. Her data-backed content empowers readers to make informed decisions and achieve real-world results.

No-Code Data Pipeline For Microsoft Dynamics 365