getset

Sets a new value for a key, and returns its previously stored value.

[Redis documentation]


Query Syntax

HTTP

Copied to clipboard!
URL: http://kuzzle:7512/ms/_getset/<_id>
Method: POST
Body:
Copied to clipboard!
{
  "value": "new key value"
}

Other protocols

Copied to clipboard!
{
  "controller": "ms",
  "action": "getset",
  "_id": "<key>",
  "body": {
    "value": "new key value"
  }
}

Arguments

  • _id: key to get and set

Body properties

  • value: the new key value

Response

Returns the previously stored value.

Copied to clipboard!
{
  "requestId": "<unique request identifier>",
  "status": 200,
  "error": null,
  "controller": "ms",
  "action": "getset",
  "collection": null,
  "index": null,
  "result": "key's previous value"
}