jsonAction response

List of properties in JSON Action response messages

jsonAction response

The following properties are part of each jsonAction response message. All are optional except for "result", "errorCode", and "errorMessage". APIs often take advantage of the optional properties to implement advanced features.

 

Example

{
  "requestId": "1",
  "result": {},
  "errorCode": 0,
  "errorMessage": "",
  "debugInfo":
  {
    "request":
    {
      "requestId": "1",

      "action": "someAction",
      "params": {},

      "api": "someApi",
      "apiVersion": "1.0",

      "responseOptions": { },
      "debug": "max",
      "authToken": "replaceWithAuthTokenFromCreateSession"
    },
    "serverSuppliedValues": {},
    "errorData": {},
    "warnings": [ { "warningCode": 0, "warningMessage": "", "warningData": {} } ],
    "executionPlan": {}
  }
}

 

Property summaries

Property Description Type Limits (inclusive)
debugInfo contains troubleshooting information about a request and its response. object  
debugInfo
.errorData
contains data about an error. object  
debugInfo
.executionPlan
contains data about the execution of a query. object  
debugInfo
.request
contains all properties that can be included in a request. object  
debugInfo
.serverSuppliedValues
contains zero or more properties set by the server to default values. object  
debugInfo
.warnings
contains a warning object for each warning the server wants to communicate to the client. array of objects  
errorCode

indicates an error when set to a non-zero integer or success when 0.

integer

-2,147,483,648 to 2,147,483,647

errorMessage

contains a human-readable error message.

string 0 to 256 bytes
requestId

contains any JSON value to identify a message as assigned by the client.

string
number
object
array
Boolean
null
 
result contains the result of an action. object  


 

"debugInfo"

The "debugInfo" property is an optional, case-insensitive string enum that causes the server to return a minimal or a maximal amount of debug information in the response message. The default value is "none". The JSON is pretty printed for readability except when set to "none".

Possible values:
  • "none" - This is the equivalent to omitting the "debug" property or setting to null.
  • "min" - This causes the server to return a minimal amount of extra debugging information in the response message.
  • "max" - This causes the server to return a maximum amount of debugging information in the response message which is useful for deep troubleshooting but requires significant computational power and resources for the server to generate this information. It is typically used during development and QA.
Request example
    "debugInfo": "max"
Response example
"debugInfo": {
    "request": {
      "schema": "faircom.com/schemas/db/v1",
      "requestId": "1",
      "authToken": "1234serverSuppliedAuthToken64Bytes1234",
      "api": "db",
      "apiVersion": "1.0",
      "action": "actionName",
      "params": {},
      "responseOptions": {},
      "debug": "max"
    },
    "serverSuppliedValues": {},
    "errorData": {},
    "warnings": [
      {
        "warningCode": 0,
        "warningMessage": "",
        "warningData": {}
      }
    ],
    "executionPlan": {}
  }

"errorData"

The "errorData" property is an object that may contain additional properties. If there is data about an error it is placed in the "errorData" property.

  • If there is no additional data, it is an empty object.
  • It is always an object.
  • Its properties may vary depending on the api, action, and error message.

"request"

The "request" property contains the original values submitted in the request. It is included when the "debug" property is set to "max". See JSON Action request.

Example
"request": 
{
  "authToken": "serverSuppliedAuthToken",
  "requestId": "1",

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

  "responseOptions": {},
  "debug": "max"
}

"warnings"

The "warnings" property is an optional array of warning objects. It contains one object for each warning the server wants to communicate to the client.

Example
"warnings": [
  {
    "warningCode": 0,
    "warningMessage": "",
    "warningData": {
    }
  }
]
"warnings" property summaries
Property Description Type Limits (inclusive)
warningCode contains a positive or negative integer, a non-zero number when there is a warning, or contains a 0 when there is no warning. integer

-2147483648 to 2147483647

warningData contains data about an error. object  
warningMessage contains a human-readable error message. string 0 to 64 bytes



 

"errorCode"

The "errorCode" property occurs only in a response message. It is a signed integer from -2147483648 to 2147483647. A non-zero value indicates an error.

  • When there is no error the value is 0.
  • When there is an error, it contains a non-zero integer number that uniquely identifies the cause of the error.
  • FairCom's error codes are listed in the error code reference.

Error codes

Error codes from -32768 to -32000 are assigned specific meanings by the jsonAction specification
error.code error.message error.meaning
-32700 Parse error This indicates an error occurred on the server while parsing the request.
-32600 Invalid request This indicates the request message does not match the requirements of the specified version of the API.
-32601 Method not found This indicates the action does not exist or is not available.
-32602 Invalid params This indicates invalid action parameter(s). It occurs when a required property is missing or when an unexpected property is in the message.
-32603 Internal error This indicates a unexpected jsonAction error.
-32000 through -32099 Server error These are reserved for future jsonAction errors.

 

"errorMessage"

The "errorMessage" property is a string set by the server. It contains a human-readable error message.

  • It is a zero-length string when there is no error.
  • It is a non-zero-length string that describes the error.
  • Look for a non-zero value in the "errorCode" property to know when there is an error.

 

"requestId"

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

  • "requestId" can contain any JSON value, including:
    • object
    • array
    • string
    • integer
    • Boolean
    • null
  • From the client's perspective, "requestId" uniquely identifies a message. The server returns this identifier to the client in its response message, allowing 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.

"result"

The "result" property is a required object set by the server that contains the result of an action.

Example
{
  "authToken": "replaceWithAuthTokenFromCreateSession",
  "result": {
    "dataFormat": "objects",
    "binaryFormat": "hexadecimal",
    "fields": 
    [
      {
        "name": "id",
        "type": "bigint",
        "length": null,
        "scale": null,
        "autoTimestamp": "none",
        "defaultValue": null,
        "nullable": false,
        "primaryKey": 1
      },
      {
        "name": "name",
        "type": "varchar",
        "length": 30,
        "scale": null,
        "autoTimestamp": "none",
        "defaultValue": null,
        "nullable": true,
        "primaryKey": 0
      },
      {
        "name": "birthDate",
        "type": "date",
        "length": null,
        "scale": null,
        "autoTimestamp": "none",
        "defaultValue": null,
        "nullable": true,
        "primaryKey": 0
      },
      {
        "name": "favoriteSaying",
        "type": "varchar",
        "length": 500,
        "scale": null,
        "autoTimestamp": "none",
        "defaultValue": null,
        "nullable": true,
        "primaryKey": 0
      }
    ]    
  },
  "errorCode": 0,
  "errorMessage": ""
}