Pricing changes are coming in January. Contact our Sales team to secure the current price for your desired license.
All documentation
  • API Reference for older versions
  • /select request for the flat table

    [starting from version: 2.8]

    A request for data.

    Request

    {
      type: string,
      index: string,
      query: {
       fields: FieldObject[],
       filter: FilterObject[] | FilterGroupObject,
        aggs: {
          values: ValueObject[]
       }
      },
      page: number,
    pageToken: string
    }
    Property/TypeDescription
    type
    String
    The type of the request. In this case, it is "select".
    index
    String
    The dataset identifier.
    query
    Object
    A query object.
    query.fields
    FieldObject[]
    An array of fields (columns) to include in the response.
    query.filter
    FilterObject[] | FilterGroupObject
    optional Query filters. The part of a query that specifies which filters should be applied to the data.
    If the server does not support multilevel hierarchies (i.e., filters.advanced is set to false), the filter's structure is an array of FilterObjects.
    If multilevel hierarchies are supported, the filter’s structure is described by the FilterGroupObject.
    query.aggs
    Object
    optional Query column totals.
    query.aggs.values
    ValueObject[]
    Columns to aggregate totals for.
    Fields with at least one supported aggregation defined in the schema can be selected for this part of the query.
    page
    Number
    Used to load data by pages when their total number can be predicted.
    Indicates which page the server should send in the next response. The page's value starts from 0.
    This property is always present in the initial request and will be included in the next /select requests while the server responses contain the pageTotal and page properties.
    Ignore this property if you don't want to load data by pages.
    pageToken
    String
    Used to load data by pages when their total number cannot be predicted.
    Indicates which page the server should send in the next response. The pageToken's value is equal to the nextPageToken sent in the previous server response.
    This property isn't present in the initial request but will be included in the next /select requests while the server responses contain the nextPageToken property.

    Response

    {
      fields: FieldObject[],
      hits: [][],
      aggs: AggregatedDataObject[],
    pageTotal: number,
      page: number,
      nextPageToken: string
    }
    Property/TypeDescription
    fields
    FieldObject[]
    Fields (columns) included in the response. Only the uniqueName property of the FieldObject should be specified in the response.
    hits
    Array of arrays
    A two-dimensional array with data. Each subarray should contain ordered values.
    aggs
    AggregatedDataObject[]
    optional Column totals.
    pageTotal
    Number
    optional The total number of pages. Used to load data by pages when their total number can be predicted.
    Must be used with the page property. To load the next pages, the component will continue sending the /select requests while the page is less than the pageTotal.
    If the number of pages cannot be predicted — use the nextPageToken property.
    page
    Number
    optional The page number requested by the component in the page property. Used to load data by pages when their total number can be predicted.
    Must be used with the pageTotal property. To load the next pages, the component will continue sending the /select requests while the page is less than the pageTotal.
    If the number of pages cannot be predicted — use the nextPageToken property.
    nextPageToken
    String
    optional Token generated by the server for loading the next page. This token will be sent in the pageToken of the next /select request. Used to load data by pages when their total number cannot be predicted. 
    To load the next pages, the component will continue sending the /select requests while the nextPageToken is present in the response.
    If the number of pages can be predicted — use the pageTotal and page properties.

    Examples

    1) Example with two fields and measures

    Request:

    {
      "index": "dataset-123",
      "type": "select",
     "query": {
      "fields": [
        {
         "uniqueName": "Country"
         },
         {
          "uniqueName": "City"
         },
         {
          "uniqueName": "Price"
         },
         {
          "uniqueName": "Quantity"
         }
       ],
       "aggs": {
         "values": [
    {
             "func": "sum", 
             "field": {
              "uniqueName": "Price"
             }
           },
    {
             "func": "sum", 
             "field": {
              "uniqueName": "Quantity"
             }
           }
    ]
       }
     },
     "page": 0
    }

    Response:

    {
      "fields": [
       { "uniqueName": "Country" },
       { "uniqueName": "City" },
       { "uniqueName": "Price" },
       { "uniqueName": "Quantity" }
     ],
     "hits": [
       ["Canada", "Toronto", 53, 2],
       ["Canada", "Montreal", 100, 1]
     ],
     "aggs": [{
       "values": {
         "price": {
           "sum": 153
         },
         "quantity": {
           "sum": 3
         }
       }
     }]
    }

    2) Example with loading data by pages using the pageTotal and page

    Initial request:

    {
    "index": "dataset-123",
    "type": "select",
    "query": {
    "fields": [
    {
    "uniqueName": "Country"
    },
    {
    "uniqueName": "Price"
    }
    ],
    "aggs": {
    "values": [
    {
    "func": "sum",
    "field": {
    "uniqueName": "Price"
    }
    }
    ]
    }
    },
    "page": 0
    }

    First response:

    {
    "fields": [
    { "uniqueName": "Country" },
    { "uniqueName": "Price" }
    ],
    "hits": [
    ["United States", 53],
    ["United States", 100],
    ["United States", 200]
    ],
    "aggs": [{
    "values": {
    "price": {
    "sum": 733
    }
    }
    }],
    "pageTotal": 2,
    "page": 0
    }

    Next request:

    {
    "index": "dataset-123",
    "type": "select",
    "query": {
    "fields": [
    {
    "uniqueName": "Country"
    },
    {
    "uniqueName": "Price"
    }
    ],
    "aggs": {
    "values": [
    {
    "func": "sum",
    "field": {
    "uniqueName": "Price"
    }
    }
    ]
    }
    },
    "page": 1
    }

    Final response:

    {
    "fields": [
    { "uniqueName": "Country" },
    { "uniqueName": "Price" }
    ],
    "hits": [
    ["United States", 132],
    ["Ukraine", 103],
    ["Israel", 145]
    ],
    "aggs": [{
    "values": {
    "price": {
    "sum": 733
    }
    }
    }],
    "pageTotal": 2,
    "page": 1
    }

    3) Example with loading data by pages using the nextPageToken

    Initial request:

    {
    "index": "dataset-123",
    "type": "select",
    "query": {
    "fields": [
    {
    "uniqueName": "Country"
    },
    {
    "uniqueName": "Price"
    }
    ],
    "aggs": {
    "values": [
    {
    "func": "sum",
    "field": {
    "uniqueName": "Price"
    }
    }
    ]
    }
    },
    "page": 0
    }

    First response:

    {
    "fields": [
    { "uniqueName": "Country" },
    { "uniqueName": "Price" }
    ],
    "hits": [
    ["United States", 53],
    ["United States", 100],
    ["United States", 200]
    ],
    "aggs": [{
    "values": {
    "price": {
    "sum": 733
    }
    }
    }],
    "nextPageToken": "secondPart"
    }

    Next request:

    {
    "index": "dataset-123",
    "type": "select",
    "query": {
    "fields": [
    {
    "uniqueName": "Country"
    },
    {
    "uniqueName": "Price"
    }
    ],
    "aggs": {
    "values": [
    {
    "func": "sum",
    "field": {
    "uniqueName": "Price"
    }
    }
    ]
    }
    },
    "pageToken": "secondPart"
    }

    Final response:

    {
    "fields": [
    { "uniqueName": "Country" },
    { "uniqueName": "Price" }
    ],
    "hits": [
    ["United States", 132],
    ["Ukraine", 103],
    ["Israel", 145]
    ],
    "aggs": [{
    "values": {
    "price": {
    "sum": 733
    }
    }
    }]
    }

    See also

    /handshake request
    /fields request
    /members request
    /select request for pivot table
    /select request for drill-through view