Core
API v2.x
2

mexecute #

Allows the execution of multiple commands or 'actions' in a single step.

It creates a redis transaction block and executes it immediately, all actions will be executed sequentially and as a single atomic and isolated operation.

[Redis documentation]

Only already supported actions can be executed using mexecute.


Query Syntax #

HTTP #

Copied to clipboard!
URL: http://kuzzle:7512/ms/_mexecute
Method: POST
Body:
Copied to clipboard!
{
  "actions": [
    {"action": "command", "args": {"_id": "x", "body": {"value": 1}},
    {"action": "command", "args": {"_id": "x"}},
    {"action": "...", "args": {...}}
  ]
}

Other protocols #

Copied to clipboard!
{
  "controller": "ms",
  "action": "mexecute",
  "body": {
    "actions": [
        {"action": "command", "args": {"_id": "x", "body": {"value": 1}},
        {"action": "command", "args": {"_id": "x"}},
        {"action": "...", "args": {...}}
    ]
  }
}

Body properties #

  • actions: an array of objects. Each object describes an action to be executed, using the following properties:
    • action: action name
    • args: an object containing all required arguments

Response #

Returns an array of error & result pairs for each executed action, in order.

Copied to clipboard!
{
  "requestId": "<unique request identifier>",
  "status": 200,
  "error": null,
  "controller": "ms",
  "action": "mexecute",
  "collection": null,
  "index": null,
  "result": [
      ["err" | null, "result"],
      [null, "OK"],
      [null, 1],
  ]
}