Create or update role
Creates a role with permissions, can also be used to add permissions to a role
PUT
/appid-{appId}/recipe/roleAuthorization
api-keyAPI key · headerrequiredThe core service API token. If you are using a self-hosted core service and you have not generated a token, you can omit the header.
Header parameters
ridstringcdi-versionstringX.Y of the X.Y.Z CDI version.
Request body
application/jsonrolerolerequiredpermissionsstring[]Responses
200The operation was successful
statusstatusOKAllowed:
OKcreatedNewRoleboolean400error code 400
string401error code 401
string404error code 404
string500error code 500
stringTry it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X PUT "/appid-{appId}/recipe/role" \
-H "api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"role": "admin",
"permissions": [
"permission"
]
}'const response = await fetch("/appid-{appId}/recipe/role", {
method: "PUT",
headers: {
"api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
"role": "admin",
"permissions": [
"permission"
]
})
});import requests
response = requests.put(
"/appid-{appId}/recipe/role",
headers={
"api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"role": "admin",
"permissions": [
"permission"
]
},
)Response
{
"status": "OK",
"createdNewRole": true
}"string""Invalid API key""Not Found""Internal Error"