Assign role
You can assign roles to already existing users with the endpoint.
HTTP request
POST https://$instanceId.id.nevis.cloud/nevis/api/v1/users/$userId/authorizations
Parameters
Parameter | In | Type | Required / Optional | Description |
---|---|---|---|---|
instanceId | path | string | required | The ID of your Identity Cloud instance. |
userId | path | string | required | The ID of the user. |
Request body
A role can only be assigned if a roleId
is provided.
Parameter | Type | Required / Optional | Description |
---|---|---|---|
roleId | string | Required | The ID of the already existing role. |
Example request
userId=948ce1fd-9fb4-4ae2-a9d2-70e229b121ed
roleId=a229a329-2e28-4005-9760-16cd280d6f0d
curl --request POST "https://$instanceId.id.nevis.cloud/nevis/api/v1/users/$userId/authorizations" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $accessKey" \
--data "{ \"roleId\" : \"$roleId\" }"
HTTP response
On success
HTTP/1.1 201
is returned if the role is successfully assigned to the user.
The response has the following additional header Location
, which contains the authorizationId
of the assigned role:
https://$instanceId.id.nevis.cloud/nevis/api/v1/users/${userId}/authorizations/${authorizationId}
The authorizationId
is a generated UUID.
On failure
HTTP/1.1 401
is returned if the authorization fails due to an invalid access key.
HTTP/1.1 404
is returned if the user is not found.
HTTP/1.1 422
is returned if invalid request content is given.
HTTP/1.1 500
is returned if an unexpected error occurs.