Supported Formats

JSON, XML

GET api/v1/questionnaires/:id
Questionnaire details

The following questionnaire fields are returned:

id

unique identifier of a questionnaire

url

API URL path of questionnaire details

title

title of the questionnaire (translated where available)

language

current language (given as ISO code)

languages

all available languages (given as array of ISO codes)

status

one of 'Active' or 'Closed'

activated_on

date when questionnaire was activated

questionnaire_date

date set by administrator

respondents

array of respondents and the completion status

Supported Formats

JSON, XML

Errors

400 Bad Request
401 Unauthorized
404 Not Found
422 Unprocessable Entity
500 Internal Server Error

Examples

{
  "questionnaire":{
    "id":16,
    "url":"/api/v1/questionnaires/16",
    "title":"Biennial Report",
    "language":"EN",
    "languages":["EN"],
    "status":"Active",
    "activated_on":"2015-04-16",
    "questionnaire_date":"2015-01-01",
    "respondents":[
      {
        "respondent":{
          "id":92,
          "user_id":16,
          "full_name":"Party: AAA",
          "status":"Underway"
        }
      },{
        "respondent":{
          "id":100,
          "user_id":2,
          "full_name":"Party: BBB",
          "status":"Underway"
        }
      }
    ]
  }
}
<questionnaire>
  <id>16</id>
  <url>/api/v1/questionnaires/16</url>
  <title>Biennial Report</title>
  <language>EN</language>
  <languages>["EN"]</languages>
  <status>Active</status>
  <activated_on>2015-04-16</activated_on>
  <questionnaire_date>2015-01-01</questionnaire_date>
  <respondents>
    <respondent>
      <id>92</id>
      <user_id>16</user_id>
      <full_name>Party: AAA</full_name>
      <status>Underway</status>
    </respondent>
    <respondent>
      <id>100</id>
      <user_id>2</user_id>
      <full_name>Party: BBB</full_name>
      <status>Submitted</status>
    </respondent>
  </respondents>
</questionnaire>

Params

Param name Description
id
required

Id of the questionnaire


Value:

Must be String

language
optional

Where available display data in language given by ISO code (e.g. “EN”). Defaults to questionnaire's default language.


Value:

Must be String


GET api/v1/questionnaires
List of questionnaires

The following questionnaire fields are returned:

[id] unique identifier of a questionnaire
[url] API URL path of questionnaire details
[title] title of the questionnaire (translated where available)
[language] current language (given as ISO code)
[languages] all available languages (given as array of ISO codes)
[status] one of 'Active' or 'Closed'
[activated_on] date when questionnaire was activated
[questionnaire_date] date set by administrator
[respondents] array of respondents and the completion status

Where more than 100 questionnaires are returned, the request is paginated, showing 100 objects (or less by passing in an optional 'per_page' parameter) at a time. To fetch the remaining objects, you will need to make a new request and pass the optional ‘page’ parameter as below:

http://ors-api-host/api/v1/questionnaires?page=2&per_page=25

Information about the remaining pages is provided in the Link header of the API response. For example, making the above request for page two, with a limit of 25 objects per page would return the following in the link header along with a total-count header:

Link: <http://ors-api-host/api/v1/questionnaires?page=3&per_page=25>; rel="next", <http://ors-api-host/api/v1/questionnaires?page=2570&per_page=25>; rel="last"
Total-Count: 64230

If there are additional pages, the link header will contain the URL for the next page of results, followed by the URL for the last page of results. The Total-Count header shows the total number of objects returned for this call, regardless of pagination.

Supported Formats

JSON, XML

Errors

400 Bad Request
401 Unauthorized
404 Not Found
422 Unprocessable Entity
500 Internal Server Error

Examples

{
  "questionnaires":[
    {
    "questionnaire":{
      "id":16,
      "url":"/api/v1/questionnaires/16",
      "title":"Biennial Report",
      "language":"EN",
      "languages":["EN"],
      "status":"Active",
      "activated_on":"2015-04-16",
      "questionnaire_date":"2015-01-01",
      "respondents":[
        {
          "respondent":{
            "id":92,
            "user_id":16,
            "full_name":"Party: AAA",
            "status":"Underway"
          }
        },{
          "respondent":{
            "id":100,
            "user_id":2,
            "full_name":"Party: BBB",
            "status":"Underway"
          }
        }
      ]
    }
  }

  ]
}
<questionnaires>
  <questionnaire>
    <id>16</id>
    <url>/api/v1/questionnaires/16</url>
    <title>Biennial Report</title>
    <language>EN</language>
    <languages>["EN"]</languages>
    <status>Active</status>
    <activated_on>2015-04-16</activated_on>
    <questionnaire_date>2015-01-01</questionnaire_date>
    <respondents>
      <respondent>
        <id>92</id>
        <user_id>16</user_id>
        <full_name>Party: AAA</full_name>
        <status>Underway</status>
      </respondent>
      <respondent>
        <id>100</id>
        <user_id>2</user_id>
        <full_name>Party: BBB</full_name>
        <status>Submitted</status>
      </respondent>
    </respondents>
  </questionnaire>

</questionnaires>

Params

Param name Description
page
optional

Page number for paginated responses.


Value:

Must be String

per_page
optional

How many objects returned per page for paginated responses (#{MAX_PER_PAGE} by default)


Value:

Must be String

language
optional

Where available display data in language given by ISO code (e.g. “EN”). Defaults to questionnaire's default language.


Value:

Must be String