Translate

Sunday, July 1, 2018

Dynamics 365 Operations | REST APIs | Package API

First thing first, learn basics of Service endpoints available in Dynamics 365 for Operations using below URL:

Import file to Dynamics 365 Operations

1.      Get access token

POST https://login.windows.net/[domain]/oauth2/token?api-version=1.0\

Request header:

Content-Type: application/x-www-form-urlencoded

Host: login.windows.net

Content-Length: 184

Expect: 100-continue

Connection: Keep-Alive

 

Request body:

(url encode for client secret key http://www.albionresearch.com/misc/urlencode.php)

grant_type=client_credentials&resource=[dynamics URI]&client_id=[Client ID registered in Azure]&client_secret=[Secret key generated from Azure]


2. Get Azure Write URL

POST [Dynamics URI]/data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetAzureWriteUrl HTTP/1.1

OData-Version: 4.0

OData-MaxVersion: 4.0

Content-Type: application/json;odata.metadata=minimal

Accept: application/json;odata.metadata=minimal

Accpet-Charset: UTF-8

Authorization: Bearer [access token]

Host: [Dynamics URI without https]

 

{

    "uniqueFileName":"[New GUID]"

}

3. Upload data package to Blob

PUT [URI returned from GetAzureWriteURL]

 
x-ms-date: Wed, 13 Jun 2018 11:08:00 AST

x-ms-version: 2015-02-21

x-ms-blob-type:BlockBlob

Overwrite: T


@INCLUDE *[folderPath]\[fileName].zip*@

4. Import from package

POST

[Dynamics URL with https]/data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.ImportFromPackage HTTP/1.1

OData-Version: 4.0

OData-MaxVersion: 4.0

Content-Type: application/json;odata.metadata=minimal

Accept: application/json;odata.metadata=minimal

Accpet-Charset: UTF-8

Authorization: Bearer [access token]

Host: [Dynamics URI without https]


{

    "packageUrl":"[Blob URL returned from GetAzureWriteURL]",

    "definitionGroupId":"XE",

    "executionId":"",

    "execute":true,

    "overwrite":true,

    "legalEntityId":"USMF"

}

5. Get execution summary status

POST

[Dynamics URL with https]/data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExecutionSummaryStatus HTTP/1.1

OData-Version: 4.0

OData-MaxVersion: 4.0

Content-Type: application/json;odata.metadata=minimal

Accept: application/json;odata.metadata=minimal

Accpet-Charset: UTF-8

Authorization: Bearer [access token]

Host: [Dynamics URL without https]

 

{

    "executionId":"[execution id returned from Import from Package HTTP call]"

}

Export file from Dynamics 365 Operations

1. Export to package

POST [Dynamics URL with https]/data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.ExportToPackage HTTP/1.1
OData-Version: 4.0
OData-MaxVersion: 4.0
Content-Type: application/json;odata.metadata=minimal
Accept: application/json;odata.metadata=minimal
Accpet-Charset: UTF-8
Authorization: Bearer [access token]
Host: [Dynamics URL without https]

{
  "definitionGroupId":"GJ Export",
  "packageName":"General journal",
  "executionId":"",
  "reExecute":false,
  "legalEntityId":"USMF"
}

2. Get exported package URL

POST [Dynamics URL with https]
/data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExportedPackageUrl HTTP/1.1
OData-Version: 4.0
OData-MaxVersion: 4.0
Content-Type: application/json;odata.metadata=minimal
Accept: application/json;odata.metadata=minimal
Accpet-Charset: UTF-8
Authorization: Bearer [access token]
Host: [Dynamics URL without https]


{
     "executionId":"ExportPackage-6/14/2018 08:04:43 am[returned from export to package]"
}

4 comments:

  1. May I Knw how to use this API 's in Development? Please Explain It.

    ReplyDelete
  2. In this manner my buddy Wesley Virgin's autobiography starts with this SHOCKING AND CONTROVERSIAL video.

    Wesley was in the military-and soon after leaving-he found hidden, "self mind control" tactics that the government and others used to obtain everything they want.

    These are the EXACT same SECRETS tons of celebrities (notably those who "come out of nowhere") and elite business people used to become wealthy and successful.

    You probably know how you use only 10% of your brain.

    That's mostly because most of your brainpower is UNTAPPED.

    Perhaps that expression has even taken place INSIDE OF YOUR own mind... as it did in my good friend Wesley Virgin's mind 7 years ago, while riding an unlicensed, trash bucket of a car with a suspended driver's license and with $3 in his pocket.

    "I'm very fed up with going through life check to check! Why can't I turn myself successful?"

    You've taken part in those types of thoughts, right?

    Your own success story is going to start. All you have to do is in YOURSELF.

    CLICK HERE TO LEARN WESLEY'S METHOD

    ReplyDelete
  3. Great post - thanks for sharing

    ReplyDelete
  4. Dynamics 365 Project Operations is a new Microsoft Dynamics 365 application released in October of 2020. It is an evolution of the existing project management and accounting modules inside Dynamics 365 Finance as well as the previous Project Service Automation (PSA) solution from Microsoft.

    ReplyDelete