How to update a Robot through API?

How to update a Robot through API?

Issue Description:

Usually, users are using the Swagger API endpoints documentation in order to edit robot, for example:

PUT for /odata/Robots({key})

Because of that, in some cases, they are receiving the below error message:

{

"message": "; robotDto must not be null",

"errorCode": 0,

"resourceIds": null

}

Resolution:

In order to update the robot/user, follow below instructions:

Note:

Let's assume Robot Id is 109.

The easiest way to find X-UIPATH-OrganizationUnitId open the Orchestrator web page in browser -> go to Tenant -> right click on the page -> Inspect -> Network -> Click on Users -> scroll down in the page and check the value for x-uipath-organizationunitid (in bellow example is 1)

1.jpg

1. Perform in Postman tool a GET request for this URL: https://ORCHESTRATOR_URL_ADDRESS/odata/Robots(109)?$select=UserId

Authorization:

Bearer Token

Headers:

X-UIPATH-OrganizationUnitId: 1

Content-Type: application/json

2. Copy the UserId value

3. Perform in Postman tool a PUT request for this URL: https://ORCHESTRATOR_URL_ADDRESS/odata/Users(UserId_value_from_step_2)

Authorization:

Bearer Token

Headers:

X-UIPATH-OrganizationUnitId: 1

Body:

raw as JSON

Example of body request:

{

"Id": 4,

"Name": "M*****",

"Surname": "P******",

"UserName": "m*****.p*****",

"DirectoryIdentifier": null,

"Domain": null,

"FullName": "",

"EmailAddress": "m****.p******@mail.com",

"IsEmailConfirmed": false,

"IsActive": true,

"AuthenticationSource": null,

"Password": null,

"LastLoginTime": "2021-12-02T09:56:12Z",

"CreationTime": "2021-11-01T15:08:18Z",

"RolesList": ["Robot"],

"OrganizationUnits": [],

"TenancyName": "Default",

"TenantDisplayName": "Default",

"TenantId": 1,

"Type": "User",

"NotificationSubscription": {

"QueueItems": true,

"Robots": true,

"Jobs": true,

"Tasks": true,

"Schedules": true,

"Queues": true,

"Insights": true,

"CloudRobots": true

},

"MayHaveRobotSession": false,

"MayHaveUnattendedSession": true,

"MayHaveUserSession": true,

"MayHavePersonalWorkspace": false,

"BypassBasicAuthRestriction": false,

"UnattendedRobot": {

"UserName": "UIPATH\\m***.p******",

"CredentialStoreId": 1,

"CredentialType": "Default",

"LimitConcurrentExecution": false,

"ExecutionSettings": {

"TracingLevel": "Information",

"StudioNotifyServer": true,

"LoginToConsole": true

}

},

"IsExternalLicensed": false,

"RestrictToPersonalWorkspace": false

}

Example in Postman:

2.png

Note:

You can perform in Postman tool a GET request for this URL: https://ORCHESTRATOR_URL_ADDRESS/odata/Users(UserId_value_from_step_2) and you will get already the populated information for your robot/user. After it will be easier for you to update only the needed details.