You can create data projects in Dynamics for Finance and Operations using a rest API.
I like to start my flow by defining all the static parameters, like authentication. I use a variable of type object and parse the content. This way I don’t have to create separate variables.
The “ImportFromPackage” API will create the data project. Here is the Microsoft Docs link to API documentation.
{
"packageUrl":"<string>",
"definitionGroupId":"<string>",
"executionId":"<string>",
"execute":<bool>,
"overwrite":<bool>,
"legalEntityId":"<string>"
}
As the documentation states, it requires a packageUrl input. This represents the storage location of the data project package (zip file). Your integration will need to store the data project package first before we can create the data project.
I use the “GetAzureWriteURL” rest API to create a URL, to which I can upload the data package. When called successfully the API will return a link. The link contains the required authentication, so no authentication parameters are required when uploading the file to the provided URL. I pass a timecoded string value as unique file name. However, I believe this file name doesn’t have to be unique.
To get the writeable URL I use two different parse JSON actions. I am sure there is a quicker way, but this worked for me.
Now the data package URL can be uploaded using a PUT HTTP request. Use the BlobURl received from the previous step and ensure the body contains the file content of your data package zip file. Also be sure to specify the headers as shown below. Notice that I am not passing any authentication parameters, if you did the upload will fail. This is because the URL carries the authentication within.
Now the data package is stored into the blob storage linked to your Dynamics 365 for Finance and Operations environment.
All that is left to do is create the data package using the ImportFromPackage API. The execute input will determine weather or not the data project should be started if loaded successfully.
If you have configured the import to start once loaded, the output parameters will return the execution id of the data project. This is called as Job ID in the UI. You can use this to query the import status of your data job.
Comments