Core
API v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

set #

Creates a key holding the provided value, or overwrites it if it already exists.

[Redis documentation]


Query Syntax #

HTTP #

Copied to clipboard!
URL: http://kuzzle:7512/ms/_set/<_id>
Method: POST
Body:
Copied to clipboard!
{
  "value": "<value>",
  "ex": 60,
  "nx": true
}

Other protocols #

Copied to clipboard!
{
  "controller": "ms",
  "action": "set",
  "_id": "<key>",
  "body": {
    "value": "<value>",
    "ex": 60,
    "nx": true
  }
}

Argument #

  • _id: key identifier

Body properties #

Optional: #

  • ex: set the specified expire time, in seconds
  • px: set the specified expire time, in milliseconds
  • nx: if true, only set the key if it does not already exist
  • xx: if true, only set the key if it already exists

Note: ex and px options are mutually exclusive, and setting values to both lead to a BadRequestError error. Same thing goes for nx and xx.


Response #

Returns an acknowledgement.

Copied to clipboard!
{
  "requestId": "<unique request identifier>",
  "status": 200,
  "error": null,
  "controller": "ms",
  "action": "set",
  "collection": null,
  "index": null,
  "result": "OK"
}