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 #
URL: http://kuzzle:7512/_/device-manager/:index/assets[?refresh=wait_for]
Method: POST
Body:{
// asset content
}Other protocols #
{
"index": "<index>",
"controller": "device-manager/asset",
"action": "create",
"body": {
// asset content
}
}Kourou #
kourou device-manager/asset:create <index> --body '{
type: "<asset type>",
model: "<asset model>",
reference: "<asset reference>"
}'Arguments #
index: index name
Optional: #
refresh: if set towait_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 thetype,modeland thereference
Body properties #
Asset content to create.
Assets must contains at least the following properties:
model: Asset model designationreference: 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 be1)
{
"status": 200,
"error": null,
"index": "<index>",
"controller": "device-manager/asset",
"action": "create",
"requestId": "<unique request identifier>",
"result": {
"_id": "<assetId>",
"_version": 1,
"_source": {
// ...
},
}
}