iotoms Docs

Update features assigned to a role

PUT
/api/v1/management/roles/{id}/features

Sets the complete list of features (permissions) a role can access and returns the result. Codes must be allowed for the role on the merchant's plan. You can only grant features your own role holds, and cannot edit a role that has access beyond yours.

How to use it

  1. Call Get features assigned to a role to see allowedFeatures and the current assignedFeatureCodes.
  2. Send the full set of featureCodes the role should have; codes left out are removed.
  3. The call is refused if a code is not allowed on the plan, if you lack a code you are granting, or if the role has access beyond yours.
  4. Users with this role get the new permission set.

Authorization

BearerAuth
headerAuthorizationBearer <JWT>

Path Parameters

id*integer

ID of the record.

Formatint64

Request Body

application/json
  1. body
featureCodes*array<string>

The complete set of feature codes the role should have; codes left out are removed. Each must be in the role's allowedFeatures.

updatedBy?|

Name or username to record as having granted the new features.

Response Body

OK

*/*
  1. response
roleId*integer

Role ID.

Formatint64
roleKey*string

The role's key, e.g. CASHIER.

roleName?|

The role's display name.

allowedFeatures*array<>

Features this role may be given on the merchant's current plan.

assignedFeatureCodes*array<string>

Codes of the features the role currently has.

Example Request
curl -X PUT 'https://beta.iotoms.com/api/v1/management/roles/0/features' \  -H 'Content-Type: application/json' \  -d '{  "featureCodes": [    "string"  ]}'
Example Response
{  "roleId": 0,  "roleKey": "string",  "roleName": "string",  "allowedFeatures": [    {      "code": "string",      "name": "string",      "description": "string",      "category": "string"    }  ],  "assignedFeatureCodes": [    "string"  ]}