Create a permission
POST/permissions
Base URL: https://api.tinkermode.com
Create a permission. If the request is made by a user, the user must have a managePermissions permission on the resource.
Authentication
Send an Authorization header of the form ModeCloud <AUTH_CODE>.
Must contain a user, service account, or project API key with "Admin" privileges. A service account token cannot manage statements whose principal is a service account.
Request body
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
actions | array<string> | Yes | Allowed/denied actions | |
effect | string | Yes | one of: allow, deny | Access policy |
id | integer | Yes | read-only (server-generated) | Unique ID assigned at time of creation. |
principalId | integer | Yes | read-only (server-generated) | Principal ID such as a user ID or service account ID |
principalType | string | Yes | read-only (server-generated); one of: user, accessControlGroup, serviceAccount | Principal type |
projectId | integer | Yes | read-only (server-generated) | Project that this permission belongs to. |
resourceIdentifier | string | Yes | Resource ID (e.g., user ID, entity ID). * represents all for supported resource types; for entity, use root instead of *. | |
resourceScope | string | No | one of: self, selfWithDescendants, descendants | Resource scope. Only Entity supports resource scope. self covers the entity itself, selfWithDescendants covers the entity and its descendants, and descendants covers its descendants but not the entity itself. descendants is not allowed on root. |
resourceType | string | Yes | read-only (server-generated); one of: all, accessControlGroup, user, home, entity, entityClass, device, alertRule, alertSchedule, projectLog, projectAlert, projectFile, dataFilter, assistant, projectBizstackApp | Resource type |
statementType | string | Yes | read-only (server-generated); one of: principalBased | Statement type |
subResources | array<object> | No | Array of sub-resource permissions |
Request example
{
"projectId": 2,
"principalType": "user",
"principalId": 1,
"resourceType": "all",
"resourceIdentifier": "*",
"statementType": "principalBased",
"effect": "allow"
}
Responses
201 Successfully created a new permission.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
actions | array<string> | Yes | Allowed/denied actions | |
effect | string | Yes | one of: allow, deny | Access policy |
id | integer | Yes | read-only (server-generated) | Unique ID assigned at time of creation. |
principalId | integer | Yes | read-only (server-generated) | Principal ID such as a user ID or service account ID |
principalType | string | Yes | read-only (server-generated); one of: user, accessControlGroup, serviceAccount | Principal type |
projectId | integer | Yes | read-only (server-generated) | Project that this permission belongs to. |
resourceIdentifier | string | Yes | Resource ID (e.g., user ID, entity ID). * represents all for supported resource types; for entity, use root instead of *. | |
resourceScope | string | No | one of: self, selfWithDescendants, descendants | Resource scope. Only Entity supports resource scope. self covers the entity itself, selfWithDescendants covers the entity and its descendants, and descendants covers its descendants but not the entity itself. descendants is not allowed on root. |
resourceType | string | Yes | read-only (server-generated); one of: all, accessControlGroup, user, home, entity, entityClass, device, alertRule, alertSchedule, projectLog, projectAlert, projectFile, dataFilter, assistant, projectBizstackApp | Resource type |
statementType | string | Yes | read-only (server-generated); one of: principalBased | Statement type |
subResources | array<object> | No | Array of sub-resource permissions |
Response example
{
"id": 15,
"projectId": 2,
"statementType": "principalBased",
"principalType": "user",
"principalId": 1,
"resourceType": "all",
"resourceIdentifier": "*",
"effect": "allow"
}
401 Authorization is required to access this resource.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
403 Request failed because of invalid data or denied permission.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
429 Request failed because of rate limit.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
500 An unexpected error has occurred.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
503 The service is temporarily unavailable.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |