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

# Get next page

> # Description

Get the next page of a survey

## Request payload

```json
{
  "answers": {},
  "currentPage": "number",
  "userData": "string",
  "path": array of numbers,
}
```

where:

- `answers`: answers object (see [Answers object](#answers-object))
- `currentPage`: number of the page that is shown
- `userData`: encrypted user information and memory, should be it exactly as the last call returns of this or the "Get survey first page" endpoints
- `path`: an array of the current pages values that where displayed, included the current one

### Answers object

The answers object should have all the answers that the user selected so far, the API consumer has to remove the ones that doesn't apply in case of going back to a previous page.

```json
{
  "questionId1": {},
  "questionId2": {},
  "questionId3": {},
  "questionId4": {},
}
```

where:

- `questionId*`: is the question id which the asnwer belong, and the value is an answer object (see [Answer object](#answer-object))

### Answer object

The answer object depends on the type of question, the posible objects are:

#### For MC (including country and state from contact info) questions:

```json
{
  "na": boolean,
  "values": array of numbers
}
```

where:

- `na`: is true if the user selected the NA option
- `values`: should be an array with all the positions of the answers selected by the user

#### For Grid (basic grid, including nps, max diff and max diff experiment) questions:

```json
{
  "na": boolean,
  "values": {
      "rowPosition": array of numbers
      "rowPosition": array of numbers
  }
}
```

where:

- `na`: is true if the user selected the NA option
- `rowPosition`: should be the position of the row which the values belong, for example `{ 1: [1,2], 2: [3], 3: [1] }`
- `values`: should be an array with all the positions of the answers selected by the user


#### For numeric/text entry questions:

```json
{
  "na": boolean,
  "value": number/string
}
```

where:

- `na`: is true if the user selected the NA option
- `value`: value typed by the user

#### For Constant sum questions:

```json
{
  "na": boolean,
  "values": {
      "rowPosition": number
      "rowPosition": number
  }
}
```

where:

- `na`: is true if the user selected the NA option
- `rowPosition`: should be the position of the row which the value belong, for example `{ 1: 1, 2: 10.6, 3: 90 }`
- `value`: value typed by the user

#### For Rank Order questions:

```json
{
  "na": boolean,
  "values": [
      {
          "selection": number,
          "option": number,
      },
      {
          "selection": number,
          "option": number,
      },
      {
          "selection": number,
          "option": number,
      },
      ...
  ]
}
```

where:

- `na`: is true if the user selected the NA option
- `values`: array with the options that where selected and the other of selection, `selection` is the postion where the option was put  and `option` is the option that where selected


#### For Contact info questions:

```json
{
  "na": boolean,
  "values": {
      "addressLine1": string,
      "addressLine2": string,
      "email": string,
      "firstName": string,
      "lastName": string,
      "phone": string,
      "zipCode": string,
  }
}
```

where:

- `na`: is true if the user selected the NA option
- `values.addressLine1`: Address line 1
- `values.addressLine2`: Address line 2
- `values.email`: valid email
- `values.firstName`: first name
- `values.lastName`: last name
- `values.phone`: phone number, should be formated as \[+\]\[country code\]\[area code\]\[local phone number\] (without te brackets)
- `values.zipCode`: valid zip code, only apply for US

#### For date questions:

```json
{
  "na": boolean,
  "value": string
}
```

where:

- `na`: is true if the user selected the NA option
- `value`: date formated as "YYYY-MM-DDTHH:mm:ss[+/-]HH:mm", has to include the time zone (without the brackets, for example "2021-01-03T00:00:00-05:00")

#### For conjoint questions:

```json
{
  "na": boolean,
  "values": {
      "pageIndex": {
          cards: array of cards objects
      },
      "pageIndex": {
          cards: array of cards objects
      },
      "pageIndex": {
          cards: cards objects
      }
  }
}
```

where:

- `na`: is true if the user selected the NA option
- `values`: object of conjoint pages shown indexed by the pageIndex of the conjoint experiment, the pageIndex is zero based
- `cards`: object of cards that were shown indexed by the pageCardIndex and which one was selected (see [Card object](#card-object)), the pageCardIndex is zero based


<a name="card-object"></a>

##### Card object

```json
{
    "attributes": {},
    "group": number,
    "selected": boolean
}
```

where:

- `attributes`: object of atribute positions shown in the card indexed by the attributeIndex, the attributeIndex is zero based
- `group`: group number of the card
- `selected`: true if the card was selected, only one of the cards on each cards page can be selected

## Response

Codes: 
- 200: in case there is a page to show
- 404: project or campaign does not exists
- 409: in case of quotas exceded, recipient already submit a response
- 422: in case of a validations of the submited answers fails

```json
{
  "page": page object,
  "currentPage": int,
  "customization": customization object,
  "totalPages": int,
  "projectTitle": string,
  "projectId": "string",
  "clientTimezone": "string",
  "userData": string,
}
```

The response payload has the same specifications as the "Get survey first page" endpoint

# Description

Get the next page of a survey

## Request payload

```json theme={null}
{
  "answers": {},
  "currentPage": "number",
  "userData": "string",
  "path": array of numbers,
}
```

where:

* `answers`: answers object (see [Answers object](#answers-object))
* `currentPage`: number of the page that is shown
* `userData`: encrypted user information and memory, should be it exactly as the last call returns of this or the "Get survey first page" endpoints
* `path`: an array of the current pages values that where displayed, included the current one

### Answers object

The answers object should have all the answers that the user selected so far, the API consumer has to remove the ones that doesn't apply in case of going back to a previous page.

```json theme={null}
{
  "questionId1": {},
  "questionId2": {},
  "questionId3": {},
  "questionId4": {},
}
```

where:

* `questionId*`: is the question id which the asnwer belong, and the value is an answer object (see [Answer object](#answer-object))

### Answer object

The answer object depends on the type of question, the posible objects are:

#### For MC (including country and state from contact info) questions:

```json theme={null}
{
  "na": boolean,
  "values": array of numbers
}
```

where:

* `na`: is true if the user selected the NA option
* `values`: should be an array with all the positions of the answers selected by the user

#### For Grid (basic grid, including nps, max diff and max diff experiment) questions:

```json theme={null}
{
  "na": boolean,
  "values": {
      "rowPosition": array of numbers
      "rowPosition": array of numbers
  }
}
```

where:

* `na`: is true if the user selected the NA option
* `rowPosition`: should be the position of the row which the values belong, for example `{ 1: [1,2], 2: [3], 3: [1] }`
* `values`: should be an array with all the positions of the answers selected by the user

#### For numeric/text entry questions:

```json theme={null}
{
  "na": boolean,
  "value": number/string
}
```

where:

* `na`: is true if the user selected the NA option
* `value`: value typed by the user

#### For Constant sum questions:

```json theme={null}
{
  "na": boolean,
  "values": {
      "rowPosition": number
      "rowPosition": number
  }
}
```

where:

* `na`: is true if the user selected the NA option
* `rowPosition`: should be the position of the row which the value belong, for example `{ 1: 1, 2: 10.6, 3: 90 }`
* `value`: value typed by the user

#### For Rank Order questions:

```json theme={null}
{
  "na": boolean,
  "values": [
      {
          "selection": number,
          "option": number,
      },
      {
          "selection": number,
          "option": number,
      },
      {
          "selection": number,
          "option": number,
      },
      ...
  ]
}
```

where:

* `na`: is true if the user selected the NA option
* `values`: array with the options that where selected and the other of selection, `selection` is the postion where the option was put  and `option` is the option that where selected

#### For Contact info questions:

```json theme={null}
{
  "na": boolean,
  "values": {
      "addressLine1": string,
      "addressLine2": string,
      "email": string,
      "firstName": string,
      "lastName": string,
      "phone": string,
      "zipCode": string,
  }
}
```

where:

* `na`: is true if the user selected the NA option
* `values.addressLine1`: Address line 1
* `values.addressLine2`: Address line 2
* `values.email`: valid email
* `values.firstName`: first name
* `values.lastName`: last name
* `values.phone`: phone number, should be formated as \[+]\[country code]\[area code]\[local phone number] (without te brackets)
* `values.zipCode`: valid zip code, only apply for US

#### For date questions:

```json theme={null}
{
  "na": boolean,
  "value": string
}
```

where:

* `na`: is true if the user selected the NA option
* `value`: date formated as "YYYY-MM-DDTHH:mm:ss\[+/-]HH:mm", has to include the time zone (without the brackets, for example "2021-01-03T00:00:00-05:00")

#### For conjoint questions:

```json theme={null}
{
  "na": boolean,
  "values": {
      "pageIndex": {
          cards: array of cards objects
      },
      "pageIndex": {
          cards: array of cards objects
      },
      "pageIndex": {
          cards: cards objects
      }
  }
}
```

where:

* `na`: is true if the user selected the NA option
* `values`: object of conjoint pages shown indexed by the pageIndex of the conjoint experiment, the pageIndex is zero based
* `cards`: object of cards that were shown indexed by the pageCardIndex and which one was selected (see [Card object](#card-object)), the pageCardIndex is zero based

<a name="card-object" />

##### Card object

```json theme={null}
{
    "attributes": {},
    "group": number,
    "selected": boolean
}
```

where:

* `attributes`: object of atribute positions shown in the card indexed by the attributeIndex, the attributeIndex is zero based
* `group`: group number of the card
* `selected`: true if the card was selected, only one of the cards on each cards page can be selected

## Response

Codes:

* 200: in case there is a page to show
* 404: project or campaign does not exists
* 409: in case of quotas exceded, recipient already submit a response
* 422: in case of a validations of the submited answers fails

```json theme={null}
{
  "page": page object,
  "currentPage": int,
  "customization": customization object,
  "totalPages": int,
  "projectTitle": string,
  "projectId": "string",
  "clientTimezone": "string",
  "userData": string,
}
```

The response payload has the same specifications as the "Get survey first page" endpoint


## OpenAPI

````yaml POST /api/next
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:
  /api/next:
    post:
      summary: Get next page
      description: >-
        # Description


        Get the next page of a survey


        ## Request payload


        ```json

        {
          "answers": {},
          "currentPage": "number",
          "userData": "string",
          "path": array of numbers,
        }

        ```


        where:


        - `answers`: answers object (see [Answers object](#answers-object))

        - `currentPage`: number of the page that is shown

        - `userData`: encrypted user information and memory, should be it
        exactly as the last call returns of this or the "Get survey first page"
        endpoints

        - `path`: an array of the current pages values that where displayed,
        included the current one


        ### Answers object


        The answers object should have all the answers that the user selected so
        far, the API consumer has to remove the ones that doesn't apply in case
        of going back to a previous page.


        ```json

        {
          "questionId1": {},
          "questionId2": {},
          "questionId3": {},
          "questionId4": {},
        }

        ```


        where:


        - `questionId*`: is the question id which the asnwer belong, and the
        value is an answer object (see [Answer object](#answer-object))


        ### Answer object


        The answer object depends on the type of question, the posible objects
        are:


        #### For MC (including country and state from contact info) questions:


        ```json

        {
          "na": boolean,
          "values": array of numbers
        }

        ```


        where:


        - `na`: is true if the user selected the NA option

        - `values`: should be an array with all the positions of the answers
        selected by the user


        #### For Grid (basic grid, including nps, max diff and max diff
        experiment) questions:


        ```json

        {
          "na": boolean,
          "values": {
              "rowPosition": array of numbers
              "rowPosition": array of numbers
          }
        }

        ```


        where:


        - `na`: is true if the user selected the NA option

        - `rowPosition`: should be the position of the row which the values
        belong, for example `{ 1: [1,2], 2: [3], 3: [1] }`

        - `values`: should be an array with all the positions of the answers
        selected by the user



        #### For numeric/text entry questions:


        ```json

        {
          "na": boolean,
          "value": number/string
        }

        ```


        where:


        - `na`: is true if the user selected the NA option

        - `value`: value typed by the user


        #### For Constant sum questions:


        ```json

        {
          "na": boolean,
          "values": {
              "rowPosition": number
              "rowPosition": number
          }
        }

        ```


        where:


        - `na`: is true if the user selected the NA option

        - `rowPosition`: should be the position of the row which the value
        belong, for example `{ 1: 1, 2: 10.6, 3: 90 }`

        - `value`: value typed by the user


        #### For Rank Order questions:


        ```json

        {
          "na": boolean,
          "values": [
              {
                  "selection": number,
                  "option": number,
              },
              {
                  "selection": number,
                  "option": number,
              },
              {
                  "selection": number,
                  "option": number,
              },
              ...
          ]
        }

        ```


        where:


        - `na`: is true if the user selected the NA option

        - `values`: array with the options that where selected and the other of
        selection, `selection` is the postion where the option was put  and
        `option` is the option that where selected



        #### For Contact info questions:


        ```json

        {
          "na": boolean,
          "values": {
              "addressLine1": string,
              "addressLine2": string,
              "email": string,
              "firstName": string,
              "lastName": string,
              "phone": string,
              "zipCode": string,
          }
        }

        ```


        where:


        - `na`: is true if the user selected the NA option

        - `values.addressLine1`: Address line 1

        - `values.addressLine2`: Address line 2

        - `values.email`: valid email

        - `values.firstName`: first name

        - `values.lastName`: last name

        - `values.phone`: phone number, should be formated as \[+\]\[country
        code\]\[area code\]\[local phone number\] (without te brackets)

        - `values.zipCode`: valid zip code, only apply for US


        #### For date questions:


        ```json

        {
          "na": boolean,
          "value": string
        }

        ```


        where:


        - `na`: is true if the user selected the NA option

        - `value`: date formated as "YYYY-MM-DDTHH:mm:ss[+/-]HH:mm", has to
        include the time zone (without the brackets, for example
        "2021-01-03T00:00:00-05:00")


        #### For conjoint questions:


        ```json

        {
          "na": boolean,
          "values": {
              "pageIndex": {
                  cards: array of cards objects
              },
              "pageIndex": {
                  cards: array of cards objects
              },
              "pageIndex": {
                  cards: cards objects
              }
          }
        }

        ```


        where:


        - `na`: is true if the user selected the NA option

        - `values`: object of conjoint pages shown indexed by the pageIndex of
        the conjoint experiment, the pageIndex is zero based

        - `cards`: object of cards that were shown indexed by the pageCardIndex
        and which one was selected (see [Card object](#card-object)), the
        pageCardIndex is zero based



        <a name="card-object"></a>


        ##### Card object


        ```json

        {
            "attributes": {},
            "group": number,
            "selected": boolean
        }

        ```


        where:


        - `attributes`: object of atribute positions shown in the card indexed
        by the attributeIndex, the attributeIndex is zero based

        - `group`: group number of the card

        - `selected`: true if the card was selected, only one of the cards on
        each cards page can be selected


        ## Response


        Codes: 

        - 200: in case there is a page to show

        - 404: project or campaign does not exists

        - 409: in case of quotas exceded, recipient already submit a response

        - 422: in case of a validations of the submited answers fails


        ```json

        {
          "page": page object,
          "currentPage": int,
          "customization": customization object,
          "totalPages": int,
          "projectTitle": string,
          "projectId": "string",
          "clientTimezone": "string",
          "userData": string,
        }

        ```


        The response payload has the same specifications as the "Get survey
        first page" endpoint
      operationId: get-next-page-post-api-next
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
      responses:
        '200':
          description: Successful response
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal server error
      servers:
        - url: https://survey-service.sightx.io
components:
  securitySchemes:
    AuthorizationHeader:
      type: apiKey
      in: header
      name: Authorization
      description: Access token obtained from the m2m-token endpoint.

````