# Response chains

## Response chains

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

Gets responses grouped by a single respondent.

#### Query Parameters

| Name              | Type   | Description                                         |
| ----------------- | ------ | --------------------------------------------------- |
| skip              | number | No. of documents to skip from the start             |
| createdTo         | string | Filter by unix timestamp, ending at given value     |
| createdFrom       | string | Filter by unix timestamp, starting from given value |
| touchpointId      | string | Filter by touchpoint id                             |
| surveyId          | string | Filter by survey ids                                |
| preferredLanguage | string | Preferred language to show the question titles in   |

#### 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": "5979be93d296f3dbf83fb056",
        "surveyId": "59788132f870b600018d6dda",
        "touchpointId": "59529fbef3774c0001a49708",
        "touchpointName": "My touchpoint",
        "createdAt": 1501150867,
        "createdAtDate": "2017-07-27T10:21:07.619Z",
        "teamId": "5dc56d54b7c935069aefa9e2",
        "teamName": "My team name",
        "metadata": {
            "customerId": "34tNa31"
        },
        "language": "en",
        "responses": [
            {
                "question": "How likely are you to recommend us to your friend or colleague?",
                "answer": 2,
                "valueNum": 2,
                "language": "en",
                "questionType": "NPS",
                "questionId": "5978813ab9215744ea08e463",
                "surveyId": "59788132f870b600018d6dda"
            },
            {
                "question": "Could you specify what was bad in your experience?",
                "answer": "Your office branch was unclean.",
                "valueString": "Your office branch was unclean.",
                "language": "en",
                "questionType": "Text",
                "questionId": "597881a4b9215744ea08e464",
                "surveyId": "59788132f870b600018d6dda"
            }
        ]
     }
    ],
    "paging": {
        "next": "https://api.feedbackly.com/v5/response-chains?skip=200",
        "previous": "https://api.feedbackly.com/v5/response-chains?skip=0"
  }
}
```

{% endtab %}
{% endtabs %}

### Return type description

| Field  | Type                                                              | Example | Description                            |
| ------ | ----------------------------------------------------------------- | ------- | -------------------------------------- |
| data   | [Response chain data](#response-chain-data-object) \[]            |         | Response chain with embedded responses |
| paging | [Pagination](https://docs.feedbackly.com/master/notes#pagination) |         | Pagination object                      |

## Response chain by id

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

Gets an individual response chain by id

#### Path Parameters

| Name | Type   | Description              |
| ---- | ------ | ------------------------ |
| id   | string | Id of the response chain |

#### Query Parameters

| Name              | Type   | Description                                       |
| ----------------- | ------ | ------------------------------------------------- |
| preferredLanguage | string | Preferred language to show the question titles in |

#### Headers

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

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

```
{
    "_id": "5979be93d296f3dbf83fb056",
    "surveyId": "59788132f870b600018d6dda",
    "touchpointId": "59529fbef3774c0001a49708",
    "touchpointName": "My touchpoint",
    "createdAt": 1501150867,
    "createdAtDate": "2017-07-27T10:21:07.619Z",
    "teamId": "5dc56d54b7c935069aefa9e2",
    "teamName": "My team name",
    "metadata": {
        "customerId": "34tNa31"
    },
    "language": "en",
    "responses": [
        {
            "question": "How likely are you to recommend us to your friend or colleague?",
            "answer": 2,
            "valueNum": 2,
            "language": "en",
            "questionType": "NPS",
            "questionId": "5978813ab9215744ea08e463",
            "surveyId": "59788132f870b600018d6dda"
        },
        {
            "question": "Could you specify what was bad in your experience?",
            "answer": "Your office branch was unclean.",
            "valueString": "Your office branch was unclean.",
            "language": "en",
            "questionType": "Text",
            "questionId": "597881a4b9215744ea08e464",
            "surveyId": "59788132f870b600018d6dda"
        }
    ]
}
```

{% endtab %}

{% tab title="400 " %}

```
{error: "Not a valid response id    Error id : 1583413424996/E5ohOOdp."}
```

{% endtab %}

{% tab title="404 If the provided id is not found" %}

```
{error: "Not found"}
```

{% endtab %}
{% endtabs %}

### Response chain data object

| Field           | Type                                                                      | Example                            | Description                                                              |
| --------------- | ------------------------------------------------------------------------- | ---------------------------------- | ------------------------------------------------------------------------ |
| touchpointName  | string                                                                    | Touchpoint 1                       | Touch point name                                                         |
| responseChainId | string                                                                    | "507f1f77bcf86cd799439013"         | Id of the full response chain the response belongs to                    |
| teamId          | string                                                                    | "507f1f77bcf86cd799439013"         | Team's id                                                                |
| metadata        | { \[key: string]: string}                                                 | {phone: "iPhone X"}                | metadata attached to response                                            |
| createdAtDate   | string                                                                    | "2017-03-27T09:03:59.133Z"         | Response's date in Javascript format                                     |
| createdAt       | number                                                                    | 1490605439                         | Response's date in UNIX timestamp                                        |
| touchpointId    | string                                                                    | "507f1f77bcf86cd799439013"         | Touchpoint's id                                                          |
| \_id            | string                                                                    | "507f1f77bcf86cd799439013"         | id of the response                                                       |
| language        | string                                                                    | "en"                               | language the response is given in                                        |
| teamName        | string                                                                    | "My team"                          | Team's name                                                              |
| data            | array                                                                     |                                    | Responses within the response chain                                      |
| > answer        | string \| string\[] \| number                                             | 0.5, "Apple", \["Apple", "Orange"] | Mixed-type field related to question type                                |
| > questionType  | "Button" \| "NPS" \| "Word" \| "Slider" \| "Contact" \| "Text" \| "Image" | "Button"                           | [Question type](https://docs.feedbackly.com/master/notes#question-types) |
| > fieldId?      | string                                                                    | "507f1f77bcf86cd799439013"         | Field id (used in Contact and Slider question types)                     |
| > valueString?  | string                                                                    | "Orange"                           | String value of the response                                             |
| > valueArray?   | string\[]                                                                 | \["aoudfsa", "sidfvcx"]            | The technical id of the given responses (Word/Image)                     |
| > valueNum      | number                                                                    | 0.5                                | Number value of the response                                             |
| > questionId    | string                                                                    | "507f1f77bcf86cd799439013"         | Question's id                                                            |
| > question      | string                                                                    | "How did we succeed today?"        | The title of the question in the preferred language (if available)       |
| > fieldName     | string                                                                    | "Email"                            | Field name (used in Contact and Slider)                                  |
| > tags          | string\[]                                                                 | \["CSAT"]                          | Question tags  set in the survey editor                                  |
