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

# Fetch Analysis (grid, maxdiff basic, nps)

> # Description

Ranking analysis data for rank questions.

# Payload

```json
{
    "fromDate": string,
    "toDate": string,
    "filter": array,
    "groups": object
    "aggregateOptions": object
}
```

where:

* `fromDate`: start date in ISO format. **Required**.
* `toDate`: end date in ISO format. **Required**.
* `filter`: array of filters to filter the responses. Optional.
* `groups`: Object indexed by question id with a `q` as prefix. Every key has assigned an array with the question ids with `q` prefix that are the same question through different concepts inside a concept test. Only needed for project with Concept Tests or Question Loops (Optional). Some keys are post indexed with `_1`, `_2`, etc. These represent groups for each row of the grid question. Optional.
* `aggregateOptions`: Buckets to create. Optional.

# Response 

## 200 OK

```json
{
  "projectId": string,
  "fromDate": string,
  "toDate": string,
  "filter": array,
  "dateFilters": [
    {
      "collection": string,
      "start": string,
      "end": string
    }
  ],
  "responses": object,
  "naResponses": object,
  "responsesCounter": number,
  "responsesCounters": {
    "qQuestionId": {
      "rowPosition": number,
      "question": number
    }
  },
  "transposedResponses": object,
  "transposedNaResponses": object
}
```
where:

* `projectId`: unique identifier of the project.
* `fromDate`: start date received as param to the query in ISO format.
* `toDate`: end date received as param to the query in ISO format.
* `dateFilters`: Array of date filters used for querying the responses.
* `filter`: Array of filters sent in the request.
* `responses`: object mapping unique question identifiers to analysis data for every question.
* `responsesCounter`: Integer representing the number of responses for the given filter.
* `naResponses`: Has the same format as `responses`. It contains data for questions that have an N/A column.
* `responsesCounters`: Integer representing the number of responses per question for the given filter.
* `transposedNaResponses`: Transposed data for questions that have an N/A column.
* `transposedResponses`: Transposed object mapping unique question identifiers to analysis data for every question.

## 400 Bad Request
> Missing or invalid `projectId`/`fromDate`/`toDate` fields.

## 401 Unauthorized
> Invalid authorization.

## 404 Not Found
> Resource not found.

## 500 Internal Server Error
> Error occurred in the service.

# Description

Ranking analysis data for rank questions.

# Payload

```json theme={null}
{
    "fromDate": string,
    "toDate": string,
    "filter": array,
    "groups": object
    "aggregateOptions": object
}
```

where:

* `fromDate`: start date in ISO format. **Required**.
* `toDate`: end date in ISO format. **Required**.
* `filter`: array of filters to filter the responses. Optional.
* `groups`: Object indexed by question id with a `q` as prefix. Every key has assigned an array with the question ids with `q` prefix that are the same question through different concepts inside a concept test. Only needed for project with Concept Tests or Question Loops (Optional). Some keys are post indexed with `_1`, `_2`, etc. These represent groups for each row of the grid question. Optional.
* `aggregateOptions`: Buckets to create. Optional.

# Response

## 200 OK

```json theme={null}
{
  "projectId": string,
  "fromDate": string,
  "toDate": string,
  "filter": array,
  "dateFilters": [
    {
      "collection": string,
      "start": string,
      "end": string
    }
  ],
  "responses": object,
  "naResponses": object,
  "responsesCounter": number,
  "responsesCounters": {
    "qQuestionId": {
      "rowPosition": number,
      "question": number
    }
  },
  "transposedResponses": object,
  "transposedNaResponses": object
}
```

where:

* `projectId`: unique identifier of the project.
* `fromDate`: start date received as param to the query in ISO format.
* `toDate`: end date received as param to the query in ISO format.
* `dateFilters`: Array of date filters used for querying the responses.
* `filter`: Array of filters sent in the request.
* `responses`: object mapping unique question identifiers to analysis data for every question.
* `responsesCounter`: Integer representing the number of responses for the given filter.
* `naResponses`: Has the same format as `responses`. It contains data for questions that have an N/A column.
* `responsesCounters`: Integer representing the number of responses per question for the given filter.
* `transposedNaResponses`: Transposed data for questions that have an N/A column.
* `transposedResponses`: Transposed object mapping unique question identifiers to analysis data for every question.

## 400 Bad Request

> Missing or invalid `projectId`/`fromDate`/`toDate` fields.

## 401 Unauthorized

> Invalid authorization.

## 404 Not Found

> Resource not found.

## 500 Internal Server Error

> Error occurred in the service.

