Skip to content

Assign or remove a role ​

Gives a user a role, or takes a role away. Send exactly one of assignRole or unassignRole.

POST /fieldservicegateway/usermanagement/v3/authorization/manage-user-role

Request ​

FieldTypeRequiredDescription
userIdstringyesUser email or user number
assignRoleobjectone of theseRole to give the user
unassignRoleobjectone of theseRole to take away
assignRole.roleNamestringyesApplication:RoleName, for example Honeycomb:Technician
assignRole.serviceProviderNumberstringone scopeService provider the role applies to
assignRole.serviceProviderLocationNumberstringone scopeLocation the role applies to

unassignRole uses the same fields as assignRole.

Example ​

json
{
  "userId": "user@example.com",
  "assignRole": {
    "roleName": "Honeycomb:Technician",
    "serviceProviderNumber": "10001"
  }
}

cURL ​

bash
curl --request POST 'https://[BASE_URL]/fieldservicegateway/usermanagement/v3/authorization/manage-user-role' \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: {{x-api-key}}' \
  --header 'Authorization: {{Authorization}}' \
  --header 'Asurion-correlationid: correlation-id' \
  --header 'Asurion-enduser: end-user' \
  --header 'Asurion-sourcesystem: source-system' \
  --header 'Asurion-serviceprovider: company-id' \
  --header 'Asurion-client: default' \
  --data '{
    "userId": "user@example.com",
    "assignRole": {
      "roleName": "Honeycomb:Technician",
      "serviceProviderNumber": "10001"
    }
  }'

Response ​

200 OK

json
{
  "success": true,
  "message": "Role assigned successfully",
  "data": {
    "userId": "user@example.com",
    "operation": "assign",
    "roleName": "Honeycomb:Technician",
    "scope": "service_providers:10001"
  }
}

operation is assign or unassign. scope names the service provider or location the role was applied to.

Errors ​

StatusCodeWhen
400VALIDATION_ERRORBoth operations are sent, neither is sent, or the role has no service provider and no location
500INTERNAL_ERRORSomething unexpected failed