Skip to content

Response Format

A well formed API response is a list of length two (header;result).

The header is a dictionary with the following keys:

  • rc - short - response code
  • ac - short - application code
  • ai - string - application information
  • app* - various - user defined query application keys.

Amending system header fields in an analytic response results in an error. For example:

"API response attempting to amend restricted system headers, ,`logCorr"

Only user defined app* fields can be added or amended. Refer to the header documentation for a list of system headers and more information on headers.

Result

The result is the output of the API call and can have any format.

Helper functions such as .kxi.response.ok and .kxi.response.error are available to wrap API results in the appropriate format. For more information, refer to the helper functions documentation.

Response codes

Return Code (RC) and Application Code (AC) are short integers that accompany an API response from the Service Gateway and Data Access processes, stored in the rc and ac fields of the response header.

Values other than 0h (OK) indicate a failure. Explanations for specific codes are available in the response codes documentation.

Well designed UDAs must include these codes in their response headers. These codes are stored as dictionary objects in the .kxi.response.rc and .kxi.response.ac variables.

Example: Anticipated failure

For anticipated failure scenarios, such as a requested table not being in the assembly, returns the response function with appropriate RC/AC codes:

myFunction:{
    / Some logic
    if[not tbl in tables[];
        :.kxi.response.error[.kxi.response.ac.TABLE;"Table not found in DAP";res]];
    / Some more logic
    }

A successful query returns the success response function:

myFunction:{
    / Some logic
    .kxi.response.ok res
    }