Rest - Contacts - Participants - Questionnaires: Difference between revisions

From Views API Documentation
Jump to navigation Jump to search
(Created page with "==Purpose== Used for submitting answer sets to questionnaires against participants and for retrieving the details of answered questionnaires that have been submitted against ...")
 
Line 1: Line 1:
==Purpose==
==Purpose==


Used for submitting answer sets to questionnaires against participants and for retrieving the details of answered questionnaires that have been submitted against a participant.
Used for submitting answer sets to questionnaires against participants and for retrieving the details of answered questionnaires that have been submitted against a participant. This is only really a filtered version of the [[Rest - Evidence - Questionnaires - Answers|Questionnaires - Answers API]]


===Base URL===
===Base URL===

Revision as of 10:33, 3 August 2012

Purpose

Used for submitting answer sets to questionnaires against participants and for retrieving the details of answered questionnaires that have been submitted against a participant. This is only really a filtered version of the Questionnaires - Answers API

Base URL

http://app.views.coop/api/restful/contacts/participants/<id>/questionnaires

  • id - This is the participant id

Schema

For details of the schemas, please refer to Rest - Evidence - Questionnaires - Answers

Fetching a list of answer sets

The default call will return a list of questionnaires (answer sets) that have been recorded against the participant

curl --url <Base URL> -u<username>:<password> -H Content-Type:text/xml

This will return data similar to the following:

<answersets count="7">
    <answerset id="1" questionnaireid="14">
        <EntityType>Person</EntityType>
        <EntityID>1</EntityID>
        <Date>2012-07-31T10:00:00</Date>
        <QuestionnaireID>14</QuestionnaireID>
        <AnswerSetID>1</AnswerSetID>
        <Questionnaire>Impact</Questionnaire>
    </answerset>
    <answerset id="4" questionnaireid="5">
        <EntityType>Person</EntityType>
        <EntityID>1</EntityID>
        <Date>2012-05-04T10:11:00</Date>
        <QuestionnaireID>14</QuestionnaireID>
        <AnswerSetID>4</AnswerSetID>
        <Questionnaire>Interests</Questionnaire>
    </answerset>
    ...
</answersets>

If you are only interested in a particular questionnaire, you should us the following:

curl --url <Base URL>/<questionnairId> -u<username>:<password> -H Content-Type:text/xml

This will return data similar to the following:

<answersets count="2">
    <answerset id="1" questionnaireid="14">
        <EntityType>Person</EntityType>
        <EntityID>1</EntityID>
        <Date>2012-07-31T10:00:00</Date>
        <QuestionnaireID>14</QuestionnaireID>
        <AnswerSetID>1</AnswerSetID>
        <Questionnaire>Impact</Questionnaire>
    </answerset>
    <answerset id="6" questionnaireid="14">
        <EntityType>Person</EntityType>
        <EntityID>1</EntityID>
        <Date>2012-05-02T09:10:00</Date>
        <QuestionnaireID>14</QuestionnaireID>
        <AnswerSetID>6</AnswerSetID>
        <Questionnaire>Impact</Questionnaire>
    </answerset>
</answersets>

The results are order by the most recent first. This means to get the latest version of a questionnaire, you would only need to fetch the first result.