createFirstAdmin #
Creates a Kuzzle administrator account, only if none exist.
Query Syntax #
HTTP #
URL: http://kuzzle:7512/<kuid>/_createFirstAdmin[?reset]
URL(2): http://kuzzle:7512/_createFirstAdmin[?reset]
Method: POST
Body:
{
"content": {
// administrator information (optional)
},
"credentials": {
// for example, with the "local" authentication strategy:
"local": {
"username": "userAdmin",
"password": "myPassword"
}
}
}
Other protocols #
{
"controller": "security",
"action": "createFirstAdmin",
"body": {
"content": {
// administrator information (optional)
},
"credentials": {
// for example, with the "local" authentication strategy:
"local": {
"username": "userAdmin",
"password": "myPassword"
}
}
},
// optional
"reset": <boolean>,
"_id": "<kuid>"
}
Arguments #
Optional: #
_id
: specify the administror kuid, instead of letting Kuzzle generate a random identifier.reset
(boolean): if true, restricted rights are applied to theanonymous
anddefault
roles (by default, these roles don't have any restriction).
Body properties #
content
: administrator additional information. Can be left empty.credentials
: describe how the new administrator can be authenticated. This object must contain one or multiple properties, named after the target authentication strategy to use. Each one of these properties are objects containing the credentials information, corresponding to that authentication strategy
Response #
Returns information about the newly created administrator:
_id
: administrator kuid_source
: administrator user document, contains all properties set in thecontent
body argument, but also the list of attributedprofileIds
. That list is initialized with theadmin
profile
{
"status": 200,
"error": null,
"controller": "security",
"action": "createFirstAdmin",
"volatile": {},
"requestId": "<unique request identifier>",
"result": {
"_id": "<kuid>", // The kuzzle user identifier
"_source": {
"name": "John Doe",
"profileIds": [
"admin"
]
}
}
}
Edit this page on Github(opens new window)