Wednesday, July 3, 2024

Data management package REST API - Import package in dynamics 365FO using postman

Data Management Package REST API - Import Package in Dynamics 365FO Using Postman

Data Management Package REST API - Import Package in Dynamics 365FO Using Postman

Welcome to our comprehensive guide on using the Data Management Package REST API to import data into Dynamics 365 for Finance and Operations (Dynamics 365FO) efficiently. This tutorial will walk you through each step of the process using Postman.Please ensure your Bearer token is generated before proceeding.

This same URL which i am going to use can be trigger from any third party system to integrate with dynamics D365 Finance and operations.

Step 1: Create Import Project

Create an import project in Data Management as shown below.

Create Import Project

Step 2: Get Azure Write URL

Post the GetAzureWriteUrl request to the following endpoint:

POST - {{resource}}/data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetAzureWriteUrl

Body:

{
    "uniqueFileName": "CustomerGroupTestFile"
}

A successful response from GetAzureWriteUrl will provide the necessary URL for the next steps.

Successful response of GetAzureWriteUrl

Step 3: Generate Package

You can generate the package in two ways:

  1. Generate the package as shown in this blog.
  2. Generate the package by exporting it directly from the DMF project as shown below.

Steps to Export Package:

  1. Create an export project.
  2. Run the export project.
  3. Download the package as shown below.
Create Export Project Run Export Package

Prepare your template in an Excel file.

Download Package

Save it as a Zip. Ensure the Zip contains only the three files shown below.

Extracted Files

Step 4: Upload Package

Copy the highlighted blob URL from the previous response of GetAzureWriteUrl highlited in below screen response section..

Highlighted Blob URL

Paste the URL in the URL section select Put method.

Paste URL and Set Parameters

Set the below parameter x-ms-blob-type to BlockBlob.

Set Blob Type

After sending the request, you will receive the response shown below:

Response After Send

Step 5: Import From Package

Post the ImportFromPackage request with the following body:

POST : {{resource}}/data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.ImportFromPackage

Body:
{
    "packageUrl": "URL on which we have uploaded the package.",
    "definitionGroupId": "VendorGroupsFileImport",
    "executionId": "",
    "execute": true,
    "overwrite": true,
    "legalEntityId": "USMF"
}
Import From Package

Headers for ImportFromPackage

Headers for ImportFromPackage

The response of ImportFromPackage

Response of ImportFromPackage

New batch history record created under the import group.

Headers for ImportFromPackage

Conclusion

By following these detailed steps, you can effectively manage data imports using the Data Management Package REST API in Dynamics 365FO. This approach not only ensures accuracy but also enhances the efficiency of handling large data sets within your organization.

No comments:

Post a Comment

How to Post Partial Product Receipt in D365FO Using X++ Code

How to Post Partial Product Receipt in D365FO Using X++ Code How to Post Partial Product Receipt in D365FO Using X++...