Update a Role
Updates a Role
PATCH
/
api
/
v2
/
platform
/
roles
/
{id}
Update a Role
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({role: {name: 'vendor'}})
};
fetch('http://{defaultHost}/api/v2/platform/roles/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url http://{defaultHost}/api/v2/platform/roles/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"role": {
"name": "vendor"
}
}
'{
"data": {
"id": "8",
"type": "role",
"attributes": {
"name": "administrator",
"created_at": "2022-11-08T19:35:07.901Z",
"updated_at": "2022-11-08T19:35:08.133Z"
}
}
}{
"error": "The access token is invalid"
}{
"error": "The resource you were looking for could not be found."
}{
"error": "Name can't be blank",
"errors": {
"name": [
"can't be blank"
]
}
}Was this page helpful?
⌘I
Update a Role
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({role: {name: 'vendor'}})
};
fetch('http://{defaultHost}/api/v2/platform/roles/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url http://{defaultHost}/api/v2/platform/roles/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"role": {
"name": "vendor"
}
}
'{
"data": {
"id": "8",
"type": "role",
"attributes": {
"name": "administrator",
"created_at": "2022-11-08T19:35:07.901Z",
"updated_at": "2022-11-08T19:35:08.133Z"
}
}
}{
"error": "The access token is invalid"
}{
"error": "The resource you were looking for could not be found."
}{
"error": "Name can't be blank",
"errors": {
"name": [
"can't be blank"
]
}
}
