> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Execute a query on the database.

> Execute a query on the database, on a given table, via POST method. The query can be paginated using the parameters page and pageSize.



## OpenAPI

````yaml engine/rest/6.2.2/openapi.json POST /activeviam/database/rest/v10/data/tables/{tableName}
openapi: 3.1.0
info:
  title: Atoti REST services
  version: 6.2.2-SNAPSHOT
servers:
  - description: The Atoti Server instance to query, over HTTPS
    url: https://{host}
    variables:
      host:
        default: my-atoti-server:9090
        description: Host and port of your Atoti Server instance
  - description: The Atoti Server instance to query, over plain HTTP
    url: http://{host}
    variables:
      host:
        default: my-atoti-server:9090
        description: Host and port of your Atoti Server instance
security: []
tags:
  - description: Implementation of the REST API controller for an ActivePivot database.
    name: Database REST API
  - description: >
      GetAggregatesQuery (GAQ) REST API for executing OLAP queries.


      This API provides a programmatic way to execute GetAggregatesQuery
      operations

      against Atoti cubes. Results are returned in Apache Arrow format for
      efficient

      data transfer and processing.


      **Note:** This API is experimental and may change in future versions
      without notice.
    name: GAQ Query REST API
  - description: >
      XML for Analysis (XMLA) endpoint for executing MDX queries and OLAP
      discovery operations.


      This endpoint implements the XMLA protocol which is used by:

      - Microsoft Excel and other OLAP clients

      - Custom BI tools that support XMLA connectivity


      The endpoint supports both text XML and binary XML formats for improved
      performance.
    name: XMLA API
  - description: Definition of REST API to query data from ActivePivot (V10).
    name: Query REST API (V10)
  - description: Definition of REST API to query data from ActivePivot (V9).
    name: Query REST API (V9)
  - description: Implementation of the REST Bulk API of the content server (version 8).
    name: Bulk REST API
  - description: Implementation of the REST API of the content server.
    name: Content Server REST API
  - description: Implementation of the REST API controller for an ActivePivot database.
    name: Database REST API v9
  - description: ' Definition of the REST service returning the list of services exposed by an application.'
    name: Version REST API
  - description: Rest Service providing the discovery information.
    name: Discovery REST API
  - description: >-
      Endpoints for Atoti Auto-Explain, which explains how a measure varies
      between two members by attributing the variation to the hierarchies that
      drive it.
    name: Auto-Explain
  - description: JSON Web Token (JWT) endpoint.
    name: JWT API
  - description: >
      Endpoints to retrieve and manage query history.


      **Note:** This API is experimental and may change in future versions
      without notice.
    name: Query History REST API (Experimental)
  - description: Description of REST API to configure an ActivePivot application.
    name: Configuration REST API
  - description: API to export the result of MDX queries
    name: Data Export
  - description: >
      GetAggregatesQuery (GAQ) REST API for executing OLAP queries.


      This API provides a programmatic way to execute GetAggregatesQuery
      operations

      against Atoti cubes. Results and updates are streamed in Apache Arrow
      format for efficient

      data transfer and processing.
    name: Continuous GAQ Query REST API
  - description: Endpoints of the Atoti BI adapter.
    name: BI Adapter REST API
  - description: Endpoints for AI-based optimization of Atoti cubes
    name: AI Optimizer
  - description: Implementation of the REST Bulk API of the content server.
    name: Bulk REST API
