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

update #

Applies partial changes to an asset.

See also the document:update API action.


Query Syntax #

HTTP #

Copied to clipboard!
URL: http://kuzzle:7512/_/device-manager/:index/assets/:_id[?refresh=wait_for][&retryOnConflict=<int>][&source]
Method: PUT
Body:
Copied to clipboard!
{
  // asset changes
}

Other protocols #

Copied to clipboard!
{
  "index": "<index>",
  "controller": "device-manager/asset",
  "action": "update",
  "_id": "<assetId>",
  "body": {
    // asset changes
  }
}

Kourou #

Copied to clipboard!
kourou device-manager/asset:update <index> --id <assetId> --body '{ 
  // asset changes
}'

Arguments #

  • index: index name

Optional: #

  • refresh: if set to wait_for, Kuzzle will not respond until the update is indexed
  • retryOnConflict: conflicts may occur if the same document gets updated multiple times within a short timespan, in a database cluster. You can set the retryOnConflict optional argument (with a retry count), to tell Kuzzle to retry the failing updates the specified amount of times before rejecting the request with an error.
  • source: if set to true Kuzzle will return the entire updated document body in the response.

Body properties #

Partial changes to apply to the asset.


Response #

Returns information about the updated asset:

  • _id: asset unique identifier
  • _version: updated asset version
  • _source: contains only changes or the full asset if source is set to true
Copied to clipboard!
{
  "status": 200,
  "error": null,
  "index": "<index>",
  "controller": "device-manager/asset",
  "action": "update",
  "requestId": "<unique request identifier>",
  "result": {
    "_id": "<assetId>",
    "_version": 2,
    "_source": "<partial or entire document>"
  }
}