Appearance
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
| Field | Type | Required | Description |
|---|---|---|---|
userId | string | yes | User email or user number |
assignRole | object | one of these | Role to give the user |
unassignRole | object | one of these | Role to take away |
assignRole.roleName | string | yes | Application:RoleName, for example Honeycomb:Technician |
assignRole.serviceProviderNumber | string | one scope | Service provider the role applies to |
assignRole.serviceProviderLocationNumber | string | one scope | Location 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
| Status | Code | When |
|---|---|---|
| 400 | VALIDATION_ERROR | Both operations are sent, neither is sent, or the role has no service provider and no location |
| 500 | INTERNAL_ERROR | Something unexpected failed |