Update a custom role
Renames a custom role of your company and replaces its permissions with the list you send. Everybody who holds the role gets the new set. Standard roles cannot be changed.
POST/ api/ roles/ {id}/ update
Path parameters
idintegerRequired
The id of a custom role of your company, as GET /team/roles lists it. Digits only; anything else answers 404. At least 1.
Body
namestringRequired
Up to 255 characters.
permissionsarray of stringsRequired
The slugs of the permissions the role gives, each one you hold yourself. The whole set, not a change to it.
Returns
200 The role as saved.
Fields of the 200 answer
dataobjectRequired
Fields
idintegerRequired
At least 1.
namestringRequired
permissionsarray of stringsRequired
slugstringRequired
The name as a slug, then a unique suffix. The slug does not change when the role is renamed.
messagestringRequired
statusstringRequired
If it is refused
| Status | Reason | What to do |
|---|---|---|
401 | none | Send a valid token as Authorization: Bearer <token>. |
403 | forbidden | The person is not allowed to do this. |
403 | scope_required | Use a token with the scope named in scope. |
404 | none | Check the id. You see only what your account can reach. |
422 | invalid | Fix the field named in field; errors says why. |
429 | rate_limited | Wait for the seconds in Retry-After. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl -X POST https://manage.corefinity.com/api/roles/3107/update \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "Release leads",
"permissions": [
"viewUsers",
"viewWebsites"
]
}'use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->post('https://manage.corefinity.com/api/roles/3107/update', [
'name' => 'Release leads',
'permissions' => [
'viewUsers',
'viewWebsites',
],
]);
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/roles/3107/update', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Release leads',
permissions: [
'viewUsers',
'viewWebsites',
],
}),
});
// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);import os
import requests
res = requests.post(
"https://manage.corefinity.com/api/roles/3107/update",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
json={
"name": "Release leads",
"permissions": [
"viewUsers",
"viewWebsites",
],
},
)
data = res.json() if res.content else None{
"data": {
"id": 3107,
"name": "Release leads",
"permissions": [
"viewUsers",
"viewWebsites"
],
"slug": "release-managers-0b9c7a52-3f7e-4c1d-9a55-2f6f1f0e8d11"
},
"message": "Role updated.",
"status": "success"
}{
"message": "Unauthenticated."
}{
"code": "forbidden",
"message": "You are not allowed to update roles.",
"reason": "forbidden",
"status": "error"
}{
"message": "Not found."
}{
"code": "invalid",
"errors": {
"permissions": [
"The permissions field is required."
]
},
"field": "permissions",
"message": "The permissions field is required.",
"reason": "invalid"
}{
"code": "rate_limited",
"message": "Too many requests. Try again in 60 seconds.",
"reason": "rate_limited",
"retry_after_seconds": 60
}Try it
Try it is off for this endpointIt has not been cleared for the console. Copy the request and run it yourself when you are sure.
Was this helpful?