AddRoleMember task is not found in VMS RESTful API

Hello,

I got a not found error when I started the AddRoleMember task in the VMS RESTful API.

$ipAddress = "(ip address)"
$response = Invoke-RestMethod "http://${ipAddress}/api/rest/v1/roles/{role id}?task=AddRoleMember" -Method 'POST' -Headers $headers -Body $body

I received this response.

Invoke-RestMethod : {  "error" : {  "httpCode" : 400,  "details" :  [ {  "errorText" : "Task not found" } ] } }

The result of getting the Role task is as follows. How should I use the AddRoleMember task?

Code
$response = Invoke-RestMethod "http://${ipAddress}/api/rest/v1/roles/68892720-4e81-4b8d-92dd-c4be43660a72?tasks" -Method 'GET' -Headers $headers
 
Response
{
  "data":  {
    ...
    "tasks":  [
                  {
                      "id":  "SetClientTimeProfile",
                      "displayName":  "Set client login time profile"
                  },
                  {
                      "id":  "GetClientTimeProfile",
                      "displayName":  "Get client login time profile"
                  },
                  {
                      "id":  "SetClientProfile",
                      "displayName":  "Set client profile on role"
                  },
                  {
                      "id":  "ChangeOverallSecurityPermissions",
                      "displayName":  "Edit overall security permissions"
                  }

There is an AddRoleMember task in the API spec, why can’t I use it?

https://doc.developer.milestonesys.com/mipvmsapi/#operation/postTaskForroles

Thank you,

Naozumi Mitsukawa

That is because the users are located on the “users” sub-resource, please try this -

api/rest/v1/roles/{role_id}/users?task=AddRoleMember

I checked the documentation link and the page doesn’t seem to be correct so I will make a request for correction.

Thanks to your advice, the AddRoleMember task worked. I also think the documentation is incorrect.