# Questions

## Questions

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5/questions`

This endpoint returns the questions of all surveys accessable from your account

#### Query Parameters

| Name              | Type   | Description                                                                                                                                             |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| skip              | number | Number of documents to skip from the start                                                                                                              |
| preferredLanguage | string | Preferred language to show the question titles in eg. 'en'. If the specified language is not available, it will default to the first available language |
| questionId        | array  | Filter by question ids                                                                                                                                  |
| surveyId          | array  | Survey ids related to the question                                                                                                                      |

#### Headers

| Name          | Type   | Description                                                                                          |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Authorization | string | <p>Authentication token to access the API eg:<br>'Authorization': 'ey0iuefg.834xcunerun348efnsd'</p> |

{% tabs %}
{% tab title="200 " %}

```
{
    "data": [
        {
            "_id": "59b8de984084087cd3346743",
            "title": "Which meat did you buy?",
            "choicesString": [
                "Lamb",
                "Beef",
                "Pork"
            ],
            "questionType": "Word",
            "languages": [
                "en"
            ],
            "language": "en",
            "choices": [
                {
                    "fieldId": "1",
                    "fieldName": "Lamb"
                },
                {
                    "fieldId": "59b8deaa4084087cd3346744",
                    "fieldName": "Beef"
                },
                {
                    "fieldId": "59b8deac4084087cd3346745",
                    "fieldName": "Pork"
                }
            ],
            "surveyId": "59b8de18784d2f0001a1590d"
        },
    ],
    "paging": {
        "next": "https://api.feedbackly.com/v5/questions?preferredLanguage=en&skip=100",
        "previous": null
    }
}
```

{% endtab %}
{% endtabs %}

### Request Return type

| Field  | Type                                                              | Example | Description       |
| ------ | ----------------------------------------------------------------- | ------- | ----------------- |
| data   | [Question Data object](#question-data-object) \[]                 |         | Question objects  |
| paging | [Pagination](https://docs.feedbackly.com/master/notes#pagination) |         | Pagination object |

## Question by id

<mark style="color:blue;">`GET`</mark> `https://api.feedbackly.com/v5/questions/:id`

Gets a specific question by id

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | Question id |

#### Query Parameters

| Name              | Type   | Description                                                                                                                                             |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| preferredLanguage | string | Preferred language to show the question titles in eg. 'en'. If the specified language is not available, it will default to the first available language |

#### Headers

| Name          | Type   | Description                                                                                |
| ------------- | ------ | ------------------------------------------------------------------------------------------ |
| Authorization | string | Authentication token to access the API eg: 'Authorization': 'ey0iuefg.834xcunerun348efnsd' |

{% tabs %}
{% tab title="200 " %}

```
{
    "_id": "58d8d547b8c71e000e3824fc",
    "title": "How likely are you to recommend us to a friend or colleague?",
    "subtitle": "0=Not likely at all 10=Extremely likely",
    "choicesString": [],
    "questionType": "NPS",
    "languages": [
        "en",
        "es",
        "af"
    ],
    "language": "en",
    "choices": [],
    "surveyId": "58d8d3d14cb016000e203e0e"
}
```

{% endtab %}

{% tab title="401 " %}

```
{
    "error": "Question inaccessible    Error id : 1583414902648/mOXsfkd7."
}
```

{% endtab %}
{% endtabs %}

### Question data object

| Field         | Type      | Example                       | Description                                                                   |
| ------------- | --------- | ----------------------------- | ----------------------------------------------------------------------------- |
| choicesString | string\[] | \["Lamb", "Beef", "Pork"]     | List of available choices in the preferred language (Word/Image)              |
| title         | string    | "Which meat did you buy?"     | Question title in the preferred language                                      |
| questionType  | string    | "Button"                      | See [question types](https://docs.feedbackly.com/master/notes#question-types) |
| \_id          | string    | "59b8de18784d2f0001a1590d"    | Question id                                                                   |
| languages     | string\[] | \["en", "es"]                 | List of available languages for the question                                  |
| language      | string    | "en"                          | The language currently selected to display titles etc                         |
| subtitle?     | string    | "Please select from below"    | A subtitle for the question (if specified)                                    |
| choices       | array     |                               | Array of possible choices                                                     |
| > fieldId     | string    | "1"                           | The id of the field                                                           |
| > fieldName   | string    | "Beef"                        | The label of the choice                                                       |
| > type?       | string    | "string"                      | Type of field (Contact question type)                                         |
| > subType?    | string    | "phone"                       | Subtype of the field (Contact question type)                                  |
| > imageUrl?   | string    | "<https://example.com/1.png>" | Image url of the choice (Image question type)                                 |
