D365 F&O How to use Data management package REST Import API using flows/Logic app
Before using it you need to understand what is difference between importing file using REST API vs recurring integration.
Choosing an integration API
Two APIs support file-based integration scenarios: the Data management framework’s package API and the recurring integrations API. Both APIs support both data import scenarios and data export scenarios. The following table describes the main decision points that you should consider when you’re trying to decide which API to use.
Decision point | Recurring integrations API | Data management framework’s package API |
---|---|---|
Scheduling | Scheduling in finance and operations apps | Scheduling outside finance and operations apps |
Format | Files and data packages | Only data packages |
Transformation | Support for Extensible Stylesheet Language Transformations (XSLT) if the data file is in XML format | Transformations that are external to the system |
Supported protocols | SOAP and REST | REST |
Service type | Custom service | Open Data Protocol (OData) action |
Here I am going to use logic app, Blob storage and Azure function to complete this integration.
Primary difference between recurring and Data management API is it will required package to import instead of file.
Package must contain following elements to complete import process.
- Manifest,
- HeaderFile
- Data file.
Let’s start with logic app.

Once you have data file, You need to create package in ZIP format. In my case I have saved manifest and Package header in one container and using Azure function to create zip file using three element.

Post creating package, I am saving zip file in One container to verify.
Once you are done with Package creation and basic element creation and you have actual package. Here you have to call DMF API to get blob URI to upload package.
Definition of GetAzureWriteURI
GetAzureWritableUrl
The GetAzureWritableUrl API is used to get a writable blob URL. The method includes a shared access signature (SAS) token that is embedded in the URL. You can use this method to upload a data package to the Azure Blob storage container. For on-premises deployments, this API will still return the URL that has been abstracted to local storage.
HTTP/1.1 200 OK
{
"@odata.context":"https://<baseurl>/data/$metadata#Edm.String",
"value": "{\"BlobId\":\"{<GUID>}\",\"BlobUrl\":\"https://<baseurl_id>.blob.core.windows.net/dmf/<uniqueFileName>?<SAS Token>\"}"
}
}

Post getting URL you need to upload zip file to Blob storage.

Now its second last step to call import package to start importing file.
The ImportFromPackage API is used to initiate an import from the data package that is uploaded to the Blob storage that is associated with your implementation. For on-premises deployments, the import will be initiated from the local storage that the file was uploaded previously to.
There is an async version of this API ImportFromPackageAsync. The specifications are the same. I will be required to capture the execution id returned and the later call the GetExecutionSummaryStatus API to determine when the execution has completed.
POST /data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.ImportFromPackage BODY { “packageUrl”:”<string>”, “definitionGroupId”:”<string>”, “executionId”:”<string>”, “execute”:<bool>, “overwrite”:<bool>, “legalEntityId”:”<string>” }

Using this package will return you execution Id. Which you can use to track output status.
HTTP/1.1 200 OK { “@odata.context”:”https://<baseurl>/data/$metadata#Edm.String”, “value”:{ “value”:”<executionId>” } }
Add some delay based on your Data entity and amount of data, You can use GetExecutionSummaryStatus API.
GetExecutionSummaryStatus
The GetExecutionSummaryStatus API is used for both import jobs and export jobs. It’s used to check the status of a data project execution job. This API is applicable to both cloud deployments and on-premises deployments.
Here is an example of a successful response.
JSONCopy
HTTP/1.1 200 OK
{
"@odata.context":"https://<baseurl>/data/$metadata#Edm.String",
"value":"<executionStatus>"
}

This was originally posted here.
*This post is locked for comments