##### Query Parameters

| Parameter   | Description | Required | Example |
| ----------- | ----------- | -------- | ------- |
| `projectId` | —           | No       | —       |


## OpenAPI

````yaml POST /grid-analysis-service/analysis
openapi: 3.0.3
info:
  title: SightX API
  version: 1.0.0
  description: >-
    SightX REST API documentation. Most responses are JSON; some export
    endpoints return files. API access is a paid add-on — contact
    sales@sightx.io for details.
servers:
  - url: https://auth.admin.sightx.io
    description: Authentication (Production)
  - url: https://auth.staging-admin.sightx.io
    description: Authentication (Staging)
security:
  - AuthorizationHeader: []
paths:
  /grid-analysis-service/analysis:
    post:
      summary: Fetch Analysis (grid, maxdiff basic, nps)
      description: >-
        # Description


        Ranking analysis data for rank questions.


        # Payload


        ```json

        {
            "fromDate": string,
            "toDate": string,
            "filter": array,
            "groups": object
            "aggregateOptions": object
        }

        ```


        where:


        * `fromDate`: start date in ISO format. **Required**.

        * `toDate`: end date in ISO format. **Required**.

        * `filter`: array of filters to filter the responses. Optional.

        * `groups`: Object indexed by question id with a `q` as prefix. Every
        key has assigned an array with the question ids with `q` prefix that are
        the same question through different concepts inside a concept test. Only
        needed for project with Concept Tests or Question Loops (Optional). Some
        keys are post indexed with `_1`, `_2`, etc. These represent groups for
        each row of the grid question. Optional.

        * `aggregateOptions`: Buckets to create. Optional.


        # Response 


        ## 200 OK


        ```json

        {
          "projectId": string,
          "fromDate": string,
          "toDate": string,
          "filter": array,
          "dateFilters": [
            {
              "collection": string,
              "start": string,
              "end": string
            }
          ],
          "responses": object,
          "naResponses": object,
          "responsesCounter": number,
          "responsesCounters": {
            "qQuestionId": {
              "rowPosition": number,
              "question": number
            }
          },
          "transposedResponses": object,
          "transposedNaResponses": object
        }

        ```

        where:


        * `projectId`: unique identifier of the project.

        * `fromDate`: start date received as param to the query in ISO format.

        * `toDate`: end date received as param to the query in ISO format.

        * `dateFilters`: Array of date filters used for querying the responses.

        * `filter`: Array of filters sent in the request.

        * `responses`: object mapping unique question identifiers to analysis
        data for every question.

        * `responsesCounter`: Integer representing the number of responses for
        the given filter.

        * `naResponses`: Has the same format as `responses`. It contains data
        for questions that have an N/A column.

        * `responsesCounters`: Integer representing the number of responses per
        question for the given filter.

        * `transposedNaResponses`: Transposed data for questions that have an
        N/A column.

        * `transposedResponses`: Transposed object mapping unique question
        identifiers to analysis data for every question.


        ## 400 Bad Request

        > Missing or invalid `projectId`/`fromDate`/`toDate` fields.


        ## 401 Unauthorized

        > Invalid authorization.


        ## 404 Not Found

        > Resource not found.


        ## 500 Internal Server Error

        > Error occurred in the service.
      operationId: >-
        fetch-analysis-grid-maxdiff-basic-nps-post-grid-analysis-service-analysis
      parameters:
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
        - name: projectId
          in: query
          required: false
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              fromDate: '2019-01-01'
              toDate: '2022-12-31'
              filter: []
              groups:
                qQuestionId:
                  - qQuestionId2
              aggregateOptions: {}
      responses:
        '200':
          description: Fetch Analysis
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              example:
                projectId: 60de2ba329a7230061e209f6
                fromDate: '2019-01-01'
                toDate: '2022-12-31'
                filter: []
                dateFilters:
                  - collection: year
                    start: '2019-01-01'
                    end: '2022-12-31'
                responses:
                  q5d8e7fe176332600131cxxxx: {}
                naResponses:
                  q5d8e7fe176332600131cxxxx: {}
                responsesCounter: 8
                responsesCounters: {}
                transposedResponses:
                  q5d8e7fe176332600131cxxxx: {}
                transposedNaResponses:
                  q5d8e7fe176332600131cxxxx: {}
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal server error
      servers:
        - url: https://grid-analysis.sightx.io
components:
  securitySchemes:
    AuthorizationHeader:
      type: apiKey
      in: header
      name: Authorization
      description: Access token obtained from the m2m-token endpoint.

````