createProfile

Creates a new profile.


Query Syntax

HTTP

Copied to clipboard!
URL: http://kuzzle:7512/profiles/<_id>/_create[?refresh=wait_for]
Method: POST
Body:
Copied to clipboard!
{
  "policies": [
    {
      "roleId": "<roleId>"
    },
    {
      "roleId": "<roleId>",
      "restrictedTo": [
        {
          "index": "<index>"
        },
        {
          "index": "<index>",
          "collections": [
            "<coll1>",
            "<coll2>"
          ]
        }
      ]
    }
  ]
}

Other protocols

Copied to clipboard!
{
  "controller": "security",
  "action": "createProfile",
  "_id": "<profileId>",
  "body": {
    "policies": [
      {
        "roleId": "<roleId>"
      },
      {
        "roleId": "<roleId>",
        "restrictedTo": [
          {
            "index": "<index>"
          },
          {
            "index": "<index>",
            "collections": [
              "<coll1>",
              "<coll2>"
            ]
          }
        ]
      }
    ]
  }
}

Arguments

  • _id: new profile identifier. An error is returned if the profile already exists

Optional:

  • refresh: if set to wait_for, Kuzzle will not respond until the created profile is indexed

Body properties


Response

Returns an object with the new profile creation status:

  • _id: created profile identifier
  • _source: profile content
  • created: always true
  • version: always 1
Copied to clipboard!
{
  "status": 200,
  "error": null,
  "result": {
    "_id": "<profileId>",
    "_version": 1,
    "created": true,
    "_source": {
      // new profile content
    }
  },
  "requestId": "<unique request identifier>",
  "controller": "security",
  "action": "createProfile"
}