Run multiple UAPI functions in order

This function combines calls for multiple UAPI functions and performs them in order.

Note:

  • If a function call in the list fails, the Batch::strict function does not run further function calls in the list.
  • Due to the potential length of calls of this function, we recommend that you use the HTTP POST method for extremely long batch commands.
Authorizations:
query Parameters
required
Array of strings or objects [ 2 .. 3 ] items

A UAPI function call, encoded as a JSON array with two or three items:

  • The UAPI module.
  • The UAPI function.
  • A JSON object containing the parameters to pass to this function. You can omit this value if you do not pass any parameters to the function.

To submit multiple commands, duplicate the parameter name, or index all parameter names and increment the index for each one.

  • When using the cPanel LiveAPI PHP Library, you must increment the parameter name when you submit the arguments in an associative array. For example: use command-0, command-1, and command-2.
  • When using the cPanel LiveAPI Perl Library, you must increment the parameter name when you submit the arguments in a hash. For example: use command-0, command-1, and command-2.
  • You do not need to add an index to command parameters for query string calls of this function.

Responses

Response Schema: application/json
apiversion
integer

The version of the API.

func
string

The name of the method called.

module
string

The name of the module called.

object

Request samples

uapi --output=jsonpretty --user=username Batch strict command-0='[ "PasswdStrength", "get_required_strength", { "app": "webdisk"} ]' command-1='["SSH","get_port"]'

Response samples

Content type
application/json
{
  • "apiversion": 3,
  • "func": "strict",
  • "module": "Batch",
  • "result": {
    • "data": [
      • {
        • "data": {
          • "strength": 65
          },
        • "errors": null,
        • "messages": null,
        • "metadata": { },
        • "status": 1,
        • "warnings": null
        },
      • {
        • "data": {
          • "port": 22
          },
        • "errors": null,
        • "messages": null,
        • "metadata": { },
        • "status": 1,
        • "warnings": null
        }
      ],
    • "errors": null,
    • "messages": null,
    • "metadata": {
      • "transformed": 1
      },
    • "status": 1,
    • "warnings": null
    }
}