Import and export APIs
Developers can import and export APIs between finance and operations apps and on-premises deployments. Keep in mind that there are some key differences with these processes for on-premises and cloud deployments:
- For on-premises deployments, support has been added for the Data management package REST API even though API names have not been changed. This way, Microsoft can keep a single API set for both cloud deployments and on-premises deployments.
- The Data management framework API package uses OAuth 2.0 to authorize access.
- For on-premises deployments, authorization is managed with Active Directory Federation Services (AD FS).
- Recurring integration APIs are not supported for on-premises deployments.
Importing APIs
To start the data package import process, the ImportFromPackage API is used to initiate an import from a data package. The data package is uploaded to the Blob storage that is associated with the finance and operations apps implementation.
For on-premises deployments, the import will be initiated from the local storage file that was uploaded previously.
The following is an example of code that is used to initiate the import process.
POST /data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.**ImportFromPackage**
BODY
{
"packageUrl":"<string>",
"definitionGroupId":"<string>",
"executionId":"<string>",
"execute":<bool>,
"overwrite":<bool>,
"legalEntityId":"<string>"
}
The following list describes the various code elements:
ImportFromPackage
is initiating the import.packageurl
is a unique file name that is used to track Blob IDs. You can include a globally unique identifier (GUID) to help guarantee a unique file name.definitionGroupID
is a string that represents the name of the data project for the import.executionId
is the ID to use for the job. If an empty ID is assigned, a new execution ID will be created automatically.execute
is a Boolean. If the parameter is set to True, the target step will run.overwrite
is also a Boolean that must be set to False when a composite entity is used in a package, if not, then this should be set to True.legalentityId
is the legal entity for the import.
If the import is successfully finished, you will receive a JSON success response.
Exporting APIs
The export for APIs is similar to the import. The difference is that the ExportToPackage API is used to initiate the export. This is applicable for both cloud and on-premises deployments.
The following is an example of code that is used to initiate the export process.
POST
/data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.**ExportToPackage**
BODY
{
"definitionGroupId":"<Data project Id>",
"packageName":"<Name to use for downloaded file.>",
"executionId":"<Execution Id if it is a rerun>",
"reExecute":<bool>,
"legalEntityId":"<Legal entity Id>"
}
If the export is finished successfully, you will receive a JSON success response.