Response Model

Retrieving Responses

For a polling project fielded through pollable a user can retrieve the individual responses using the response API. You must be authenticated to use all response methods. To get the responses for a given project the following request is used. Note that the response is paginated.

GET /projects/1/responses HTTP/1.1
Host: example.com
Accept: application/json, text/javascript, text/csv
Authorization: Bearer "eyCJhYCQ...

Response:

{
  "data": [
    {
      "id": 31,
      "object": "response",
      "response": "Example short text answer.",
      "component": {
        "id": 1,
        "object": "component",
        "key": "field0ShortText",
        "type": "component",
        "label": "Question 1",
        "created": "2018-09-30T17:11:01.255827+00:00",
        "links": {
          "self": "/components/1"
        }
      },
      "project_id": 1,
      "created": "2018-09-30T17:18:52.560055+00:00",
      "links": {
        "self": "/responses/1"
      }
    }
  ],
  "links": {
    "collection": "/responses"
  },
  "object": "list",
  "has_more": false
}

We can see that the response for Question 1 is Example short text answer..

Representations

Not that the response API can return json responses through the Accept: application/json but csv and text representations as well through Accept: text/csv.

Retrieving response counts

Many times we do not want all bulk responses but instead counts of individual response types. This is possible through the following request.

GET /projects/1/responses/agg HTTP/1.1
Host: example.com
Accept: application/json, text/javascript, text/csv
Authorization: Bearer "eyCJhYCQ...

Response:

{
  "object": "count",
  "counts": {
    "data": [
      {
        "object": "response",
        "count": 1,
        "response": "A"
      }
    ],
    "links": {
      "collection": "/projects/<int:project_id>/responses/agg"
    },
    "has_more": false,
    "object": "list"
  },
  "component": {
    "id": 15,
    "object": "component",
    "key": "field2Select",
    "type": "Select",
    "label": "Question 3",
    "created": "2018-11-05T02:48:44.694227+00:00",
    "links": {
      "self": "/components/15"
    }
  }
}