createProfile #
Creates a new profile.
Query Syntax #
HTTP #
URL: http://kuzzle:7512/profiles/<_id>/_create[?refresh=wait_for][&strict]
Method: POST
Body:
{
"rateLimit": 50,
"tags": ["moderators"],
"policies": [
{
"roleId": "<roleId>"
},
{
"roleId": "<roleId>",
"restrictedTo": [
{
"index": "<index>"
},
{
"index": "<index>",
"collections": [
"<coll1>",
"<coll2>"
]
}
]
}
]
}
Other protocols #
{
"controller": "security",
"action": "createProfile",
"_id": "<profileId>",
"body": {
"rateLimit": 50,
"tags": ["moderators"],
"policies": [
{
"roleId": "<roleId>"
},
{
"roleId": "<roleId>",
"restrictedTo": [
{
"index": "<index>"
},
{
"index": "<index>",
"collections": [
"<coll1>",
"<coll2>"
]
}
]
}
]
},
// Optional parameters
"refresh": "wait_for",
"strict": true
}
Arguments #
_id
: new profile identifier. An error is returned if the profile already exists
Optional: #
refresh
: if set towait_for
, Kuzzle will not respond until the created profile is indexed (default:"wait_for"
)strict
(default:false
): if set to true, will only allow the profile to be restricted on existing indexes or collectionsAvailable since 2.6.0
Body properties #
See the profile definition guide.
Response #
Returns an object with the new profile creation status:
_id
: created profile identifier_source
: profile contentcreated
: alwaystrue
version
: always1
{
"status": 200,
"error": null,
"result": {
"_id": "<profileId>",
"_version": 1,
"created": true,
"_source": {
// new profile content
}
},
"requestId": "<unique request identifier>",
"controller": "security",
"action": "createProfile"
}
Edit this page on Github(opens new window)