> ## 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 Trend

> # Description

Get trend analysis data for questions.

# Payload

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

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 Test or Question Loops. Optional.
* `type`: Type of trend data to get the analysis data. It can be one of the following: `hourly`, `daily`, `monthly` and `yearly`. **Required**.

# Response 

## 200 OK

```json
{
  "projectId": "string",
  "fromDate": "date (string)",
  "toDate": "date (string)",
  "dateFilters": array,
  "filter": array,
  "responses": {
     "q000000000000000000000000": object,
     "q000000000000000000000001": 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 trend analysis data for every question.

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

## 401 Unauthorized
> Invalid authorization.

## 404 Not Found
> Resource not found.

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

# Description

Get trend analysis data for questions.

# Payload

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

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 Test or Question Loops. Optional.
* `type`: Type of trend data to get the analysis data. It can be one of the following: `hourly`, `daily`, `monthly` and `yearly`. **Required**.

# Response

## 200 OK

```json theme={null}
{
  "projectId": "string",
  "fromDate": "date (string)",
  "toDate": "date (string)",
  "dateFilters": array,
  "filter": array,
  "responses": {
     "q000000000000000000000000": object,
     "q000000000000000000000001": 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 trend analysis data for every question.

## 400 Bad Request

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

## 401 Unauthorized

> Invalid authorization.

## 404 Not Found

> Resource not found.

## 500 Internal Server Error

> Error occurred in the service.


## OpenAPI

````yaml POST /scale-scale-service/trend/{projectId}
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:
  /scale-scale-service/trend/{projectId}:
    post:
      summary: Fetch Analysis Trend
      description: >-
        # Description


        Get trend analysis data for questions.


        # Payload


        ```json

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

        ```


        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 Test or Question Loops. Optional.

        * `type`: Type of trend data to get the analysis data. It can be one of
        the following: `hourly`, `daily`, `monthly` and `yearly`. **Required**.


        # Response 


        ## 200 OK


        ```json

        {
          "projectId": "string",
          "fromDate": "date (string)",
          "toDate": "date (string)",
          "dateFilters": array,
          "filter": array,
          "responses": {
             "q000000000000000000000000": object,
             "q000000000000000000000001": 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 trend
        analysis data for every question.


        ## 400 Bad Request

        > Missing or invalid `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-trend-post-scale-scale-service-trend-projectid
      parameters:
        - name: Authorization
          in: header
          required: true
          description: Authorization token
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
            example:
              fromDate: '2020-01-01'
              toDate: '2022-12-31'
              filter: []
              type: hourly
      responses:
        '200':
          description: Fetch Analysis Trend
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              example:
                projectId: 60de2ba329a7230061e209f6
                fromDate: '2020-01-01'
                toDate: '2022-12-31'
                filter: []
                dateFilter:
                  startDate: '2020-01-01'
                  endDate: '2022-12-31'
                responses:
                  60de3451ffcabb005be29743:
                    - x: '2021-07-01T16:00:00.000Z'
                      mean: '5.50'
                      min: 0
                      max: 10
                    - x: '2021-07-01T17:00:00.000Z'
                      mean: '5.00'
                      min: 0
                      max: 10
                    - x: '2021-07-01T22:00:00.000Z'
                      mean: 0
                      min: 0
                      max: 10
                  60de3451ffcabb005be29744:
                    - x: '2021-07-01T16:00:00.000Z'
                      mean: '6.00'
                      min: 0
                      max: 10
                    - x: '2021-07-01T17:00:00.000Z'
                      mean: 0
                      min: 0
                      max: 10
                    - x: '2021-07-01T22:00:00.000Z'
                      mean: 0
                      min: 0
                      max: 10
                  60de3451ffcabb005be29745:
                    - x: '2021-07-01T16:00:00.000Z'
                      mean: '4.50'
                      min: 0
                      max: 10
                    - x: '2021-07-01T17:00:00.000Z'
                      mean: 0
                      min: 0
                      max: 10
                    - x: '2021-07-01T22:00:00.000Z'
                      mean: 0
                      min: 0
                      max: 10
                  60de3451ffcabb005be29746:
                    - x: '2021-07-01T16:00:00.000Z'
                      mean: '9.00'
                      min: 0
                      max: 10
                    - x: '2021-07-01T17:00:00.000Z'
                      mean: '5.00'
                      min: 0
                      max: 10
                    - x: '2021-07-01T22:00:00.000Z'
                      mean: '9.00'
                      min: 0
                      max: 10
                  60de3451ffcabb005be29747:
                    - x: '2021-07-01T16:00:00.000Z'
                      mean: 0
                      min: 0
                      max: 10
                    - x: '2021-07-01T17:00:00.000Z'
                      mean: 0
                      min: 0
                      max: 10
                    - x: '2021-07-01T22:00:00.000Z'
                      mean: 0
                      min: 0
                      max: 10
                  60de3528ffcabb005be29839:
                    - x: '2021-07-01T16:00:00.000Z'
                      mean: '5.00'
                      min: 0
                      max: 10
                    - x: '2021-07-01T17:00:00.000Z'
                      mean: '4.00'
                      min: 0
                      max: 10
                    - x: '2021-07-01T22:00:00.000Z'
                      mean: '2.00'
                      min: 0
                      max: 10
                  60de3564ffcabb005be29b0b:
                    - x: '2021-07-01T16:00:00.000Z'
                      mean: '7.20'
                      min: 0
                      max: 10
                    - x: '2021-07-01T17:00:00.000Z'
                      mean: '6.00'
                      min: 0
                      max: 10
                    - x: '2021-07-01T22:00:00.000Z'
                      mean: '5.00'
                      min: 0
                      max: 10
                  60de3564ffcabb005be29b1c:
                    - x: '2021-07-01T16:00:00.000Z'
                      mean: '6.20'
                      min: 0
                      max: 10
                    - x: '2021-07-01T17:00:00.000Z'
                      mean: '6.50'
                      min: 0
                      max: 10
                    - x: '2021-07-01T22:00:00.000Z'
                      mean: '9.00'
                      min: 0
                      max: 10
                  60de355bffcabb005be29ad7:
                    - x: '2021-07-01T16:00:00.000Z'
                      mean: '8.00'
                      min: 0
                      max: 10
                    - x: '2021-07-01T17:00:00.000Z'
                      mean: '5.00'
                      min: 0
                      max: 10
                    - x: '2021-07-01T22:00:00.000Z'
                      mean: 0
                      min: 0
                      max: 10
                  60de3564ffcabb005be29b2e:
                    - x: '2021-07-01T16:00:00.000Z'
                      mean: '5.40'
                      min: 0
                      max: 10
                    - x: '2021-07-01T17:00:00.000Z'
                      mean: '6.00'
                      min: 0
                      max: 10
                    - x: '2021-07-01T22:00:00.000Z'
                      mean: '9.00'
                      min: 0
                      max: 10
                  60de3564ffcabb005be29b3f:
                    - x: '2021-07-01T16:00:00.000Z'
                      mean: '6.25'
                      min: 0
                      max: 10
                    - x: '2021-07-01T17:00:00.000Z'
                      mean: 0
                      min: 0
                      max: 10
                    - x: '2021-07-01T22:00:00.000Z'
                      mean: '4.00'
                      min: 0
                      max: 10
                  60de3564ffcabb005be29b50:
                    - x: '2021-07-01T16:00:00.000Z'
                      mean: '2.50'
                      min: 0
                      max: 10
                    - x: '2021-07-01T17:00:00.000Z'
                      mean: '7.00'
                      min: 0
                      max: 10
                    - x: '2021-07-01T22:00:00.000Z'
                      mean: '7.00'
                      min: 0
                      max: 10
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal server error
      servers:
        - url: https://scale-analysis.sightx.io
components:
  securitySchemes:
    AuthorizationHeader:
      type: apiKey
      in: header
      name: Authorization
      description: Access token obtained from the m2m-token endpoint.

````