Need a special offer?Find out if your project fits.
+
All documentation
API reference
  • API Reference for older versions
  • /select request for the drill-through view

    [starting from version: 2.8]

    A request for data.

    Request

    {
      "type": string,
      "index": string,
      "query": {
        "fields": FieldObject[],
        "filter": FilterObject[] | FilterGroupObject,
        "limit": number
      },
      "page": number,
      "pageToken": string
    }
    Property/Type Description
    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 can be:
    • An array of FilterObjects — when your server implements the custom data source API version between 2.8.5 and 2.8.21.
    • The FilterGroupObject — when your server implements the custom data source API version 2.8.22 or later.
    See how to check your version of the custom data source API.
    query.limit
    Number
    The maximum number of records that should be included in the response. Can be configured in Flexmonster.
    Default value: 1000.
    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": [][],
      "pageTotal": number,
      "page": number,
      "nextPageToken": string
    }
    Property/Type Description
    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.
    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"
           }
         ],
        "filter"[]: {
           "field": {
            "uniqueName": "Country"
           }, 
           "include": [
      {
      "member": "Canada"
      }
      ]
         },
         "limit": 1000
       },
       "page": 0
      }
      Response:
      {
        "fields": [
          { "uniqueName": "Country" },
          { "uniqueName": "City" },
          { "uniqueName": "Price" },
          { "uniqueName": "Quantity" }
        ],
        "hits": [
          ["Canada", "Toronto", 53, 2],
          ["Canada", "Montreal", 100, 1]
        ]
      }
    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"
      }
      ],
      "filter"[]: {
      "field": {
      "uniqueName": "Country"
      },
      "include": [
      {
      "member": "United States"
      }
      ]
      },
      "limit": 1000
      },
      "page": 0
      }
      First response:
      {
      "fields": [
      { "uniqueName": "Country" },
      { "uniqueName": "Price" }
      ],
      "hits": [
      ["United States", 53],
      ["United States", 100],
      ],
      "pageTotal": 2,
      "page": 0
      }
      Next request:
      {
      "index": "dataset-123",
      "type": "select",
      "query": {
      "fields": [
      {
      "uniqueName": "Country"
      },
      {
      "uniqueName": "Price"
      }
      ],
      "include": [
      {
      "member": "United States"
      }
      ],
      "limit": 1000
      },
      "page": 1
      }
      Final response:
      {
      "fields": [
      { "uniqueName": "Country" },
      { "uniqueName": "Price" }
      ],
      "hits": [
      ["United States", 200],
      ["United States", 132]
      ],
      "pageTotal": 2,
      "page": 1
      }
    3. Example with loading data by parts using the nextPageToken
      Initial request:
      {
      "index": "dataset-123",
      "type": "select",
      "query": {
      "fields": [
      {
      "uniqueName": "Country"
      },
      {
      "uniqueName": "Price"
      }
      ],
      "filter"[]: {
      "field": {
      "uniqueName": "Country"
      },
      "include": [
      {
      "member": "United States"
      }
      ]
      },
      "limit": 1000
      },
      "page": 0
      }
      First response:
      {
      "fields": [
      { "uniqueName": "Country" },
      { "uniqueName": "Price" }
      ],
      "hits": [
      ["United States", 53],
      ["United States", 100],
      ],
      "nextPageToken": "secondPart"
      }
      Next request:
      {
      "index": "dataset-123",
      "type": "select",
      "query": {
      "fields": [
      {
      "uniqueName": "Country"
      },
      {
      "uniqueName": "Price"
      }
      ],
      "include": [
      {
      "member": "United States"
      }
      ],
      "limit": 1000
      },
      "pageToken": "secondPart"
      }
      Final response:
      {
      "fields": [
      { "uniqueName": "Country" },
      { "uniqueName": "Price" }
      ],
      "hits": [
      ["United States", 200],
      ["United States", 132]
      ]
      }

    See also

    /handshake request
    /fields request
    /members request
    /select request for pivot table
    /select request for flat table