paths:
  /activeviam/database/rest/v10/data/tables/{tableName}:
    post:
      tags:
        - Database REST API
      summary: Execute a query on the database.
      description: >-
        Execute a query on the database, on a given table, via POST method. The
        query can be paginated using the parameters page and pageSize.
      operationId: queryDatabase_1
      parameters:
        - description: Desired table name.
          in: path
          name: tableName
          required: true
          schema:
            default: ''
            type: string
        - description: Action flag to indicate a query on this table.
          in: query
          name: queryAction
          required: true
          schema:
            default: ''
            enum:
              - count
              - select
            type: string
        - description: The page to return. First page (and default) is 1.
          in: query
          name: page
          required: false
          schema:
            default: ''
            type: string
        - description: The maximum number of rows in the page. Default is 100.
          in: query
          name: pageSize
          required: false
          schema:
            default: ''
            type: string
        - in: query
          name: query
          required: false
          schema:
            default: ignored
            type: string
      requestBody:
        content:
          application/json:
            examples:
              $in operator for lists:
                description: $in operator for lists
                value:
                  conditions:
                    year:
                      $in:
                        - 2010
                        - 2011
              $like operator on strings:
                description: $like operator on strings
                value:
                  conditions:
                    currency:
                      $like: U
              Basic query:
                description: Basic query
                value:
                  branch: master
                  conditions:
                    currency: EUR
                    year: 2010
                  epoch: 185
                  fields:
                    - City
                    - CounterParty
                    - Rating
                  timeout: 30000
              Comparison operators ($eq, $lt, $lte, $gt, $gte):
                description: Comparison operators ($eq, $lt, $lte, $gt, $gte)
                value:
                  conditions:
                    year:
                      $lt: 2018
              Logical operators ($or, $and, $not):
                description: Logical operators ($or, $and, $not)
                value:
                  conditions:
                    $or:
                      - year: 2010
                      - id:
                          $lt: 15000
                    currency: EUR
            schema:
              $ref: '#/components/schemas/JsonDatabaseQuery'
              additionalProperties:
                default: ''
              default: ''
        description: Query parameters in JSON format.
        required: true
      responses:
        '200':
          content:
            application/json:
              examples:
                Success:
                  description: Success
                  value:
                    epoch: 185
                    headers:
                      - name: Id
                        type: long
                      - name: ProductId
                        type: int
                      - name: Desk
                        type: String
                    pagination:
                      currentPage: 2
                      nextPage: 3
                      nextPageUrl: /data/tables/myTable?pageSize=20&page=3
                      previousPage: 1
                      previousPageUrl: /data/tables/myTable?pageSize=20&page=1
                    rows:
                      - - 100001
                        - 128
                        - DeskA
                      - - 100001
                        - 128
                        - DeskA
                      - - 100002
                        - 64
                        - DeskB
              schema:
                $ref: '#/components/schemas/JsonDatabaseQueryResult'
                additionalProperties:
                  default: ''
                default: ''
          description: Query executed successfully.
components:
  schemas:
    JsonDatabaseQuery:
      properties:
        branch:
          type: string
        conditions:
          $ref: '#/components/schemas/JsonNode'
        distinct:
          type: boolean
        epoch:
          format: int64
          type: integer
        fields:
          items:
            type: string
          type: array
        page:
          format: int32
          type: integer
        pageSize:
          format: int32
          type: integer
        timeout:
          format: int64
          type: integer
      type: object
    JsonDatabaseQueryResult:
      properties:
        epoch:
          format: int64
          type: integer
        headers:
          items:
            $ref: '#/components/schemas/JsonTabularHeader'
          type: array
        pagination:
          $ref: '#/components/schemas/JsonPagination'
        rows:
          items:
            items: {}
            type: array
          type: array
      type: object
    JsonNode:
      properties:
        array:
          type: boolean
        bigDecimal:
          type: boolean
        bigInteger:
          type: boolean
        binary:
          type: boolean
        boolean:
          type: boolean
        container:
          type: boolean
        double:
          type: boolean
        embeddedValue:
          type: boolean
        empty:
          type: boolean
        float:
          type: boolean
        floatingPointNumber:
          type: boolean
        int:
          type: boolean
        integralNumber:
          type: boolean
        long:
          type: boolean
        missingNode:
          type: boolean
        nodeType:
          enum:
            - ARRAY
            - BINARY
            - BOOLEAN
            - MISSING
            - 'NULL'
            - NUMBER
            - OBJECT
            - POJO
            - STRING
          type: string
        'null':
          type: boolean
        number:
          type: boolean
        object:
          type: boolean
        pojo:
          type: boolean
        short:
          type: boolean
        string:
          type: boolean
        textual:
          deprecated: true
          type: boolean
        valueNode:
          type: boolean
      type: object
    JsonTabularHeader:
      properties:
        caption:
          type: string
        name:
          type: string
        type:
          type: string
        visible:
          type: boolean
      type: object
    JsonPagination:
      properties:
        currentPage:
          format: int32
          type: integer
        nextPage:
          format: int32
          type: integer
        nextPageUrl:
          type: string
        previousPage:
          format: int32
          type: integer
        previousPageUrl:
          type: string
      type: object

````