Roles
Update a role
Change one role. Only the fields you send are touched.
PATCH
/
role
/
{id}
Update a role
curl --request PATCH \
--url https://{instance}/api/v2/role/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"permissions": [
"<string>"
],
"permissionsV2": [
{
"subject": "<string>",
"actions": [],
"tableName": "<string>",
"filters": {},
"fields": {}
}
],
"isApiKey": false
}
'const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
permissions: ['<string>'],
permissionsV2: [
{
subject: '<string>',
actions: [],
tableName: '<string>',
filters: {},
fields: {}
}
],
isApiKey: false
})
};
fetch('https://{instance}/api/v2/role/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{instance}/api/v2/role/{id}"
payload = {
"name": "<string>",
"description": "<string>",
"permissions": ["<string>"],
"permissionsV2": [
{
"subject": "<string>",
"actions": [],
"tableName": "<string>",
"filters": {},
"fields": {}
}
],
"isApiKey": False
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"value": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"permissions": [
"<string>"
],
"permissionsV2": [
{
"subject": "<string>",
"actions": [
"read"
],
"tableName": "<string>",
"filters": {},
"fields": {}
}
],
"isApiKey": false,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}Authorizations
Organization-scoped API key. Create one in the BuildingSwell app under Organization settings, API keys.
Path Parameters
Record id.
Body
application/json
Every field is optional. Only the fields you send are changed.
Role name. At least one character.
Minimum string length:
1What the role is for.
Legacy flat permission strings. Defaults to empty.
Legacy permission string.
Fine-grained permission statements. This is the form the app writes today.
Show child attributes
Show child attributes
true for the synthetic role behind an API key. Leave it alone on roles you create.
Response
The updated role.
A named set of permissions you can assign to users.
Show child attributes
Show child attributes
⌘I
Update a role
curl --request PATCH \
--url https://{instance}/api/v2/role/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"permissions": [
"<string>"
],
"permissionsV2": [
{
"subject": "<string>",
"actions": [],
"tableName": "<string>",
"filters": {},
"fields": {}
}
],
"isApiKey": false
}
'const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
permissions: ['<string>'],
permissionsV2: [
{
subject: '<string>',
actions: [],
tableName: '<string>',
filters: {},
fields: {}
}
],
isApiKey: false
})
};
fetch('https://{instance}/api/v2/role/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{instance}/api/v2/role/{id}"
payload = {
"name": "<string>",
"description": "<string>",
"permissions": ["<string>"],
"permissionsV2": [
{
"subject": "<string>",
"actions": [],
"tableName": "<string>",
"filters": {},
"fields": {}
}
],
"isApiKey": False
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"value": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"permissions": [
"<string>"
],
"permissionsV2": [
{
"subject": "<string>",
"actions": [
"read"
],
"tableName": "<string>",
"filters": {},
"fields": {}
}
],
"isApiKey": false,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}