web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How to call package api using postman?

(0) ShareShare
ReportReport
Posted on by 465

So i created an export project with these two entities, it seems there is no standard composite entity for headers and lines but i'll leave it as is for now for testing purposes

pastedimage1590672477692v1.png

i choose the source data format to be xml- attribute. I tried to download the package manually and it worked successfully.

Now what do i need to do in postman to be able to get this file? what is the url i should use and what should i fill inside the header or body. Also there should be an authentication right?and is there sth i need to do in x++ before using postman or creating the export project is enough?

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    Microsoft has documented how you can test the APIs by using third party tools such as Postman. Please check the doc page: docs.microsoft.com/.../third-party-service-test

    It doesn't provide direct instructions in your scenario but it helps you understand how it works on a general level. Then you can apply this understanding in your scenario.

  • Suggested answer
    Martin Dráb Profile Picture
    237,990 Most Valuable Professional on at

    There is a standard composite entity for sales orders headers and lines: SalesOrderV3Entity.

    You can find it either by looking at composite entities with names starting with "Sales", or by using "Find references" on the entities you did find.

    URLs, examples, information about authorization and so on are documented at Data management package REST API. I think you quoted this page in your previous thread, therefore you should be already aware of it. Maybe you didn't read it carefully enough.

  • D365FO user Profile Picture
    465 on at

    i want a composite for sales Invoice not sales order.

    I tried using postman but i got this error: No data empty input at 1:1

    pastedimage1590679971203v1.pngpastedimage1590680023068v2.png     

    i tried using c# and i was able to get the access token but i used AcquireTokenAsync( where i pass client id and client secret) instead of AcquireToken
    pastedimage1590680255402v3.png

    but what should i do next, how can i call the data package api and get the generated file? 

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi D365FO user,

    Related to postman, on your first screenshot URL is incorrect (duplicated or something like that).

    For C#, are you using demo project provided by MS github.com/.../Dynamics-AX-Integration

    If yes, you can easily do it ODataConsoleApplication by using methods below:

    context.DataManagementDefinitionGroups.ExportToPackage

    context.DataManagementDefinitionGroups.GetExportedPackageUrl

  • D365FO user Profile Picture
    465 on at

    oppss i didn't notice the two https

    but the url says :login.microsoftonline.com/.../tenantId/oauth2/token

    and isn't the tenantId like this: https://login.windows.net/CompanyName.com

    so what should i replace the tenantId in the first Url with?

    no i just put these 4 lines i showed you. I didn't know i can call it using Odata.

    i just added OdataUtility,AuthUtility and OdataConsole but i got thousands of errors. I think this is because of the warning i'm getting here. My project is framework 4.5.2 but for example Microsoft.Odata.client is 6.15 and i can't find anything less than 6... can u help?
    pastedimage1590683938161v1.png

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi D365FO user,

    If you press right-click on the solution there will be an option "Restore NuGet packages" try to do it.

    TenantId is guid value and you can find it in Azure portal techcommunity.microsoft.com/.../89018

  • D365FO user Profile Picture
    465 on at

    ohh so the tenant Id is the directory Id... restore didn't work but i removed them then added them again an it worked.

    As for the two methods:

    context.DataManagementDefinitionGroups.ExportToPackage("DefentionGroupId", "PackageName", "ExecutionId", reExecute, "LegalEntityId");
    context.DataManagementDefinitionGroups.GetExportedPackageUrl("ExecutionId");

    I filled the variables with the following from the data project form:

    DefentionGroupId = Group ID  ( in the form it's sth like {AAA-AAA....} i filled it without the brackets, i mean "AAA-AA..."

    PackagName= GroupName (which is the name of the export project)

    ExecutionId = "", I don't know what to fill it from?

    reExecute = false (what does this do)?

    LegalEntity ="USMF"

    but what i'm getting after running each of the context methods is a list of the company names, why is that? shouldn't i get the sales invoices in xml?

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi D365FO user,

    >> but what i'm getting after running each of the context methods is a list of the company names

    Looks like you are still running demo method ReadLegalEntities in main

    1. Run ExportToPackage - it will return you ExecutionId

    DefentionGroupId = The name of the data project for export. And you put endpoint id? (recurring endpoint?)

    PackagName= Any custom name (like my_export_from_3rd_party_timestamp)

    ExecutionId = Leave it empty

    reExecute = I guess it's needed when execution is already exist and you want to re-generate data (but i could be wrong). Leave it as False

    LegalEntity ="USMF"

    2. Check message status, as export can take a lot of time via GetExecutionSummaryStatus (use executionId fetched from ExportToPackage as the parameter)

    docs.microsoft.com/.../data-management-api

    3. Run GetExportedPackageUrl when GetExecutionSummaryStatus will return you Succeeded and use executionId fetched from ExportToPackage as the parameter.

    GetExportedPackageUrl will return to you URL to the package file and you need to download it.

  • D365FO user Profile Picture
    465 on at

    Hi sergei,

    I'm stuck at the first step, i'm not getting any Execution Id

    context.DataManagementDefinitionGroups.ExportToPackage("ExportProject", "my_export_from_3rd_party_timestamp", "", false, "USMF");

    Console.ReadLine();

    I'm not getting anything after i run this.... u mentioned and u put endpointId? what do u mean?

  • Suggested answer
    Deekshit Addepalli Profile Picture
    on at

    Hi,

    Assuming that your DMF Data project is setup, this is some code I have that works:

    If it already has an execution ID, then it will use the execution id and download the package.

    If the execution id id blank, it will start a new execution of the project

    It also looks like your method signature for the ExportToPackage method is wrong.

    This is what it is:

    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>"

    }

    So, what I have in my code is like this:

     Console.WriteLine("Starting data project: "+dmfDataProjectName);

               string runExecutionId = string.Empty;

               bool reExecuteDataProject = false;

               var dmfExecutionId = d365Res.DataManagementDefinitionGroups.ExportToPackage(dmfDataProjectName, Guid.NewGuid().ToString(), runExecutionId, reExecuteDataProject, dataAreaId).GetValue();

    I pass the Data Project Name as a parameter to the function.

    The package name is a new Guid that gets saved on Azure Blob storage

    I leave the executionId blank (string.Empty)

    reExecute is false

    legalEntity can be USMF in a demo data environment.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 669 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 449 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 384 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans