set #
Creates a key holding the provided value, or overwrites it if it already exists.
Query Syntax #
HTTP #
URL: http://kuzzle:7512/ms/_set/<_id>
Method: POST
Body:
{
"value": "<value>",
"ex": 60,
"nx": true
}
Other protocols #
{
"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 secondspx
: set the specified expire time, in millisecondsnx
: if true, only set the key if it does not already existxx
: 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.
{
"requestId": "<unique request identifier>",
"status": 200,
"error": null,
"controller": "ms",
"action": "set",
"collection": null,
"index": null,
"result": "OK"
}
Edit this page on Github (opens new window)