This post is about testing the D365FO Data Management 'Enqueue' and 'Dequeue' recurring data jobs.
Well, what are these? They are simply REST API's from Data management framework to support recurring integrations for importing(Enqueue) and exporting(Dequeue) data in D365FO.
Which also means, we can test these services through code or through any of the testing tools that work with REST API's.
There is already an sample project in GitHub which can be configured for this.
However, if you need to quickly test the service, with a simple tool like Postman or SOAPUI, below process can be followed.
Since D365FO, uses OAuth 2.0 as authentication, the first step would be to create an access token.
This step would generate the token which is required for all the communication to D365FO.
It has to be passed for each request, through the header as ‘Authorization’ = Bearer {Token generated}.
Please create ‘POST’ request for the url : https://login.microsoftonline.com/[tenant-Id]/oauth2/token
The body of the request must contain the below values:
grant_type:client_credentials
client_Id:'Id of your App' [Registering your application in Azure active directory is the first thing that has to be done to enable integrations]
client_secret:'secret key of your App'
resource:[D65FO base URL]
Upon a successful request, you should be seeing status=’200 OK’ and the access token generated in the response body section.
The response, will be the token generated in the body section:
Once the token is generated, it can be used for each of the requests.
Below example is for Customer Groups:
Dequeue API:
To test the dequeue service[Receiving data from D365], create a ‘GET’ request for the below url:
Format: https://[D65FO base URL]/api/connector/dequeue/%7B<Activity ID>%7D
The activity ID can be obtained once the export job is enabled for recurring data Job in data management.
Upon success, you should get status=’200 OK’ and the download location of the file as a response.
To download the file, you would have to create another ‘GET’ request for the ‘download location url’ that is received as response.
The content of the file will be shown in the body section once the request is successful.
Enqueue API:
To test the enqueue service [Sending data to D365FO], create ‘POST’ request for the below url:
Format: https://<base URL>/api/connector/enqueue/%7B<activity ID>%7D?entity=<entity name>
Ex:https://[D65FO base URL]/api/connector/enqueue/%7B[Activity ID]7D?entity=Customer%20Groups&company='company name'
You can send data in multiple ways:
Directly paste the contents of the file into the 'Raw' section of Body:
The format matching the one defined in source format in D365FO.
You can provide any kind of data mathcing the types supported in the 'Text' types as shown below:
Or you can also attach the file directly, in the 'form-data' section of the body.
Click 'Choose files' button and attach the file.
You can also use the 'Binary' section.
This section allows you to send things which you can not enter in Postman, for example, image, audio, or video files. You can send text files as well,in the 'Binary' section of Body.
Click 'Choose files' button to attach the file having data to be imported to D365FO.
Upon success, you should get status=’200 OK’ and the number of ‘Job ID’ created in D365 as response.
Once you have this JobID, You can also check the status of this job, through below url format:
https://[D65FO base URL]/api/connector/jobstatus/%7B<ActivityID>%7D?JobId={Job Id generated}
It will return the status of that job in D365FO, whether it is in Queue,Processing,Processed etc.
As mentioned in the beginning, the access token has to passed to all the requests mentioned in the above steps.
Well, what are these? They are simply REST API's from Data management framework to support recurring integrations for importing(Enqueue) and exporting(Dequeue) data in D365FO.
Which also means, we can test these services through code or through any of the testing tools that work with REST API's.
There is already an sample project in GitHub which can be configured for this.
However, if you need to quickly test the service, with a simple tool like Postman or SOAPUI, below process can be followed.
Since D365FO, uses OAuth 2.0 as authentication, the first step would be to create an access token.
This step would generate the token which is required for all the communication to D365FO.
It has to be passed for each request, through the header as ‘Authorization’ = Bearer {Token generated}.
Please create ‘POST’ request for the url : https://login.microsoftonline.com/[tenant-Id]/oauth2/token
The body of the request must contain the below values:
grant_type:client_credentials
client_Id:'Id of your App' [Registering your application in Azure active directory is the first thing that has to be done to enable integrations]
client_secret:'secret key of your App'
resource:[D65FO base URL]
Upon a successful request, you should be seeing status=’200 OK’ and the access token generated in the response body section.
The response, will be the token generated in the body section:
Below example is for Customer Groups:
Dequeue API:
To test the dequeue service[Receiving data from D365], create a ‘GET’ request for the below url:
Format: https://[D65FO base URL]/api/connector/dequeue/%7B<Activity ID>%7D
The activity ID can be obtained once the export job is enabled for recurring data Job in data management.
Upon success, you should get status=’200 OK’ and the download location of the file as a response.
To download the file, you would have to create another ‘GET’ request for the ‘download location url’ that is received as response.
The content of the file will be shown in the body section once the request is successful.
Enqueue API:
To test the enqueue service [Sending data to D365FO], create ‘POST’ request for the below url:
Format: https://<base URL>/api/connector/enqueue/%7B<activity ID>%7D?entity=<entity name>
Ex:https://[D65FO base URL]/api/connector/enqueue/%7B[Activity ID]7D?entity=Customer%20Groups&company='company name'
You can send data in multiple ways:
Directly paste the contents of the file into the 'Raw' section of Body:
The format matching the one defined in source format in D365FO.
You can provide any kind of data mathcing the types supported in the 'Text' types as shown below:
Or you can also attach the file directly, in the 'form-data' section of the body.
Click 'Choose files' button and attach the file.
You can also use the 'Binary' section.
This section allows you to send things which you can not enter in Postman, for example, image, audio, or video files. You can send text files as well,in the 'Binary' section of Body.
Click 'Choose files' button to attach the file having data to be imported to D365FO.
Upon success, you should get status=’200 OK’ and the number of ‘Job ID’ created in D365 as response.
Once you have this JobID, You can also check the status of this job, through below url format:
https://[D65FO base URL]/api/connector/jobstatus/%7B<ActivityID>%7D?JobId={Job Id generated}
It will return the status of that job in D365FO, whether it is in Queue,Processing,Processed etc.
As mentioned in the beginning, the access token has to passed to all the requests mentioned in the above steps.
You have 2 headers in the GET request for dequeue. What are those headers? Because I am getting 401 Unauthorized
ReplyDeleteOnly one should be enough, to pass Authorization value from the access token.
DeleteThis comment has been removed by the author.
ReplyDeleteHi, i have a success status 204 but no content. Do you have any idea ?
ReplyDeleteHi. Is it for Dequeue job? If yes, then there might not be any file available in queue to dequeue? Can you please share more details?
Deleteyes, when there is no data we get 204 status code
DeleteNice post...
ReplyDeleteWe are providing the best master data services around the world....visit our website for more information....
Service Master Data Management
Master Data Management
Inventory Analysis
SAP Master Data Governance
data management services
master data management in sap
data cleansing tools
Master Data Governance
Data Cleansing Services
Thank you for helping people get the information they need. Great stuff as usual. Keep up the great work!!!
ReplyDeleteBest D365 Testing blog.
Welcome to Jammy Monkey Casino - Slot Machines, Games - JTM Hub
ReplyDeleteEnjoy over 부산광역 출장마사지 100 casino games at Jammy Monkey, including a wide range of video slots, video bingo 고양 출장안마 and more at 여주 출장마사지 JTM Hub. Enjoy the 정읍 출장마사지 action you 세종특별자치 출장샵 love!
I try to test with postman enqueued. There is error error labelId: -Exception from HRESULT: 0xC020801C
ReplyDelete'0' 'Vendor groups' record(s) inserted in staging
Do you have any suggestion?
DeleteValuable Information Thanks For Sharing Managed-Services
ReplyDeleteI just stumbled upon your blog, and I must say, I'm quite impressed with the quality of your content. Your writing style is engaging, and the information you provide is both informative and well-researched.
ReplyDeletePayroll Software In Uae
Thanks sharing the blog on Best Data Operations Agency
ReplyDelete