Skip to main content

jsonAction request

List of properties in JSON Action request messages

The following properties are part of each jsonAction request message. All are optional except for "action", and "params". APIs often take advantage of the optional properties to implement advanced features.

Example

{
  "requestId": "1",

  "api": "someApi",
  "apiVersion": "1.0",
  "action": "someAction",
  "params": {},

  "responseOptions":
  {
    "binaryFormat":   "hex",
    "dataFormat":     "objects",
    "numberFormat":   "string",
    "includeFields":  [],
    "excludeFields":  [],
    "includePaths":   [],
    "excludePaths":   []
  },
  "debug": "max",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

Properties summary

Table 1. Request message property summaries

Property

Description

Default

Type

Limits (inclusive)

action

contains the name of a remote procedure call that the server can execute

Required - No default value

string

api

(optional) contains the name of an API

""

string

"admin"
"db"
"hub"
"mq"
"transform"

apiVersion

(optional) specifies the major, minor, and patch versions of the API

Latest version of the API

string

0 to 12 bytes

authToken

signifies that the client is authenticated and authorized

Required - No default value

Note

Optional for "pingSession" and "createSession" and defaults to "".

string

0 to 225 bytes

debug

(optional) contains the settings for returning any extra debug information

"none"

string

"none"
"max"

params

(optional) contains the parameters to an action

{}

object

responseOptions

(optional) configures the server to return a customized response

{}

object

responseOptions
.binaryFormat

(optional) specifies how binary values are returned

"base64"

string

One of the following: "base64", "hex", or "byteArray".

responseOptions
.dataFormat

(optional) specifies what format the results will be returned in

"arrays"

string

"default"
"arrays"
"objects"
responseOptions
.excludeFields

(optional) specifies which fields are excluded in the response message

[]

Note

When the array is empty or the property is not specified, the "includeFields" behavior applies

array

responseOptions
.includeFields

(optional) specifies which fields are returned in the response message

[]

Note

When the array is empty or the property is not specified, all fields are returned

array

responseOptions
.numberFormat

(optional) specifies how numbers are formatted in the JSON response message

"number"

string

"number"
"string"

requestId

(optional) contains any JSON value to identify a message as assigned by the client

null

string
number
object
array
Boolean
null


The "responseOptions" property is an optional object that configures the server to return a customized response.

Essential information:
  • None of these properties are required, but some are mutually exclusive:

    • "includeFields" and "excludeFields" are mutually exclusive.

      Use "includeFields" or "excludeFields" to control which record fields are present in the data.

  • Use "dataFormat" to control whether data comes back as an array of arrays or an array of objects.

  • Use "binaryFormat" to control how binary data is embedded in JSON strings.

  • Use "numberFormat" to control whether JSON numbers are rendered as digits or digits embedded in a string.

The "dataFormat" property is an optional, case-insensitive string enum. It defines the format of data being sent to the server. "autoDetect" is the default value.

Note

There are two different-but-similar versions of the "dataFormat" property. One version occurs in a request and another occurs in a response.

Possible values:
  • "arrays"

    This causes the server to return results as an array of arrays, which is most efficient.

  • "objects"

    This returns results as an array of objects. This is less efficient but is simpler to generate, read, and troubleshoot.

  • "autoDetect"

    This causes the server to automatically detect the format of the data in the "sourceData" property. This is the default.

  • Omitted or set to null

    This defaults to "autoDetect", which causes the server to automatically detect the format of the data in the "sourceData" property.

The "numberFormat" property is an optional, case-insensitive string enum. It defines the format of JSON numbers returned in a response. "number" is the default value.

Possible values:
  • "number"

    This causes the server to return numeric values as JSON numbers, such as -18446744073709551616.000144722494 .

    This is most efficient.

    JSON represents numbers are base-ten numbers that may have any number of digits.

    Large numbers, such as 18446744073709551616.000144722494 are known to cause problems with JSON parsers and some programming languages, such as JavaScript, which are limited to the smaller range and binary rounding errors of IEEE floating point numbers.

  • "string"

    This returns the server to embed numeric values in JSON strings, such as "18446744073709551616.000144722494" .

    This is slightly less efficient because it includes two extra double quote characters

    Returning numbers embedded in strings ensures JSON parsers and programming languages will not automatically convert the number to a numeric representation that loses precision, introduces rounding errors, truncates values, or generates errors. This allows your application to control how numbers are processed.

  • Omitted or set to null

    This defaults to "number".

A JSON Action request message facilitates remote procedure calls to a server, with the "action" and "params" properties being mandatory. While other properties are optional, they enable advanced features, such as "responseOptions" for customizing the server's response format (e.g., "binaryFormat", "dataFormat", "numberFormat", and field inclusion/exclusion), "api" to specify the target API, "apiVersion" for versioning, "authToken" for authentication (required for most requests except session creation), "debug" for returning troubleshooting information, and "requestId" to uniquely identify messages. Notably, "binaryFormat" is unique as it influences both request and response formatting for binary data, supporting "base64", "hex", or "byteArray" representations, each with trade-offs in readability and payload size.

JSON Action API
JSON Action message format
JSON Action properties
JSON Action parameters
API request structure
Remote Procedure Call (RPC) JSON
request message properties
JSON Action request
JSON DB API
action property JSON
responseOptions JSON request
JSON API development
Backend API integration JSON
Data serialization JSON
handling binary data in JSON
customizing JSON responses
API debugging JSON
JSON request payload
How to build JSON Action request

The "action" property is a required, case-insensitive string enum. It is the name of a remote procedure call that the server can execute. It is required by the jsonAction standard.

Possible values depend on the API being used, for a complete list of "actions" see:

The "api" property is an optional, case-insensitive string enum that contains the name of an API. An API can execute one or more actions. It defaults to whatever API is being used.

Possible values:
  • "db"

    Note

    For JSON DB API "api" is always "db".

  • "mq"

  • "hub"

  • "admin"

The "apiVersion" property is returned by the server. It is always the entire version number of the JSON DB API for troubleshooting.

  • "apiVersion" specifies the major, minor, and patch versions of an API.

  • Examples include "3", "3.1" , and "3.1.23" .

  • The number to the left of the decimal point is the major API version.

  • The middle number is the minor API version, which is required only when a patch number is included.

  • The rightmost number is an optional patch number.

The "authToken" property signifies that the client is authenticated and authorized. It is required except in "pingSession" and "createSession". For "pingSession" and "createSession" it defaults to an empty string.

The server generates a unique authentication token in response to "createSession". Clients must include it in all subsequent requests. If the client does not supply a valid "authToken", the server returns error 12031.

You can create a permanent "authToken" by setting the "permanentSession" property to true when you create a session. A permanent "authToken" works like an API key and does not expire.

The "debug" property is an optional, case-insensitive string enum that causes the server to return debug information. The default value is "none" which is equivalent to omitting this property or similar to setting it to null.

  • Possible values:

    • "none"

    • "max"

  • Setting the "debug" value to anything other than "none" causes the server to pretty-print the JSON that it returns making it easier to troubleshoot.

  • Setting to "max" causes the server to return a response that includes the maximum amount of extra debug information in the response making it useful for troubleshooting live production data with minimal impact on server resources.

  • Setting to "none" cause no debug information to be returned which is useful for production environments that are running well.

The "params" property is an object that contains an action's parameters. Each action defines its own required and optional properties. See System limits for a comprehensive look at property requirements and limitations.

The "requestId" property is typically a string or integer but can contain any JSON value that is an identifier assigned by the client. It is optional and defaults to null.

  • "requestId" can contain any JSON value including:

    • object

    • array

    • string

    • integer

    • Boolean

    • null

  • From the client's perspective, "requestId" uniquely identifies a message where the server returns this identifier to the client in its response message. This allows a client to match a request to a response.

  • It is particularly useful when a client runs JSON DB API over an asynchronous protocol, such as MQTT or WebSocket.

  • It can be omitted or set to a zero-length string when the client does not need it.