Wednesday, July 3, 2024

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

How to Export Data Packages in Microsoft Dynamics 365 finance and operations

How to Export Data Packages in Microsoft Dynamics 365 finance and operations

Hi All,

In this tutorial, we will guide you through the process of exporting data packages in Microsoft Dynamics 365. 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 a New Export Project in Data Management

First, navigate to the Data Management workspace in Dynamics 365 and create a new export project. This project will define the data you wish to export.

Data Management Workspace

Step 2: ExportToPackage Request via Postman

To export a package, you need to send a request from Postman. Here are the details you need:

  • {{resource}}: Your Dynamics 365 URL
  • definitionGroupId: Group name from the previous screenshot
  • packageName: Desired name for the package

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

      Body:
      {
          "definitionGroupId":"VendorGroupsFileExport",
          "packageName":"VendorGroupPackage",
          "executionId":"VendorGroupExecutionId-1",
          "reExecute":false,
          "legalEntityId":"USMF"   
      }
    

ExportToPackage Request in Postman

Successful Response of ExportToPackage request

Upon successful execution, you will receive a response indicating that the export has been initiated.

Successful ExportToPackage Response

Step 3: Check Export Status with GetExecutionSummaryStatus

Next, check the status of your export by sending a GetExecutionSummaryStatus request.

POST Request:

{{resource}}/data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExecutionSummaryStatus

Body:
{
    "executionId": "VendorGroupExecutionId-1"
}
    

GetExecutionSummaryStatus Request in Postman

Successful Response of GetExecutionSummaryStatus request

You will receive a response indicating the current status of your export.

Successful Check Export Status Response

Step 4: Retrieve the Exported Package URL

Finally, retrieve the URL of the exported package with a GetExportedPackageUrl request.

POST Request:

{{resource}}/data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExportedPackageUrl

Body:
{
    "executionId": "VendorGroupExecutionId-1"
}
    

GetExportedPackageUrl Request in Postman

Successful Response of GetExportedPackageUrl request

You will receive a response with a URL to download the exported package.

Successful GetExportedPackageUrl Response

Download the Package

Copy and paste the URL from the response into your browser to download the package.

Downloaded Package

By following these steps, you can successfully export data packages in Microsoft Dynamics 365. If you have any questions, feel free to reach out in the comments below.

Happy exporting!

2 comments:

  1. Do you know a way to dynamically create-or-change the export package via api? The scenario I'm thinking is "how can I use the API to export data entities, but also how to use the api to control *which* data entities to export". (ie not have to do step 1 in the UI).

    ReplyDelete
  2. Through this Data package api, you can't export untill you have export project is created. For you, Does it fixed you want to export package ? I mean to say instead of this why can you use Odata API ?

    ReplyDelete

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++...