createRole #
Creates a new role.
Query Syntax #
HTTP #
URL: http://kuzzle:7512/roles/<_id>/_create[?refresh=wait_for][&force]
Method: POST
Body:
{
"tags": ["moderators"],
"controllers": {
"*": {
"actions": {
"*": true
}
}
}
}
Other protocols #
{
"controller": "security",
"action": "createRole",
"_id": "<roleId>",
"body": {
"tags": ["moderators"],
"controllers": {
"*": {
"actions": {
"*": true
}
}
}
}
}
Arguments #
_id
: role identifier
Optional: #
refresh
: if set towait_for
, Kuzzle will not respond until the created role is indexed (default:"wait_for"
)force
: if set totrue
, creates the role even if it gives access to non-existent plugins API actions.
Body properties #
controllers
: role definition
Response #
Returns the role creation/replacement status:
_id
: created/replaced role identifier_source
: role definitioncreated
: always trueversion
: always 1
{
"status": 200,
"error": null,
"result": {
"_id": "<roleId>",
"_version": 1,
"created": true,
"_source": {
"controllers": {
"*": {
"actions": {
"*": true
}
}
}
}
}
"requestId": "<unique request identifier>",
"controller": "security",
"action": "createRole"
}
Edit this page on Github (opens new window)