Official Plugins (Kuzzle v2.x)
Device Manager v0.x
2

create #

Creates a new asset inside a tenant index.

Returns an error if the document already exists.

See also the document:create API action.


Query Syntax #

HTTP #

Copied to clipboard!
URL: http://kuzzle:7512/_/device-manager/:index/assets[?refresh=wait_for]
Method: POST
Body:
Copied to clipboard!
{
  // asset content
}

Other protocols #

Copied to clipboard!
{
  "index": "<index>",
  "controller": "device-manager/asset",
  "action": "create",
  "body": {
    // asset content
  }
}

Kourou #

Copied to clipboard!
kourou device-manager/asset:create <index> --body '{ 
  type: "<asset type>", 
  model: "<asset model>", 
  reference: "<asset reference>" 
}'

Arguments #

  • index: index name

Optional: #

  • refresh: if set to wait_for, Kuzzle will not respond until the newly created document is indexed
  • _id: set the document unique ID to the provided value, instead of auto-generating an ID with the type, model and the reference

Body properties #

Asset content to create.

Assets must contains at least the following properties:

  • model: Asset model designation
  • reference: Unique identifier scoped to a model

Assets can contain custom values in the metadata property.


Response #

Returns an object with the following properties:

  • _id: created document unique identifier
  • _source: document content
  • _version: version of the created document (should be 1)
Copied to clipboard!
{
  "status": 200,
  "error": null,
  "index": "<index>",
  "controller": "device-manager/asset",
  "action": "create",
  "requestId": "<unique request identifier>",
  "result": {
    "_id": "<assetId>",
    "_version": 1,
    "_source": {
      // ...
    },
  }
}