createOrReplaceRole #
Creates a new role or, if the provided role identifier already exists, replaces it.
Query Syntax #
HTTP #
URL: http://kuzzle:7512/roles/<_id>[?refresh=wait_for]
Method: PUT
Body:{
"controllers": {
"*": {
"actions": {
"*": true
}
}
}
}Other protocols #
{
"controller": "security",
"action": "createOrReplaceRole",
"_id": "<roleId>",
"body": {
"controllers": {
"*": {
"actions": {
"*": true
}
}
}
}
}Arguments #
_id: role identifier
Optional: #
refresh: if set towait_for, Kuzzle will not respond until the created/replaced role is indexed
Body properties #
controllers: role definition
Response #
Returns the role creation/replacement status:
_id: created/replaced role identifier_source: role definitioncreated: if true, the role has been created. Otherwise, it has been replacedversion: updated role version number
{
"status": 200,
"error": null,
"result": {
"_id": "<roleId>",
"_version": 1,
"created": true,
"_source": {
"controllers": {
"*": {
"actions": {
"*": true
}
}
}
}
}
"requestId": "<unique request identifier>",
"controller": "security",
"action": "createOrReplaceRole"
}