Data API response payload

After a successful data request payload execution, the system returns an HTTP response of type text/json.

Syntax of a Response Payload

The Data API has a consistent pattern for an output payload, with the following basic access syntax:

{
  "info": [
    "Query:SELECT query
  ], 
  "coltypes": [
    "type_of_single_column", 
    "BIGINT"
  ], 

  "colnames":[
    "column_name_1",  
    "column_name_2",
    "column_name_n"
  ], 
  
  "rows": [
    [
     "row_information_1",
     "row_information_2",
     "row_information_n"
    ]  
  ]
}

Parameters of a Response Payload

The response payload parameters are defined as follows:

info
String of the raw SQL query that is executed.
coltypes
Array of strings, where each string specifies the type of a single column returned by the data request.
colnames
Array of strings, where each string specifies the name of a single column returned by the data request. This contains the alias for the columns as specified in the initial request.
rows
Array of arrays, where each inner array represents a single row of information returned by the data request.

Example of a Response Payload

Here is an example of a Data API response payload:

{
  "info": [
    "Query:SELECT TA_0.`manufacturer` as `manufacturer`, sum(1) as `Record Count`\n  
       FROM `main`.`cereals`  TA_0\n  WHERE TA_0.`cold_or_hot` in ('C')\n  GROUP BY 1\n  LIMIT 100"
  ], 
  "coltypes": [
    "STRING", 
    "BIGINT"
  ], 
  "colnames": [
    "manufacturer", 
    "Record Count"
  ], 
  "rows": [
    [
      "General Mills", 
      22
    ], 
    [
      "Kelloggs", 
      23
    ]
  ]
}