How to test Orchestrator API calls in Linux systems?
How to Get access token using Confidential Application code flow with client credentials:
curl -X POST -k "https://{orch_url}/identity/connect/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d 'grant_type=client_credentials&client_id={client_id}&client_secret={client_secret}&scope=OR.Queues'
Replace {orch_url},{client_id} and {client_secret}. After hitting the above request the output will be an access token which needs to be passed in the next command.
Example request to Add queue item using API in Linux box:
- Create a queue_item.json file in the Linux box with the below data in it and replace your queue name in below.
{
"itemData": {
"Name": "Test",
"Priority": "High",
"SpecificContent": {},
"DeferDate": "2024-07-10T02:37:48.437Z",
"DueDate": "2024-07-10T02:37:48.437Z",
"RiskSlaDate": "2024-07-10T02:37:48.437Z",
"Reference": "string",
"Progress": "string"
}
}
- Once the above file is created, design the below command to hit Post request to add a queue item from Linux server.
curl -X POST -k 'https://{orch_url}/odata/Queues/UiPathODataSvc.AddQueueItem?organizationUnitId={orgunit id}' --header 'Authorization: Bearer {access_token}' --header 'Content-Type: application/json' --data @queue_item.json
- Replace {orch_url},{orgunit_id}. {access_token} from token API and try to run from the location where queue_item.json is saved.