Need help in triggering a job in orchestrator using the orchestrator api's

Can anyone help me how to trigger a job in orchestrator using orchestrator api’s. I Need an example with all required details which we need to give in the POST request.

1 Like

Steps to do with the new API

  1. Login to platform uipath

  2. Click on the services tab and near the username, you will have three dots, click on that

  3. Click on API access and copy all the details you have there like client id, key and user id whatever

  4. Then send a post request to authenticate to the URL : https://account.uipath.com/oauth/token with the headers X-UIPATH-TenantName which you got in the above step and the body
    {
    “grant_type”: “refresh_token”,
    “client_id”: “CLIENT ID you got from above step”,
    “refresh_token”: “fH5FcbEJLEm6BzuupvIBAb9V2eJkDDcQE1emAhSk-Cuoh”
    }

  5. You will get the access token, copy that

  6. To get the folders, you need to send a GET request to the URL : https://platform.uipath.com/odata/Folders with the authorization code and X_UIPATH_TENANT_NAME as the headers.

  7. Copy the response where you will get the folder ID

  8. Then send the request to get the ROBOT ID’s you have which is a GET request to the URL : https://platform.uipath.com//odata/Robots with the headers X-UIPATH-OrganizationUnitId which is nothing but the folder ID, X-UIPATH-TenantName and the authorization token

  9. You will get the ID’s of all the robots you have and copy that

  10. Then you need to get the Process ID’s which is nothing but the releases by sending a GET request to the URL : https://platform.uipath.com/odata/Releases with the headers X-UIPATH-TenantName, X-UIPATH-OrganizationUnitId, Authorization where you will get the process which you have in the orchestrator.

  11. Finally, you have all the required fields to trigger a job. Male sure you have copied the release ID of the specific process you want to trigger.

  12. Send a POST request to the URL : https://platform.uipath.com/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs with the headers X-UIPATH-TenantName, X-UIPATH-OrganizationUnitId, Authorization and the body

{ “startInfo”:
{ “ReleaseKey”: “Release key of the process which you got and which process you want to triggere”,
“Strategy”: “Specific”,
“RobotIds”: ROBOT ID You got from above,
“JobsCount”: 0,
“Source”: “Manual”
}
}

Please try and let me know if you have any issues

4 Likes

Hi Hareesh,

In 4th step i’m getting below error msgs.

“error”: “access_denied”,
“error_description”: “Unauthorized”

below are the details which i had given in the body of the POST request and refresh token i had used which you had provided. is that something which i need to change?

{
“grant_type”: “refresh_token”,
“client_id”: “8DEv1AMNXczW3y4U15LL3jYf62jK93n5”,
“refresh_token”: “fH5FcbEJLEm6BzuupvIBAb9V2eJkDDcQE1emAhSk-Cuoh”
}

and i had given Tenant name in the headers also.

1 Like

Hi Hareesh,

I’m able to succeed in 4th step but now i’m getting issue at 5th step

Hi Hareesh,

I’m able to succeed in 4th step but now i’m getting issue at 6th step.
I had given the tenant name and Authorization code as the code which is the output of 4th step.

also can i shcedule a call instead of replying here. i can send you webex meeting link to your mail to check on this. if yes can you pls give ur email id.

1 Like

Can you post what is the error you are getting and the request you are sending?

Hi Hareesh,

Now i’m able to trigger the api from the Orchestrator swagger, but when I run it from the Postman i’m getting below error.

so can you please help me on this.
“{
“message”: “You are not authenticated!”,
“errorCode”: 0,
“result”: null,
“targetUrl”: null,
“success”: false,
“error”: {
“code”: 0,
“message”: “You are not authenticated!”,
“details”: “You should be authenticated (sign in) in order to perform this operation.”,
“validationErrors”: null
},
“unAuthorizedRequest”: false,
“__abp”: true
}”

1 Like

Have you passed the Authorization token which is generated recently? usually the token will be expired in 1 hour I guess.

1 Like

Authorization token you mean the User Key or the Release Key…

i had tried using both the keys but did not work.

When you send the request (step 4) in the above procedure, you will get the access token, which is nothing but the authorization token.

try including as a header (change default to relevant folder name if not Default)

X-UIPATH-FolderPath Default

1 Like

@HareeshMR authentication successful :slight_smile: i will let you know once i complete the whole process :slight_smile:
Thank you again

Regards,
Hemal

1 Like

@HareeshMR I am getting error at 6. not authorized for folder :frowning:

Actually from orchestrator, where I have copied User Key is getting refreshed whenever I open it every minute.

Please do the needful

Yes me too facing the same problem at Step 6(Error: You are not authenticated!). User key is changing every time. Does anyone got solution.

@ManiPrajwal are you working it via postman ? or ?

Hi Hemal,

Thanks for the reply, I have tried in both Studio and Postman. Same issue I am facing on both.

@ManiPrajwal

User key won’t change but the key will expire. May be the key expired when you send the request, try with new access key and let me know if that works

I have tried that also… but no luck in it…
Same error : You are not authenticated(@ Step 6)

But the authentication is successful and iam getting the required Token

Can you post some clear screenshot with the headers how you are sending the request just to check out please