Developer's API Archives | SnapSurveys Support documentation for Snap Surveys products Wed, 30 Oct 2024 10:40:24 +0000 en-GB hourly 1 https://wordpress.org/?v=6.4.5 https://www.snapsurveys.com/support-snapxmp/wp-content/uploads/2020/07/favicon-32x32-1.png Developer's API Archives | SnapSurveys 32 32 Recommended use of the API progress token https://www.snapsurveys.com/support-snapxmp/snapxmp/recommended-use-of-the-api-progress-token/ Wed, 30 Oct 2024 10:40:22 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=12536 You can retrieve a survey’s responses using the Get Survey Responses endpoint. There are 2 approaches to retrieving the survey responses: Use of the API is chargeable. The charge is 0.1 unit each time the API delivers a survey response.  This applies if you use the API to retrieve the same survey response multiple times. […]

The post Recommended use of the API progress token appeared first on SnapSurveys.

]]>
You can retrieve a survey’s responses using the Get Survey Responses endpoint.

There are 2 approaches to retrieving the survey responses:

  • Our recommended approach, which is to use the startingFrom token so you only get the responses that have been submitted or modified since your last call.
  • Get all the responses each call and you will be charged for each response for every call.

Use of the API is chargeable. The charge is 0.1 unit each time the API delivers a survey response.  This applies if you use the API to retrieve the same survey response multiple times.

Comparing unit usage

This table compares the number of units that when getting all the responses with getting the responses using the progress token, which is our recommended approach. This comparison shows the results for a survey that receives 100 responses per day, and the organisation gets the responses once per day.

Using the progress token uses far fewer units, reduces network traffic and provide a faster response.

DayResponses received per dayResponses delivered by getting all responses each dayUnits used per day (0.1 unit per response)Responses delivered using the API progress token each dayUnits used per day(0.1 unit per response)
11001001010010
21002002010010
31003003010010
41004004010010
51005005010010
61006006010010
71007007010010
Totals700280028070070

Recommended approach

Using our recommended approach, you can retrieve only the latest responses since the last call was made. This is done by using the startingFrom parameter in the Get Survey Responses call. When you make a call to get the responses, this returns a progress token, which will need to be stored. This is a mark in the data file for where the call got up to. The next time you make the call, pass this progress token in as the startingFrom point, and then only new data is returned.

Step 1: Make the first request for the survey’s responses

When you make the first call to request the survey’s responses, set the startingFrom parameter to 0.

This retrieves all the requested survey responses.

Optional parameter settings will affect the requested survey responses. For example:

  • If you include a filter, this will be all the survey responses that match the filter.
  • If you set a maximum number of responses, e.g. maxResponses=100, this will be the first 100 responses.
  • If you set restricted variables, this will return only the specified variables rather than all the variables in the survey.

This is an example of a request that retrieves the specified data from all the survey responses by using startingFrom=0. (In the code, you need to replace {APIKEY} with your actual API key and {USERNAME} with your actual username.)

curl --location --request GET 'https://<servername>/snaponline/api/surveys/c23a0fd8-6219-4130-a6a7-f312829e56eb/responses?maxResponses=100&restrictedVariables= V16,V45~V47&returnUniqueIds=true&useCodeLabels=true&startingFrom=0' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2.0' \
--data-raw ''

Step 2: Receive the response containing the survey’s responses

This is an example of the response to the request for the survey responses. This contains the survey responses in the responses return item, and the progress token in the progress return item.

200 OK with body:

{
    "surveyId": "6834a5f1-46e5-4b12-9e0c-a38a3d9be12c",
    "filter": "Q1&gt;1",
    "startingFrom": "0",
    "progress": "#IBCGEGG",
    "upToDate": "false",
    "responses": &#91;
        {
            "status": "new",
            "caseId": "8e4591b0-c1e3-4612-88b4-7b96cd28dd2d",
            "variables": &#91;
                {
                    "id": "V46",
                    "v": "Plane"
                },
                {
                    "id": "V48",
                    "v": "\"Restaurant / Cafe\",\"Gift Shop\",\"Customer Services\""
                },
                {
                    "id": "V52",
                    "s": "NR"
                }
            ]
        },
        {
            "status": "new",
            "caseId": "5458bfcb-97df-4326-879d-4868406761ae",
            "variables": &#91;
                {
                    "id": "V46",
                    "v": "Bike"
                },
                {
                    "id": "V48",
                    "v": "\"Gift Shop\""
                },
                {
                    "id": "V52",
                    "v": "Very busy."
                }
            ]
        }
    ]
}

Step 3: Store the progress token for the next call

In the sample response in Step 2, ‘progress’ represents where you have got to in the data file.

“progress”: “#IBCGEGG”

Store the progress token to use in the next survey response request.

Step 4: Use the progress token in the next request

The progress token from the previous response is then used as the startingFrom value in the next Get Survey Responses request, to retrieve responses that have been submitted or modified since your last call.

This is an example that uses the progress token in the startingFrom parameter.

curl --location --request GET 'https://<servername>/snaponline/api/surveys/c23a0fd8-6219-4130-a6a7-f312829e56eb/responses?maxResponses=100&restrictedVariables= V16,V45~V47&returnUniqueIds=true&useCodeLabels=true&startingFrom=#IBCGEGG' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2.0' \
--data-raw ''

Using Max Responses

Max responses is optional and can be used in combination with the progress token. Use the ‘upToDate’ value to decide if you have more responses to get, then use the progress token to get the next group of survey responses. If you know the number of survey responses for each call is never going to exceed the limit of 5000, then you can exclude this parameter.

The post Recommended use of the API progress token appeared first on SnapSurveys.

]]>
Get Participant https://www.snapsurveys.com/support-snapxmp/snapxmp/api-get-participant/ Mon, 17 Oct 2022 10:30:08 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=8118 Get the details of a participant of a survey. Endpoint Method               Url GET surveys/{surveyId}/participants/{participantUniqueId} Get details of the specific participant identified by the participantUniqueId path variable of the specific survey identified by the surveyId path variable. Parameters Path parameters Path parameter Description {surveyId} The id of the survey. This is the survey GUID and not […]

The post Get Participant appeared first on SnapSurveys.

]]>
Get the details of a participant of a survey.

Endpoint

Method               Url
GETsurveys/{surveyId}/participants/{participantUniqueId}

Get details of the specific participant identified by the participantUniqueId path variable of the specific survey identified by the surveyId path variable.

Parameters

Path parameters

Path parameter Description
{surveyId}The id of the survey. This is the survey GUID and not the Interview URL.
{participantUniqueId}The participantUniqueId is either the login name if a logged in survey or else the email address.

Query string parameters

None

Sample Request

curl --location --request GET 'https:// <servername>/snaponline/api/surveys/20dbe888-ec99-4895-b094-e34084f9408f/participants/A' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2'

(In the above code, replace {APIKEY} with your actual API key and {USERNAME} with your actual username.)

Sample Responses

The response structure is determined by the participant feature configuration of the survey. This is shown in the participant import wizard of Snap Online.

If the configuration has “Allow Snap Online to track respondents” ticked it is a logged on survey and a “loginSection” will be included. If the configuration has “Send email invites / reminders” ticked then an “invitationSection” will be included.

The “invitationSection” will always include an “inviteSeeding” section even if there isn’t any seeding.

The “loginSection” will always have a “questionnaireSeeding” section even if there isn’t any seeding.

If the configuration has “Group Questionnaire” ticked then there will be one or more subjects inside the “loginSection” section and each “subjectName” property will be a non empty string.

If the configuration does not have “Group Questionnaire” ticked then there will be exactly one subject inside the “loginSection” section and the “subjectName” property will be an empty string.

200 OK with body (invite only participant with some invite seeding):

{
    "invitationSection": {
        "optedOut": false,
        "sendInvitations": true,
        "emailAddress": "a@example.com",
        "invitationSeeding": {
            "forenames": "A",
            "surname": "A"
        }
    },    
    "enabled": true
}

200 OK with body (log on and invite participant – group questionnaire):

{
    "invitationSection": {
        "optedOut": false,
        "sendInvitations": true,
        "emailAddress": "a@example.com",
        "invitationSeeding": {
            "forenames": "A",
            "surname": "A"
        }
    },
    "loginSection": {
        "login": "A",
        "password": null,
        "interviewer": null,
        "status": "NotStarted",
        "subjects": [
            {
                "subjectName": "L1",
                "questionnaireSeeding": {
                    "v53": "L1",
                    "v48": "2;3",
                    "v50": "A",
                    "v51": "A",
                    "v46": "4"
                },
                "status": "NotStarted"
            }
        ]
    },
    "enabled": true
}

Response Definitions

Response Item Description Data Type
enabledWhether the participant is enabled.Boolean
invitationSectionThe invitation section for an invited survey participant. Section will be omitted if not an invited survey.Object
invitationSection/optedOutWhether invitations are to be sent.Boolean
invitationSection/sendInvitationsWhether the user is opted out from emails.Boolean
invitationSection/emailAddressThe email address.String
invitationSection/inviteSeedingThe invite seeding.   This is a dictionary of properties in the form “<invite key>” : “<value>”Object
loginSectionThe login section for a logged on survey participant. Section will be omitted if not a logged on survey.Object
loginSection/loginIf a logged on survey this will be the login name otherwise null.String or null
loginSection/passwordIf a logged on survey and a password is required this will be the password otherwise null or “”.String or null
loginSection/interviewerIf the survey allows synchronisation of participants with SOI but the API user does not have “Manage participants for SOI” permission this will be null. If survey does not allow synchronisation of participants to SOI this will be null. If the survey allows synchronisation of participants to SOI and the API user has “Manage participants for SOI” permission this will be either “” signifying that all interviewers will have access or an email address of the interviewer.String or null
loginSection/statusThis is the overall status.   If the survey is a logged on but not a group questionnaire, then this is the status of the participant.   If the survey is a logged on and group questionnaire, then this is the overall status for the participant across all the questionnaires.   If the survey is invite only then the status will be null.

String or null:  
For non group questionnaire:  
“NotStarted” – the participant has not started the questionnaire.
“Started” the participant has started the questionnaire.
“Partial” – a partial response has been taken.
“Saved” – the participant has saved the questionnaire.
“Completed” – the participant has completed the questionnaire.
“Submitted” – the researcher has submitted a partial response.  
For group questionnaire:  
“NotStarted” – the participant has not started any of the questionnaires.
“Started” – the participant has started at least one of the questionnaires.
“Completed” – the participant has completed all of the questionnaires. This includes whether a researcher submitted a partial.
loginSection/subjectsThe subjects for the participant.   For a group questionnaire there will be one or more. For a non-group questionnaire there will just be one.List
loginSection/subjects/subjectNameFor a group questionnaire subject name will not be an empty string.   For a non group questionnaire the subject name must be an empty string.String
loginSection/subjects/ questionnaireSeedingThe questionnaire seeding for the subject.   This is a dictionary of properties in the form “<variable V number>” : “<value>”.Object
loginSection/subjects/statusThis is the subject status.

 
String or null:  
“NotStarted” – the participant has not started the questionnaire.
“Started” the participant has started the questionnaire.
“Partial” – a partial response has been taken.
“Saved” – the participant has saved the questionnaire.
“Completed” – the participant has completed the questionnaire.
“Submitted” – the researcher has submitted a partial response.  

HTTP Status Codes

200 OK

404 Not Found

Other API calls

The post Get Participant appeared first on SnapSurveys.

]]>
Get Participant List https://www.snapsurveys.com/support-snapxmp/snapxmp/api-get-participant-list/ Mon, 17 Oct 2022 10:24:03 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=8116 Get the details of the latest participants of a survey. Endpoint Method               Url GET surveys/{surveyId}/participants Get the details of latest participants of the specific survey identified by the surveyId path variable. Parameters Path parameters Path parameter Description {surveyId} The id of the survey. This is the survey GUID and not the Interview URL. Query string […]

The post Get Participant List appeared first on SnapSurveys.

]]>
Get the details of the latest participants of a survey.

Endpoint

Method               Url
GETsurveys/{surveyId}/participants

Get the details of latest participants of the specific survey identified by the surveyId path variable.

Parameters

Path parameters

Path parameter Description
{surveyId}The id of the survey. This is the survey GUID and not the Interview URL.

Query string parameters

Query string parameter Required / Optional Description Type Range Default
maxParticipantsOptionalThe number of participants to return.Integer1-50005000
startingFromOptionalReturns participants from the startingFrom token. This value is “0” to start at the beginning or a token to start from a particular point in the participants collection.   Example: #IBCGEGG.   To get the next set of participants (if the output UpToDate property is false) feed the progress token of the output into the startingFrom token and make the call again.StringN/A“0”

Sample Request

curl --location --request GET 'https:// <servername>/snaponline/api/surveys/20dbe888-ec99-4895-b094-e34084f9408f/participants?startingFrom=0&maxParticipants=2' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2.0'

(In the above code, replace {APIKEY} with your actual API key and {USERNAME} with your actual username.)

Sample Response

200 OK with body:

{
    "surveyId": "20dbe888-ec99-4895-b094-e34084f9408f",
    "startingFrom": "0",
    "progress": "#ECDEHDIHBB",
    "upToDate": false,
    "participants": [
        {
            "enabled": true,
            "invitationSection": {
                "optedOut": false,
                "sendInvitations": true,
                "emailAddress": "a@example.com"
            },
            "loginSection": {
                "login": "A",
                "password": null,
                "interviewer": null,
                "status": "NotStarted"
            }
        },
        {
            "enabled": true,
            "invitationSection": {
                "optedOut": false,
                "sendInvitations": true,
                "emailAddress": "b@example.com"
            },
            "loginSection": {
                "login": "B",
                "password": null,
                "interviewer": null,
                "status": "NotStarted"
            }
        }
    ]
}

Response Definitions

Response Item Description Data Type
surveyIdThe survey Id you selected based on the survey Id in the request.String: containing GUID
startingFromThe startingFrom token in the request.String
progressThe ending token. This token can be used as the startingFrom parameter in the next call.String
upToDateWhether the most recent participant is included.String: containing Boolean
participantsThe participants.

The number of participants will be based on the maxParticipants request parameter.
List: containing objects
participants/enabledWhether the participant is enabled.Boolean
participants/ loginSectionThe login section for a logged on survey participant. Section will be omitted if not a logged on survey.Object
participants/loginSection /loginIf a logged on survey this will be the login name otherwise null.String or null
participants/ loginSection passwordIf a logged on survey and a password is required this will be the password otherwise null or “”.String or null
participants/ loginSection interviewerIf the survey allows synchronisation of participants with SOI but the API user does not have “Manage participants for SOI” permission this will be null. If survey does not allow synchronisation of participants to SOI this will be null. If the survey allows synchronisation of participants to SOI and the API user has “Manage participants for SOI” permission this will be either “” signifying that all interviewers will have access or an email address of the interviewer.String or null
participants/ loginSection statusIf the survey is a logged on but not a group questionnaire then this is the status of the participant.   If the survey is a logged on and group questionnaire then this is the overall status for the participant across all the questionnaires.   If the survey is invite only then the status will be null.

 
String or null:  
For non group questionnaire:  
“NotStarted” – the participant has not started the questionnaire.
“Started” the participant has started the questionnaire.
“Partial” – a partial response has been taken.
“Saved” – the participant has saved the questionnaire.
“Completed” – the participant has completed the questionnaire.
“Submitted” – the researcher has submitted a partial response.  
For group questionnaire:  
“NotStarted” – the participant has not started any of the questionnaires.
“Started” –  the participant has started at least one of the questionnaires.
“Completed” – the participant has completed all of the questionnaires. This includes whether a researcher submitted a partial.
participants/ invitationSectionThe invitation section for an invited survey participant. Section will be omitted if not an invited survey.Object
participants/ invitationSection/emailAddressIf an invited survey this will be the email address of the participant or empty string if not an invite survey.String
participants/ invitationSection sendInvitationsWhether invitations are to be sent.Boolean
participants/ invitationSection optedOutWhether the user is opted out from emails.Boolean
   

HTTP Status Codes

200 OK

Other API calls

The post Get Participant List appeared first on SnapSurveys.

]]>
Delete Participant Subject https://www.snapsurveys.com/support-snapxmp/snapxmp/api-delete-participant-subject/ Mon, 17 Oct 2022 10:15:23 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=8134 Delete a subject from a participant of a survey. Endpoint Method Url DELETE surveys/{surveyId}/participants/{participantUniqueId}/subjects/{subjectName} Delete the specific subject identified by the subjectName path variable from the specific participant identified by the participantUniqueId path variable of the specific survey identified by the suurveyId path variable. Note: You cannot delete the subject of a non-group questionnaire. On […]

The post Delete Participant Subject appeared first on SnapSurveys.

]]>
Delete a subject from a participant of a survey.

Endpoint

Method Url
DELETEsurveys/{surveyId}/participants/{participantUniqueId}/subjects/{subjectName}

Delete the specific subject identified by the subjectName path variable from the specific participant identified by the participantUniqueId path variable of the specific survey identified by the suurveyId path variable.

Note: You cannot delete the subject of a non-group questionnaire. On a group questionnaire you cannot delete a subject if there would be no subjects remaining.

Parameters

Path parameters

Path parameter Description
{surveyId}The id of the survey. This is the survey GUID and not the Interview URL.
{participantUniqueId}The participantUniqueId is either the login name if a logged in survey or else the email address.
{subjectName}The subjectName of the participant.

Query string parameters

None

Sample Request

curl --location --request DELETE 'https:// <servername>/snaponline/api/surveys/20dbe888-ec99-4895-b094-e34084f9408f/participants/A/subjects/L5' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2.0' \
--data-raw ''

(In the above code, replace {APIKEY} with your actual API key and {USERNAME} with your actual username.)

Sample Response

No response

Response Definitions

No  response definition

HTTP Status Codes

200 OK

400 Bad Request

  • If trying to delete a subject from non-group questionnaire.
  • If trying to delete last remaining subject from a group questionnaire.

404 Not Found

Other API calls

The post Delete Participant Subject appeared first on SnapSurveys.

]]>
Update Participant Subject https://www.snapsurveys.com/support-snapxmp/snapxmp/api-update-participant-subject/ Mon, 17 Oct 2022 10:12:30 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=8132 Update an existing subject of a participant of a survey. Endpoint Method               Url PUT surveys/{surveyId}/participants/{participantUniqueId}/subjects/{subjectName} Update the existing specific subject identified by the subjectName path variable of the specific participant identified by the participantUniqueId path variable of the specific survey identified by the surveyId path variable. Parameters Path parameters Path parameter Description {surveyId} The id […]

The post Update Participant Subject appeared first on SnapSurveys.

]]>
Update an existing subject of a participant of a survey.

Endpoint

Method               Url
PUTsurveys/{surveyId}/participants/{participantUniqueId}/subjects/{subjectName}

Update the existing specific subject identified by the subjectName path variable of the specific participant identified by the participantUniqueId path variable of the specific survey identified by the surveyId path variable.

Parameters

Path parameters

Path parameter Description
{surveyId}The id of the survey. This is the survey GUID and not the Interview URL.
{participantUniqueId}The participantUniqueId is either the login name if a logged in survey or else the email address.
{subjectName}The name of the subject. Use null if non-group questionnaire.

Query string parameters

None.

Request body data

Requires request body of JSON object e.g.:

{
    "subjectName": "Chester Zoo2",
    "questionnaireSeeding": {
        "v46": "D",
        "v45": "David"
    },
    "status": "NotStarted"
}

Note. The subjectName property must be the same as the subjectName path variable. It is not possible to rename a subject with this call. In the case of a non-group questionnaire the subjectName path variable should be null.

In the example above we are changing two of the seeding values for the subject. The status property is ignored if included. This means that you can take the output of a get subject call, modify the seeding and pass it in the add subject call without having to remove the status property.

Sample Request

curl --location --request PUT 'https:// <servername>/snaponline/api/surveys/20dbe888-ec99-4895-b094-e34084f9408f/participants/A/subjects/L5' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2.0' \
--header 'Content-Type: application/json' \
--data-raw '{
    "subjectName": "L5",
    "questionnaireSeeding": {
        "v48": "2;3",
        "v50": "A",
        "v53": "L5",
        "v51": "A",
        "v46": "6"
    },
    "status": "NotStarted"
}'

(In the above code, replace {APIKEY} with your actual API key and {USERNAME} with your actual username.)

Sample Response

{
    "subjectName": "L5",
    "questionnaireSeeding": {
        "v48": "2;3",
        "v50": "A",
        "v53": "L5",
        "v51": "A",
        "v46": "6"
    },
    "status": "NotStarted"
}

Response Definitions

Response Item Description Data Type
subjectNameFor a group questionnaire subject name will not be an empty string.   For a non-group questionnaire, the subject name must be an empty string.String
questionnaireSeedingThe questionnaire seeding for the subject. This is a dictionary of properties in the form “<variable V number>” : “<value>”.Object
statusThis is the subject status.

 
String or null:  
“NotStarted” – the participant has not started the questionnaire.
“Started” the participant has started the questionnaire.
“Partial” – a partial response has been taken.
“Saved” – the participant has saved the questionnaire.
“Completed” – the participant has completed the questionnaire.
“Submitted” – the researcher has submitted a partial response.  

HTTP Status Codes

200 OK

404 Not Found with:

{
    "message": "Participant not found."
}

400 Bad Request with:

{
    "message": "Subject name must match subject details."
}

"message": "Survey is not a group questionnaire. Cannot add subjects."
"message": "Participant does not have this subject."
"message": "Could not update subject."
"message": " Participant invite seeding does not have a '<invite key>' seeding property."
"message": " Survey variable '<questionnaire item>' does not contain code value '<code value>'."
"message": "Participant questionnaire seeding does not have a '<questionnaire item>' seeding property."
"message": "Survey does not have a '<questionnaire item>' variable."
"message": "Survey variable '<questionnaire item>' is single choice. Multiple values are not allowed."
"message": "Survey variable '<questionnaire item>' cannot contain duplicate code values."

Other API calls

The post Update Participant Subject appeared first on SnapSurveys.

]]>
Add Participant Subject https://www.snapsurveys.com/support-snapxmp/snapxmp/api-add-participant-subject/ Mon, 17 Oct 2022 10:06:29 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=8130 Add a new subject to a participant of a survey. Endpoint Method               Url POST surveys/{surveyId}/participants/{participantUniqueId}/subjects Add the new subject of the specific participant identified by the participantUniqueId path variable of the specific survey identified by the surveyId path variable. Parameters Path parameters Path parameter Description {surveyId} The id of the survey. This is the survey […]

The post Add Participant Subject appeared first on SnapSurveys.

]]>
Add a new subject to a participant of a survey.

Endpoint

Method               Url
POSTsurveys/{surveyId}/participants/{participantUniqueId}/subjects

Add the new subject of the specific participant identified by the participantUniqueId path variable of the specific survey identified by the surveyId path variable.

Parameters

Path parameters

Path parameter Description
{surveyId}The id of the survey. This is the survey GUID and not the Interview URL.
{participantUniqueId}The participantUniqueId is either the login name if a logged in survey or else the email address.

Query string parameters

None

Request body data

Requires request body of JSON object e.g.:

{
    "subjectName": "Chester Zoo2",
    "questionnaireSeeding": {
        "v46": "D",
        "v45": "David"
    },
    "status": "NotStarted"
}

Note. For a group questionnaire the subjectName must be a non-empty string. It is not possible to add a subject to a non-group questionnaire as there is only one subject with a subjectName of empty string. In the example above we are setting two of the seeding values for the subject. The status property is ignored if included. This means that you can take the output of a get subject call, modify the seeding and pass it in the add subject call without having to remove the status property.

Sample Request

curl --location --request POST 'https:// <servername>/snaponline/api/surveys/20dbe888-ec99-4895-b094-e34084f9408f/participants/A/subjects' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2.0' \
--header 'Content-Type: application/json' \
--data-raw '{
    "subjectName": "L5",
    "questionnaireSeeding": {
        "v53": "L5",
        "v48": "2;3",
        "v50": "A",
        "v51": "A",
        "v46": "4"
    },
    "status": "NotStarted"
}'

(In the above code, replace {APIKEY} with your actual API key and {USERNAME} with your actual username.)

Sample Response

{
    "subjectName": "L5",
    "questionnaireSeeding": {
        "v48": "2;3",
        "v50": "A",
        "v53": "L5",
        "v51": "A",
        "v46": "4"
    },
    "status": "NotStarted"
}

Response Definitions

Response Item Description Data Type
subjectNameFor a group questionnaire subject name will not be an empty string.   For a non-group questionnaire, the subject name must be an empty string.String
questionnaireSeedingThe questionnaire seeding for the subject. This is a dictionary of properties in the form “<variable V number>” : “<value>”.Object
statusThis is the subject status.

 
String or null:  
“NotStarted” – the participant has not started the questionnaire.
“Started” the participant has started the questionnaire.
“Partial” – a partial response has been taken.
“Saved” – the participant has saved the questionnaire.
“Completed” – the participant has completed the questionnaire.
“Submitted” – the researcher has submitted a partial response.  
   

HTTP Status Codes

200 OK

404 Not Found with:

{
    "message": "Participant not found."
}

400 Bad Request with:

{
    "message": "Must provide a subject."
}

"message": "Survey is not a group questionnaire. Cannot add subjects."
"message": "Participant questionnaire seeding does not have a '<questionnaire seeding>' seeding property."
"message": "Participant already has that subject."
"message": "Could not add subject."
"message": " Participant invite seeding does not have a '<invite key>' seeding property."
"message": " Survey variable '<questionnaire item>' does not contain code value '<code value>'."
"message": "Participant questionnaire seeding does not have a '<questionnaire item>' seeding property."
"message": "Survey does not have a '<questionnaire item>' variable."
"message": "Survey variable '<questionnaire item>' is single choice. Multiple values are not allowed."
"message": "Survey variable '<questionnaire item>' cannot contain duplicate code values."

Other API calls

The post Add Participant Subject appeared first on SnapSurveys.

]]>
Get Participant Subject https://www.snapsurveys.com/support-snapxmp/snapxmp/api-get-participant-subject/ Mon, 17 Oct 2022 09:34:42 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=8128 Get the details of a subject of a participant of a survey. Endpoint Method               Url GET surveys/{surveyId}/participants/{participantUniqueId}/subjects/{subjectName} Get the details of the specific subject identified by the subjectName path variable of the specific participant identified by the participantUniqueId path variable of the specific survey identified by the surveyId path variable. Parameters Path parameters Path parameter […]

The post Get Participant Subject appeared first on SnapSurveys.

]]>
Get the details of a subject of a participant of a survey.

Endpoint

Method               Url
GETsurveys/{surveyId}/participants/{participantUniqueId}/subjects/{subjectName}

Get the details of the specific subject identified by the subjectName path variable of the specific participant identified by the participantUniqueId path variable of the specific survey identified by the surveyId path variable.

Parameters

Path parameters

Path parameter Description
{surveyId}The id of the survey. This is the survey GUID and not the Interview URL.
{participantUniqueId}The participantUniqueId is either the login name if a logged in survey or else the email address.
{subjectName}The name of the subject. Use null if non-group questionnaire.

Query string parameters

None

Sample Request

curl --location --request GET 'https:// <servername>/snaponline/api/surveys/20dbe888-ec99-4895-b094-e34084f9408f/participants/A/subjects/L1' \
--header 'X-USERNAME: {USERBNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2.0' \
--data-raw ''

(In the above code, replace {APIKEY} with your actual API key and {USERNAME} with your actual username.)

Sample Response

{
    "subjectName": "L1",
    "questionnaireSeeding": {
        "v53": "L1",
        "v48": "2;3",
        "v50": "A",
        "v51": "A",
        "v46": "4"
    },
    "status": "NotStarted"
}

Response Definitions

Response Item Description Data Type
subjectNameFor a group questionnaire, the  subject name will not be an empty string.   For a non-group questionnaire, the subject name will always be an empty string.String
questionnaireSeedingThe questionnaire seeding for the subject. This is a dictionary of properties in the form “<variable V number>” : “<value>”.Object
statusThis is the subject status.

 
String or null:  
“NotStarted” – the participant has not started the questionnaire.
“Started” the participant has started the questionnaire.
“Partial” – a partial response has been taken.
“Saved” – the participant has saved the questionnaire.
“Completed” – the participant has completed the questionnaire.
“Submitted” – the researcher has submitted a partial response.  

HTTP Status Codes

200 OK

404 Not Found

Other API calls

The post Get Participant Subject appeared first on SnapSurveys.

]]>
Get Participants Subjects https://www.snapsurveys.com/support-snapxmp/snapxmp/api-get-participants-subjects/ Mon, 17 Oct 2022 09:18:42 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=8126 Get the details of the subjects of a participant of a survey. Endpoint Method               Url GET surveys/{surveyId}/participants/{participantUniqueId}/subjects Get the details of the subjects of the specific participant identified by the participantUniqueId path variable of the specific survey identified by the surveyId path variable. Parameters Path parameters Path parameter Description {surveyId} The id of the survey. […]

The post Get Participants Subjects appeared first on SnapSurveys.

]]>
Get the details of the subjects of a participant of a survey.

Endpoint

Method               Url
GETsurveys/{surveyId}/participants/{participantUniqueId}/subjects

Get the details of the subjects of the specific participant identified by the participantUniqueId path variable of the specific survey identified by the surveyId path variable.

Parameters

Path parameters

Path parameter Description
{surveyId}The id of the survey. This is the survey GUID and not the Interview URL.
{participantUniqueId}The participantUniqueId is either the login name if a logged in survey or else the email address.

Query string parameters

None

Sample Request

curl --location --request GET 'https:// <servername>/snaponline/api/surveys/20dbe888-ec99-4895-b094-e34084f9408f/participants/A/subjects' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2.0' \
--data-raw ''

(In the above code, replace {APIKEY} with your actual API key and {USERNAME} with your actual username.)

Sample Response

[
    {
        "subjectName": "L1",
        "questionnaireSeeding": {
            "v53": "L1",
            "v48": "2;3",
            "v50": "A",
            "v51": "A",
            "v46": "4"
        },
        "status": "NotStarted"
    }
]

Response Definitions

Response Item Description Data Type
subjectNameFor a group questionnaire, the subject name will not be an empty string.   For a non-group questionnaire, the subject name will always be an empty string.String
questionnaireSeedingThe questionnaire seeding for the subject. This is a dictionary of properties in the form “<variable V number>” : “<value>”.Object
statusThis is the subject status.

 
String or null:  
“NotStarted” – the participant has not started the questionnaire.
“Started” the participant has started the questionnaire.
“Partial” – a partial response has been taken.
“Saved” – the participant has saved the questionnaire.
“Completed” – the participant has completed the questionnaire.
“Submitted” – the researcher has submitted a partial response.  

HTTP Status Codes

200 OK

404 Not Found

Other API calls

The post Get Participants Subjects appeared first on SnapSurveys.

]]>
Delete Participant https://www.snapsurveys.com/support-snapxmp/snapxmp/api-delete-participant/ Mon, 17 Oct 2022 09:11:07 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=8124 Delete an existing participant of a survey. Endpoint Method               Url DELETE surveys/{surveyId}/participants/{participantUniqueId} Delete the existing participant identified by the participantUniqueId path variable of the specific survey identified by the surveyId path variable. Parameters Path parameters Path parameter Description {surveyId} The id of the survey. This is the survey GUID and not the Interview URL. {participantUniqueId} […]

The post Delete Participant appeared first on SnapSurveys.

]]>
Delete an existing participant of a survey.

Endpoint

Method               Url
DELETEsurveys/{surveyId}/participants/{participantUniqueId}

Delete the existing participant identified by the participantUniqueId path variable of the specific survey identified by the surveyId path variable.

Parameters

Path parameters

Path parameter Description
{surveyId}The id of the survey. This is the survey GUID and not the Interview URL.
{participantUniqueId}The participantUniqueId is either the login name if a logged in survey or else the email address.

Query string parameters

None

Sample Request

curl --location --request DELETE 'https:// <servername>/snaponline/api/surveys/20dbe888-ec99-4895-b094-e34084f9408f/participants/E' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2.0'

(In the above code, replace {APIKEY} with your actual API key and {USERNAME} with your actual username.)

Sample Response

No response

Response Definitions

No response definition

HTTP Status Codes

200 OK

404 Not Found

Other API calls

The post Delete Participant appeared first on SnapSurveys.

]]>
Update Participant https://www.snapsurveys.com/support-snapxmp/snapxmp/api-update-participant/ Mon, 17 Oct 2022 09:02:17 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=8122 Update an existing participant of a survey. Endpoint Method               Url PUT surveys/{surveyId}/participants/{participantUniqueId} Update the existing specific participant identified by the participantUniqueId path variable of the specific survey identified by the surveyId path variable. Parameters Path parameters Path parameter Description {surveyId} The id of the survey. This is the survey GUID and not the Interview URL. […]

The post Update Participant appeared first on SnapSurveys.

]]>
Update an existing participant of a survey.

Endpoint

Method               Url
PUTsurveys/{surveyId}/participants/{participantUniqueId}

Update the existing specific participant identified by the participantUniqueId path variable of the specific survey identified by the surveyId path variable.

Parameters

Path parameters

Path parameter Description
{surveyId}The id of the survey. This is the survey GUID and not the Interview URL.
{participantUniqueId}The participantUniqueId is either the login name if a logged in survey or else the email address.

Query string parameters

None

Request body data

Requires request body of JSON object e.g.:

{
    "invitationSection": {
        "optedOut": false,
        "sendInvitations": true,
        "emailAddress": "sborg4@titan.local",
        "inviteSeeding": {
            "surname": "D",
            "forenames": "David"
        }
    },
    "loginSection": {
        "login": "A4",
        "password": null,
        "interviewer": "",
        "status": "NotStarted",
        "subjects": [
            {
                "subjectName": "Alton Towers",
                "questionnaireSeeding": {
                    "v45": "David",
                    "v46": "D"
                },
                "status": "NotStarted"
            },
            {
                "subjectName": "Chester Zoo",
                "questionnaireSeeding": {
                    "v45": "David",
                    "v46": "D"
                },
                "status": "NotStarted"
            }
        ]
    },
    "enabled": true
}

Note. The above example is updating a participant in a survey where the participant feature requires that the participant be invited and that the participant has to provide credentials to view the questionnaire. Therefore, you must specify both the invitationSection section and the logonSection section in the call. The example is also for a group questionnaire and it will create two subjects for the participant. In a non-group questionnaire you must provide one subject and the subjectName property should be an empty string.

For an invite only survey do not include a loginSection section. For a logged on only survey do not include an invitationSection section.

The status properties are read-only so will be ignored if specified.

If the survey allows interviewers for SOI then you specify the interviewer in the interviewer property. The interviewer must be the email address of a user that has SOI access to the survey. If you don’t want to specify an interviewer set it to an empty string. If the survey does not allow interviewers set it to null.

Sample Request

curl --location --request PUT 'https:// <servername>/snaponline/api/surveys/20dbe888-ec99-4895-b094-e34084f9408f/participants/E' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2.0' \
--header 'Content-Type: application/json' \
--data-raw '{
    "invitationSection": {
        "optedOut": false,
        "sendInvitations": true,
        "emailAddress": "a@example.com",
        "invitationSeeding": {}
    },
    "loginSection": {
        "login": "E",
        "password": null,
        "interviewer": null,
        "status": "NotStarted",
        "subjects": [
            {
                "subjectName": "L1",
                "questionnaireSeeding": {
                    "v48": "2;3",
                    "v50": "A",
                    "v53": "L1",
                    "v51": "A",
                    "v46": "6"
                },
                "status": "NotStarted"
            }
        ]
    },
    "enabled": true
}'

(In the above code, replace {APIKEY} with your actual API key and {USERNAME} with your actual username.)

Note. The status field is read-only. If you send it into the request body as in the sample request above it will be ignored

Sample Response

{
    "invitationSection": {
        "optedOut": false,
        "sendInvitations": true,
        "emailAddress": "a@example.com",
        "invitationSeeding": {}
    },
    "loginSection": {
        "login": "E",
        "password": null,
        "interviewer": null,
        "status": "NotStarted",
        "subjects": [
            {
                "subjectName": "L1",
                "questionnaireSeeding": {
                    "v48": "2;3",
                    "v50": "A",
                    "v53": "L1",
                    "v51": "A",
                    "v46": "6"
                },
                "status": "NotStarted"
            }
        ]
    },
    "enabled": true
}

Response Definitions

Response Item Description Data Type
enabledWhether the participant is enabled.Boolean
invitationSectionThe invitation section for an invited survey participant. Section will be omitted if not an invited survey.Object
invitationSection/optedOutWhether invitations are to be sent.Boolean
invitationSection/sendInvitationsWhether the user is opted out from emails.Boolean
invitationSection/emailAddressThe email address.String
invitationSection/inviteSeedingThe invite seeding.   This is a dictionary of properties in the form “<invite key>” : “<value>”Object
loginSectionThe login section for a logged on survey participant. Section will be omitted if not a logged on survey.Object
loginSection/loginIf a logged on survey this will be the login name otherwise null.String or null
loginSection/passwordIf a logged on survey and a password is required this will be the password otherwise null or “”.String or null
loginSection/interviewerIf the survey allows synchronisation of participants with SOI but the API user does not have “Manage participants for SOI” permission this will be null. If survey does not allow synchronisation of participants to SOI this will be null. If the survey allows synchronisation of participants to SOI and the API user has “Manage participants for SOI” permission this will be either “” signifying that all interviewers will have access or an email address of the interviewer.String or null
loginSection/statusThis is the overall status.   If the survey is a logged on but not a group questionnaire then this is the status of the participant.   If the survey is a logged on and group questionnaire then this is the overall status for the participant across all the questionnaires.   If the survey is invite only then the status will be null.

 
String or null:  
For non group questionnaire:  
“NotStarted” – the participant has not started the questionnaire.
“Started” the participant has started the questionnaire.
“Partial” – a partial response has been taken.
“Saved” – the participant has saved the questionnaire.
“Completed” – the participant has completed the questionnaire.
“Submitted” – the researcher has submitted a partial response.  
For group questionnaire:  
“NotStarted” – the participant has not started any of the questionnaires.
“Started” – the participant has started at least one of the questionnaires.
“Completed” – the participant has completed all of the questionnaires. This includes whether a researcher submitted a partial.
loginSection/subjectsThe subjects for the participant.   For a group questionnaire there will be one or more. For a non-group questionnaire there will just be one.List
loginSection/subjects/subjectNameFor a group questionnaire subject name will not be an empty string.   For a non group questionnaire the subject name must be an empty string.String
loginSection/subjects/ questionnaireSeedingThe questionnaire seeding for the subject.   This is a dictionary of properties in the form “<variable V number>” : “<value>”.Object
loginSection/subjects/statusThis is the subject status.

 
String or null:  
“NotStarted” – the participant has not started the questionnaire.
“Started” the participant has started the questionnaire.
“Partial” – a partial response has been taken.
“Saved” – the participant has saved the questionnaire.
“Completed” – the participant has completed the questionnaire.
“Submitted” – the researcher has submitted a partial response.  
enabledWhether the participant is enabled.Boolean

HTTP Status Codes

200 OK

404 Not Found with:

{
    "message": "Participant not found."
}

400 Bad Request – various including:

{
    "message": "Participants require a login section."
}

"message": "You must provide a login name."
"message": "Participants require an invitation section."
"message": "Participants should not have an invitation section."
"message": "Participants should not have a login section."
"message": "The unique participant id provided in the URL must be the same as in the request body."
"message": "Not allowed to add, update or delete an interviewer."
"message": "Must provide an interviewer property and value cannot be null."
"message": "Interviewer does not have access to the survey."
"message": Participants for this survey must have one subject."
"message": "Participants for this survey must only have one subject and the subject name must be an empty string."
"message": "Participants for this survey must have at least one subject."
"message": "Subject name cannot be blank for a group questionnaire."
"message": "Participant cannot be opted out and have send invitations enabled at the same time."
"message": "The unique participant id provided in the URL must be the same as in the request body."
"message": "You must provide a valid email address."
"message": "If an email address is provided, it must be valid."
"message": "Participant with this login name does not exist."
"message": "Participant with this login name already exists."
"message": "Participants for this survey must have unique subjects."
"message": "Participant to update does not exist."
"message": "Participant subjects do not match."
"message": "Participant with this email address does not exist."
"message": " Survey does not support participants."
"message": " Participants cannot be added, updated or deleted whilst an import is scheduled or running."
"message": " Participant invite seeding does not have a '<invite item>' seeding property."
"message": " Participant questionnaire seeding does not have a '<questionnaire item>}' seeding property."
"message": " Survey does not have a '<questionnaire item>' variable."
"message": " Survey variable '<questionnaire item>' is single choice. Multiple values are not allowed."
"message": " Survey variable '<questionnaire item>' cannot contain duplicate code values."
"message": " Survey variable '<questionnaire item>' does not contain code value '<code value>'."

Other API calls

The post Update Participant appeared first on SnapSurveys.

]]>
Add Participant https://www.snapsurveys.com/support-snapxmp/snapxmp/api-add-participant/ Mon, 17 Oct 2022 08:35:12 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=8120 Add a new participant to a survey. Endpoint Method               Url POST surveys/{surveyId}/participants Add a new participant to the specific survey identified by the surveyId path variable. Parameters Path parameters Path parameter Description {surveyId} The id of the survey. This is the survey GUID and not the Interview URL. Query string parameters None Request body data […]

The post Add Participant appeared first on SnapSurveys.

]]>
Add a new participant to a survey.

Endpoint

Method               Url
POSTsurveys/{surveyId}/participants

Add a new participant to the specific survey identified by the surveyId path variable.

Parameters

Path parameters

Path parameter Description
{surveyId}The id of the survey. This is the survey GUID and not the Interview URL.

Query string parameters

None

Request body data

Requires request body of JSON object e.g.:

{
    "invitationSection": {
        "optedOut": false,
        "sendInvitations": true,
        "emailAddress": "a@example.com",
        "invitationSeeding": {
            "forenames": "A",
            "surname": "A"
        }
    },
    "loginSection": {
        "login": "A",
        "password": null,
        "interviewer": null,
        "status": "NotStarted",
        "subjects": [
            {
                "subjectName": "L1",
                "questionnaireSeeding": {
                    "v53": "L1",
                    "v48": "2;3",
                    "v50": "A",
                    "v51": "A",
                    "v46": "4"
                },
                "status": "NotStarted"
            }
        ]
    },
    "enabled": true
}

Note. The above example is creating a participant in a survey where the participant feature requires that the participant be invited and that the participant has to provide credentials to view the questionnaire. Therefore, you must specify both the invitationSection section and the loginSection section in the call. The example is also for a group questionnaire and it will create two subjects for the participant. In a non-group questionnaire, you must provide one subject and the subjectName property should be an empty string.

For an invite only survey do not include a loginSection section. For a logged on only survey do not include an invitationSection section.

The status properties are read-only so will be ignored if specified.

If the survey allows interviewers for SOI then you specify the interviewer in the interviewer property. The interviewer must be the email address of a user that has SOI access to the survey. If you don’t want to specify an interviewer set it to an empty string. If the survey does not allow interviewers set it to null.

Sample Request

curl --location --request POST 'https:// <servername>/snaponline/api/surveys/20dbe888-ec99-4895-b094-e34084f9408f/participants' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2.0' \
--header 'Content-Type: application/json' \
--data-raw '{
    "invitationSection": {
        "optedOut": false,
        "sendInvitations": true,
        "emailAddress": "a@example.com",
        "invitationSeeding": {
            "forenames": "E",
            "surname": "E"
        }
    },
    "loginSection": {
        "login": "E",
        "password": null,
        "interviewer": null,
        "status": "NotStarted",
        "subjects": [
            {
                "subjectName": "L1",
                "questionnaireSeeding": {
                    "v53": "L1",
                    "v48": "2;3",
                    "v50": "A",
                    "v51": "A",
                    "v46": "4"
                },
                "status": "NotStarted"
            }
        ]
    },
    "enabled": true
}'

(In the above code, replace {APIKEY} with your actual API key and {USERNAME} with your actual username.)

Note. The status field is read-only. If you send it into the request body as in the sample request above it will be ignored.

Sample Response

{
    "invitationSection": {
        "optedOut": false,
        "sendInvitations": true,
        "emailAddress": "a@example.com",
        "invitationSeeding": {}
    },
    "loginSection": {
        "login": "E",
        "password": null,
        "interviewer": null,
        "status": "NotStarted",
        "subjects": [
            {
                "subjectName": "L1",
                "questionnaireSeeding": {
                    "v48": "2;3",
                    "v50": "A",
                    "v53": "L1",
                    "v51": "A",
                    "v46": "4"
                },
                "status": "NotStarted"
            }
        ]
    },
    "enabled": true
}

Response Definitions

Response Item Description Data Type
enabledWhether the participant is enabled.Boolean
invitationSectionThe invitation section for an invited survey participant. Section will be omitted if not an invited survey.Object
invitationSection/optedOutWhether invitations are to be sent.Boolean
invitationSection/sendInvitationsWhether the user is opted out from emails.Boolean
invitationSection/emailAddressThe email address.String
invitationSection/inviteSeedingThe invite seeding.   This is a dictionary of properties in the form “<invite key>” : “<value>”Object
loginSectionThe login section for a logged on survey participant. Section will be omitted if not a logged on survey.Object
loginSection/loginIf a logged on survey this will be the login name otherwise null.String or null
loginSection/passwordIf a logged on survey and a password is required this will be the password otherwise null or “”.String or null
loginSection/interviewerIf the survey allows synchronisation of participants with SOI but the API user does not have “Manage participants for SOI” permission this will be null. If survey does not allow synchronisation of participants to SOI this will be null. If the survey allows synchronisation of participants to SOI and the API user has “Manage participants for SOI” permission this will be either “” signifying that all interviewers will have access or an email address of the interviewer.String or null
loginSection/statusThis is the overall status.   If the survey is a logged on but not a group questionnaire then this is the status of the participant.   If the survey is a logged on and group questionnaire then this is the overall status for the participant across all the questionnaires.   If the survey is invite only then the status will be null.

 
String or null:   For non group questionnaire:   “NotStarted” – the participant has not started the questionnaire. “Started” the participant has started the questionnaire. “Partial” – a partial response has been taken. “Saved” – the participant has saved the questionnaire. “Completed” – the participant has completed the questionnaire. “Submitted” – the researcher has submitted a partial response.   For group questionnaire:   “NotStarted” – the participant has not started any of the questionnaires. “Started” –  the participant has started at least one of the questionnaires. “Completed” – the participant has completed all of the questionnaires. This includes whether a researcher submitted a partial.
loginSection/subjectsThe subjects for the participant.   For a group questionnaire there will be one or more. For a non-group questionnaire there will just be one.List
loginSection/subjects/subjectNameFor a group questionnaire subject name will not be an empty string.   For a non group questionnaire the subject name must be an empty string.String
loginSection/subjects/ questionnaireSeedingThe questionnaire seeding for the subject.   This is a dictionary of properties in the form “<variable V number>” : “<value>”.Object
loginSection/subjects/statusThis is the subject status.

 
String or null:   “NotStarted” – the participant has not started the questionnaire. “Started” the participant has started the questionnaire. “Partial” – a partial response has been taken. “Saved” – the participant has saved the questionnaire. “Completed” – the participant has completed the questionnaire. “Submitted” – the researcher has submitted a partial response.  
enabledWhether the participant is enabled.Boolean

HTTP Status Codes

201 Created

The response headers will include a Location key where the value is the URL to call to get the participant.

400 Bad Request – various including:

{
    "message": "Participants require a login section."
}

"message": "You must provide a login name."
"message": "Participants require an invitation section."
"message": "Participants should not have an invitation section."
"message": "Participants should not have a login section."
"message": "The unique participant id provided in the URL must be the same as in the request body."
"message": "Not allowed to add, update or delete an interviewer."
"message": "Must provide an interviewer property and value cannot be null."
"message": "Interviewer does not have access to the survey."
"message": Participants for this survey must have one subject."
"message": "Participants for this survey must only have one subject and the subject name must be an empty string."
"message": "Participants for this survey must have at least one subject."
"message": "Subject name cannot be blank for a group questionnaire."
"message": "Participant cannot be opted out and have send invitations enabled at the same time."
"message": "The unique participant id provided in the URL must be the same as in the request body."
"message": "You must provide a valid email address."
"message": "If an email address is provided, it must be valid."
"message": "Another participant already has this login name."
"message": "Participants for this survey must have unique subjects."
"message": "Participant to update does not exist."
"message": "Participant subjects do not match."
"message": "Another participant already has this email address."
"message": " Survey does not support participants."
"message": " Participants cannot be added, updated or deleted whilst an import is scheduled or running."
"message": " Participant invite seeding does not have a '<invite item>' seeding property."
"message": " Participant questionnaire seeding does not have a '<questionnaire item>}' seeding property."
"message": " Survey does not have a '<questionnaire item>' variable."
"message": " Survey variable '<questionnaire item>' is single choice. Multiple values are not allowed."
"message": " Survey variable '<questionnaire item>' cannot contain duplicate code values."
"message": " Survey variable '<questionnaire item>' does not contain code value '<code value>'."

Other API calls

The post Add Participant appeared first on SnapSurveys.

]]>
API Validation https://www.snapsurveys.com/support-snapxmp/snapxmp/api-validation/ Wed, 12 Oct 2022 15:21:13 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=8086 Version 2.0 adds additional validation to query parameters and to JSON request bodies. If you provide a query parameter that does not exist, you will get a 400 Bad Request response and the return body will state “Invalid query string parameters” in the message property followed by the parameters that don’t exist in the parameters […]

The post API Validation appeared first on SnapSurveys.

]]>
Version 2.0 adds additional validation to query parameters and to JSON request bodies.

If you provide a query parameter that does not exist, you will get a 400 Bad Request response and the return body will state “Invalid query string parameters” in the message property followed by the parameters that don’t exist in the parameters property. E.g.

{
    "message": "Invalid query string parameters",
    "parameters": [
       "sortorder"
    ]
}

If the parameters provided exist but are not valid you will receive a message such as:

{
    "message": "The request is invalid.",
    "modelState": {
        "includeCodes": [
            "The value 'yes' is not valid for Boolean."
        ]
    }
}

The post API Validation appeared first on SnapSurveys.

]]>
API Reference https://www.snapsurveys.com/support-snapxmp/snapxmp/api-reference/ Tue, 16 Nov 2021 16:24:46 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=6886 The v1.0 version of the implementation is restricted to surveys and responses. The v2.0 version mainly adds participant functionality. However, various existing v1.0 endpoints have been changed. These changes will be listed inside [ ] brackets. Please note that from Monday 5th December 2022 usage of the API becomes chargeable. The charge is that 0.1 […]

The post API Reference appeared first on SnapSurveys.

]]>
The v1.0 version of the implementation is restricted to surveys and responses. The v2.0 version mainly adds participant functionality. However, various existing v1.0 endpoints have been changed. These changes will be listed inside [ ] brackets.

Please note that from Monday 5th December 2022 usage of the API becomes chargeable. The charge is that 0.1 unit will be consumed each time a survey response is delivered by the API.  This applies if the same survey response is delivered by the API multiple times. The survey responses are delivered using the Get Survey Responses endpoint.

List of API endpoints in v2.0

EndpointDescription
Get Survey List Returns a list of surveys that are accessible by the user.
Get Survey Returns the details for a specific survey ID.
Get Survey Variables Returns the details for a specific survey ID.
Get Survey Variable Returns the details for a specific variable ID.
Get Survey Responses Gets the responses for a specific survey ID.
Please note that from Monday 5th December 2022 usage of the API becomes chargeable. When one survey response is delivered by the API, 0.1 unit will be consumed.  The survey responses are delivered using the Get Survey Responses endpoint.
Get User Info Returns information for the authenticated user.
Get Participant List Returns a list of participants for a survey.
Get Participant Returns the details for a specific participant in a survey.
Add Participant Add a new participant to a survey.
Update Participant Update an existing participant of a survey.
Delete Participant Delete a participant from a survey.
Get Participants Subjects Returns a list of subjects for a participant of a survey.
Get Participant Subject Returns the details of a specific subject for a participant of a survey.
Add Participant Subject Add a new subject to a participant of a survey.
Update Participant Subject Update an existing subject for a participant of a survey.
Delete Participant Subject Delete a subject from a participant of a survey.

The post API Reference appeared first on SnapSurveys.

]]>
Get User Info https://www.snapsurveys.com/support-snapxmp/snapxmp/api-get-user-info/ Tue, 16 Nov 2021 16:24:34 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=6888 Get information for the authenticated user. Endpoint Method URL GET account Get information for the authenticated user. Parameters Path parameters None Query string parameters None  Sample Request (In the above code, replace {APIKEY} with your actual API key and {USERNAME} with your actual username.) Sample Response 200 OK with body: Response Definitions Response Item […]

The post Get User Info appeared first on SnapSurveys.

]]>
Get information for the authenticated user.

Endpoint

MethodURL
GETaccount

Get information for the authenticated user.

Parameters

Path parameters

None

Query string parameters

None



Sample Request

curl --location --request GET 'http://<servername>/snaponline/api/account' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}'\
--header 'X-VERSION: 2.0'

(In the above code, replace {APIKEY} with your actual API key and {USERNAME} with your actual username.)

Sample Response

200 OK with body:

{
 "username": "jbloggs@snapsurveys.com", 
 "fullname": "Joe Bloggs",
 "emailAddress": "jbloggs@snapsurveys.com"
}

Response Definitions

Response ItemDescriptionData Type
usernameThe username for the user.String
fullnameThe full name of the user.String
emailAddressThe email address of the user.String

HTTP Status Codes

  • 200 OK

Other API calls

The post Get User Info appeared first on SnapSurveys.

]]>
Get Survey Responses https://www.snapsurveys.com/support-snapxmp/snapxmp/api-get-survey-responses/ Thu, 23 Sep 2021 10:53:38 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=6495 Get the responses of a survey. You can Please note that from Monday 5th December 2022 usage of the API becomes chargeable. The charge is that 0.1 unit will be consumed each time a survey response is delivered by the API.  This applies if the same survey response is delivered by the API multiple times. […]

The post Get Survey Responses appeared first on SnapSurveys.

]]>
Get the responses of a survey.

You can

  • use our recommended approach, which is to use the startingFrom token so you only get the responses that have been submitted or modified since your last call.
  • get all the responses each call and will be charged for each response for every call.

Please note that from Monday 5th December 2022 usage of the API becomes chargeable. The charge is that 0.1 unit will be consumed each time a survey response is delivered by the API.  This applies if the same survey response is delivered by the API multiple times. The survey responses are delivered using the Get Survey Responses endpoint.

Changes from v1.0

  • A ‘filter’ property has been added.
  • The ‘variableId’ property has been renamed ‘id’.
  • The ‘value’ property has been renamed ‘v’.
  • The ‘status’ property has been renamed ‘s’.
  • Additional validation: invalid filter or startingFrom parameter now leads to a 400 response code rather than 500.

Endpoint

MethodURL
GETsurveys/{surveyId}/responses

Get the responses of the specific survey identified with the surveyId path variable

Parameters

Path parameters

Path parameterDescription
{surveyId}The id of the survey. This is the survey GUID and not the Interview URL.

Query string parameters

Query string parameterRequired / OptionalDescriptionTypeRangeDefault
maxResponsesOptionalThe number of responses to return.Integer1-50005000
startingFromOptionalWe recommended always using the startingFrom token.
Returns responses from the startingFrom token. This value is “0” to start at the beginning or a token to start from a particular point in the responses collection.   Example: #IBCGEGG.
To get the next set of responses (if the output UpToDate property is false) feed the progress token of the output into the startingFrom token and make the call.
StringN/A“0”
returnCaseIdsOptionalWhether to return the case ID in the response.BooleanN/Afalse
useCodeLabelsOptionalWhether to return code labels (true) or code indexes (false) for choice questions.BooleanN/Afalse
variablesOptionalDetermines which variables to return in each response.  
Default returns all variables.

This is a comma separated list of V numbers. Can also use ~ to specify a range of variables.

Example: V10~V12,V15 will return V10, V11, V12 and V15.
StringN/A“”
filterOptionalThe Snap XMP filter to use.
The default does not use a filter.

Example: (ID.endDate>=2021/01/01) and (ID.endDate<=2021/06/01)
StringN/A“”

Note: There are two ways to identify the V number required in the restrictedVariables parameter:

1. Postman: Make the Get Survey Variables call and examine the result.

2. Snap Desktop: Tick the UniqueIDs checkbox in the Variable Tailoring dialog. A new Id column will then be visible in the Variables screen.

Sample Request

curl --location --request GET 'https://<servername>/snaponline/api/surveys/c23a0fd8-6219-4130-a6a7-f312829e56eb/responses?maxResponses=100&restrictedVariables= 
V16,V45~V47&returnCaseIds=true&useCodeLabels=true&startingFrom=0' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2.0' \
--data-raw ''

(In the above code, replace {APIKEY} with your actual API key and {USERNAME} with your actual username.)

Sample Response

200 OK with body:

{
    "surveyId": "6834a5f1-46e5-4b12-9e0c-a38a3d9be12c",
    "filter": "Q1>1",
    "startingFrom": "0",
    "progress": "#IBCGEGG",
    "upToDate": "false",
    "responses": [
        {
            "status": "new",
            "caseId": "8e4591b0-c1e3-4612-88b4-7b96cd28dd2d",
            "variables": [
                {
                    "id": "V46",
                    "v": "Plane"
                },
                {
                    "id": "V48",
                    "v": "\"Restaurant / Cafe\",\"Gift Shop\",\"Customer Services\""
                },
                {
                    "id": "V52",
                    "s": "NR"
                }
            ]
        },
        {
            "status": "new",
            "caseId": "5458bfcb-97df-4326-879d-4868406761ae",
            "variables": [
                {
                    "id": "V46",
                    "v": "Bike"
                },
                {
                    "id": "V48",
                    "v": "\"Gift Shop\""
                },
                {
                    "id": "V52",
                    "v": "Very busy."
                }
            ]
        }
    ]
}

Follow on Sample Request using the progress response item

In the sample response above, ‘progress’ represents where you have got to in the data file. This token is then used as the startingFrom value in the next /Responses request, to retrieve responses that have been submitted or modified since your last call.

“progress”: “#IBCGEGG”,

Use this token as the startingFrom parameter in order to retrieve responses that have been submitted or modified since your last call.

Sample Request example using the progress token

curl --location --request GET 'https://<servername>/snaponline/api/surveys/c23a0fd8-6219-4130-a6a7-f312829e56eb/responses?maxResponses=100&restrictedVariables= 
V16,V45~V47&returnCaseIds=true&useCodeLabels=true&startingFrom=#IBCGEGG' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2.0' \
--data-raw ''

Response Definitions

Response Item Description Data Type
surveyIdThe survey Id you selected based on the survey Id in the request.String: containing GUID
filterThe filter used.String
startingFromThe startingFrom token in the request. This is recommended.String
progressThe ending token. This token can be used as the startingFrom parameter in the next call.String
upToDateWhether the most recent response is included.String: containing Boolean
responsesThe responses.

The number of responses will be based on the maxResponses request parameter.
List: containing objects
responses/status“new” if this is a brand new response, “updated” if the response has been edited in Snap Desktop or “deleted” if the response has been deleted (although you will only see deleted responses if you have also set the returnCaseIds parameter to true).String
responses/caseIdThe case Id of the response.String (Default: Guid)
responses/variablesThe variables in the response.

This will either be all the variables in the response or restricted to those specified in the variables request parameter.
List: containing objects
responses/variables/idThe variable Id (V number).String
responses/variables/sThe status code of the variable. This field will only appear if the outcome of the variable is not “OK”.   String:   “NR” for no reply, “NA” for not asked, “ERR” for error.
responses/variables/vThe value of the variable.

For choice questions this will either be the code label if the useCodeLabels parameter is true or the code index if it is false.
String – even if returning numbers.

HTTP Status Codes

  • 200 OK
  • 400 Bad Request
    • If maxResponses parameter is not between 1 and 5000.
    • If restrictedVariables parameter is invalid or a variable does not exist.
    • If startingFrom parameter is invalid.
    • If the filter parameter is invalid.
  • 500
    • If something else went wrong while trying to extract the responses from the survey

Other API calls

The post Get Survey Responses appeared first on SnapSurveys.

]]>
Get Survey Variable https://www.snapsurveys.com/support-snapxmp/snapxmp/api-get-survey-variable/ Thu, 23 Sep 2021 10:52:50 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=6493 Get the details of a variable of a survey. Changes from v1.0 Endpoint Method URL GET surveys/{surveyId}/variables/{variableId} Get the details of the specific variable identified by the variableId path variable of the specific survey identified by the surveyId path variable. Parameters Path parameters Path parameter Description {surveyId} The id of the survey. This is the […]

The post Get Survey Variable appeared first on SnapSurveys.

]]>
Get the details of a variable of a survey.

Changes from v1.0

  • The response now shows the ‘surveyId’ property at the top and has the variable inside a ‘variable’ property.
  • The ‘id’ property has been removed from the response.

Endpoint

MethodURL
GETsurveys/{surveyId}/variables/{variableId}

Get the details of the specific variable identified by the variableId path variable of the specific survey identified by the surveyId path variable.

Parameters

Path parameters

Path parameterDescription
{surveyId}The id of the survey. This is the survey GUID and not the Interview URL.
{variableId}The unique V number of the variable.
This is the variable Id property returned in the Get Survey Variables end-point.

Query string parameters

None

Sample Request

curl --location --request GET 'http://localhost/snaponline/api/surveys/e819df57-0a01-4592-a7aa-8918dbe54e00/variables/V46' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2.0'

(In the above code, replace {APIKEY} with your actual API key and {USERNAME} with your actual username.)

Sample Response

200 OK with body:

{
    "surveyId": "6834a5f1-46e5-4b12-9e0c-a38a3d9be12c",
    "variable": {
        "order": 15,
        "variableId": "V48",
        "label": "Which facilities did you visit?",
        "name": "Q2",
        "questionText": "Which facilities did you visit?",
        "variableTypeId": 6,
        "responseTypeId": 2,
        "variableType": "Question",
        "responseType": "Multiple",
        "codeCount": 3,
        "codes": [
            {
                "codeIndex": 1,
                "codeValue": 1,
                "codeLabel": "Restaurant / Cafe"
            },
            {
                "codeIndex": 2,
                "codeValue": 2,
                "codeLabel": "Gift Shop"
            },
            {
                "codeIndex": 3,
                "codeValue": 3,
                "codeLabel": "Customer Services"
            }
        ]
    }
}

Response Definitions

Response Item Description Data Type
surveyIdThe survey Id.String: containing GUID
variableThe variable.Object
variable/orderThe positional order of the variable.Integer
variable/variableIdThe V number of the variableString
variable/labelThe label of the variable.String
variable/nameThe name of the variable.String
variable/questionTextThe question text of the variable. i.e. the question shown to the respondent.String
variable/variableTypeIdThe numeric code for the variable type.Integer:
Unknown = 0, Precoded = 1, Numeric = 2, Alphanumeric = 3, Derived = 5, Question = 6, Note = 7
variable/responseTypeIdThe numeric code for the response type.Integer:  
Unknown = 0, Single = 1, Multiple = 2, Quantity = 3, Literal = 4, None = 5, Date = 6, Time = 7
variable/variableTypeThe type of the variable.String:  
“Unknown”, “Precoded”, “Numeric”, “Alphanumeric”, “Derived”, “Question”, “Note”.
variable/responseTypeThe response type of the answer.String:
“Unknown”, “Single”, “Multiple”, “Quantity”, “Literal”, “None”, “Date”, “Time”
variable/codeCountIf a choice question this states the number of codes. If not a choice question then this will be 0.Integer
variable/codesA list of codes.List: containing objects
variable/codes/codeIndexThe index of the variable code.Integer
variable/codes/codeValueThe value of the variable code.Integer
variable/codes/codeLabelThe label of the variable code.String

HTTP Status Codes

  • 200 OK
  • 404 Not Found – if survey variable does not exist.

Other API calls

The post Get Survey Variable appeared first on SnapSurveys.

]]>
Get Survey Variables https://www.snapsurveys.com/support-snapxmp/snapxmp/api-get-survey-variables/ Thu, 23 Sep 2021 10:52:05 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=6491 Get details of all of the variables for a survey. Changes from v1.0 Endpoint Method URL GET surveys/{surveyId}/variables Gets the details for a specific survey ID. Parameters Path parameters Path parameter Description {surveyId} The id of the survey. This is the survey GUID and not the Interview URL. Query string parameters Query string parameter Required […]

The post Get Survey Variables appeared first on SnapSurveys.

]]>
Get details of all of the variables for a survey.

Changes from v1.0

  • A new ‘includeCodes’ query parameter has been added. If the ‘includeCodes’ query parameter is omitted, or if it is set to true, then the response body will include a list of codes for the variable. Each code will contain a ‘codeIndex’, ‘codeValue’ and ‘codeLabel’ property.
  • The response now shows the ‘surveyId’ property at the top and has the variables inside a ‘variable’ property.
  • The ‘id’ property has been removed from the response.

Endpoint

MethodURL
GETsurveys/{surveyId}/variables

Gets the details for a specific survey ID.

Parameters

Path parameters

Path parameterDescription
{surveyId}The id of the survey. This is the survey GUID and not the Interview URL.

Query string parameters

Query string parameter Required / Optional Description Type Range Default
includeCodesOptionalWhether to return code information for the variable in the response.BooleanN/Atrue

Sample Request

curl --location --request GET 'http://<servername>/snaponline/api/surveys/e819df57-0a01-4592-a7aa-8918dbe54e00/variables' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2.0'

(In the above code, replace {APIKEY} with your actual API key and {USERNAME} with your actual username.)

Sample Response

200 OK with body (when ‘includeCodes’ is false):

{
    "surveyId": "6834a5f1-46e5-4b12-9e0c-a38a3d9be12c",
    "variables": [        
        {
            "order": 14,
            "variableId": "V46",
            "label": "What was the main form of transport used to get to the at...",
            "name": "Q1",
            "questionText": "What was the main form of transport used to get to the attraction?",
            "variableTypeId": 6,
            "responseTypeId": 1,
            "variableType": "Question",
            "responseType": "Single",
            "codeCount": 7
        },
        {
            "order": 15,
            "variableId": "V48",
            "label": "Which facilities did you visit?",
            "name": "Q2",
            "questionText": "Which facilities did you visit?",
            "variableTypeId": 6,
            "responseTypeId": 2,
            "variableType": "Question",
            "responseType": "Multiple",
            "codeCount": 3
        },
        {
            "order": 16,
            "variableId": "V52",
            "label": "Please tell us if there were any issues, otherwise leave ...",
            "name": "Q3",
            "questionText": "Please tell us if there were any issues, otherwise leave blank.",
            "variableTypeId": 6,
            "responseTypeId": 4,
            "variableType": "Question",
            "responseType": "Literal",
            "codeCount": 0
        }
    ]
}

200 OK with body (when ‘includeCodes’ is true):

{
    "surveyId": "6834a5f1-46e5-4b12-9e0c-a38a3d9be12c",
    "variables": [        
        {
            "order": 14,
            "variableId": "V46",
            "label": "What was the main form of transport used to get to the at...",
            "name": "Q1",
            "questionText": "What was the main form of transport used to get to the attraction?",
            "variableTypeId": 6,
            "responseTypeId": 1,
            "variableType": "Question",
            "responseType": "Single",
            "codeCount": 7,
            "codes": [
                {
                    "codeIndex": 1,
                    "codeValue": 3,
                    "codeLabel": "Walk"
                },
                {
                    "codeIndex": 2,
                    "codeValue": 5,
                    "codeLabel": "Bike"
                },
                {
                    "codeIndex": 3,
                    "codeValue": 8,
                    "codeLabel": "Motorbike"
                },
                {
                    "codeIndex": 4,
                    "codeValue": 4,
                    "codeLabel": "Car"
                },
                {
                    "codeIndex": 5,
                    "codeValue": 6,
                    "codeLabel": "Bus"
                },
                {
                    "codeIndex": 6,
                    "codeValue": 9,
                    "codeLabel": "Train"
                },
                {
                    "codeIndex": 7,
                    "codeValue": 10,
                    "codeLabel": "Plane"
                }
            ]
        },
        {
            "order": 15,
            "variableId": "V48",
            "label": "Which facilities did you visit?",
            "name": "Q2",
            "questionText": "Which facilities did you visit?",
            "variableTypeId": 6,
            "responseTypeId": 2,
            "variableType": "Question",
            "responseType": "Multiple",
            "codeCount": 3,
            "codes": [
                {
                    "codeIndex": 1,
                    "codeValue": 1,
                    "codeLabel": "Restaurant / Cafe"
                },
                {
                    "codeIndex": 2,
                    "codeValue": 2,
                    "codeLabel": "Gift Shop"
                },
                {
                    "codeIndex": 3,
                    "codeValue": 3,
                    "codeLabel": "Customer Services"
                }
            ]
        },
        {
            "order": 16,
            "variableId": "V52",
            "label": "Please tell us if there were any issues, otherwise leave ...",
            "name": "Q3",
            "questionText": "Please tell us if there were any issues, otherwise leave blank.",
            "variableTypeId": 6,
            "responseTypeId": 4,
            "variableType": "Question",
            "responseType": "Literal",
            "codeCount": 0,
            "codes": []
        }
    ]
}

Response Definitions

Response Item Description Data Type
surveyIdThe survey Id.String: containing GUID
variablesThe list of variables.List: containing objects
variables/orderThe positional order of the variable.Integer
variables/variableIdThe V number of the variableString
variables/labelThe label of the variable.String
variables/nameThe name of the variable.String
variables/questionTextThe question text of the variable. i.e. the question shown to the respondent.String
variables/variableTypeIdThe numeric code for the variable type.Integer:

Unknown = 0, Precoded = 1, Numeric = 2, Alphanumeric = 3, Derived = 5, Question = 6, Note = 7
variables/responseTypeIdThe numeric code for the response type.Integer:   Unknown = 0, Single = 1, Multiple = 2, Quantity = 3, Literal = 4, None = 5, Date = 6, Time = 7
variables/variableTypeThe type of the variable.String:   “Unknown”, “Precoded”, “Numeric”, “Alphanumeric”, “Derived”, “Question”, “Note”.
variables/responseTypeThe response type of the answer.String:

“Unknown”, “Single”, “Multiple”, “Quantity”, “Literal”, “None”, “Date”, “Time”
variables/codeCountIf a choice question this states the number of codes. If not a choice question then this will be 0.Integer
variables/codesA list of variable codes. This section will only appear if the ‘includeCodes’ query parameter is true or omitted AND the variable is a choice question.List: containing Objects
variables/codes/codeIndexThe index of the variable code.Integer
variables/codes/codeValueThe value of the variable code.Integer
variables/codes/codeLabelThe label of the variable code.String

HTTP Status Codes

  • 200 OK

Other API calls

The post Get Survey Variables appeared first on SnapSurveys.

]]>
Get Survey https://www.snapsurveys.com/support-snapxmp/snapxmp/api-get-survey/ Thu, 23 Sep 2021 10:51:13 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=6488 Get details of a survey. Changes from v1.0 Endpoint Method URL GET surveys/{surveyId} Gets the details of a specific survey identified by the surveyId path variable. Parameters Path parameters Path parameter Description {surveyId} The id of the survey. This is the survey GUID and not the Interview URL. Query string parameters None Sample Request (In […]

The post Get Survey appeared first on SnapSurveys.

]]>
Get details of a survey.

Changes from v1.0

  • The ‘displayName’ property is now called ‘name’.
  • The ‘questionnaireTitle’ property is now called ‘title’.
  • An ‘ownerId’ property has been added. This gives the owner’s id (GUID)
  • An ‘ownerName’ property has been added. This is the owner’s user name.
  • A ‘path’ property has been added. This is the path up to the survey as an array. E.g. A survey called ‘Survey001’ in folder ‘New Surveys’ in the user’s account will show as “Your work”, New Surveys” and the name will be ‘Survey001’.
  • The interviewingState property has a different set of possible values. In v1 they were: “NotStarted”, “Live”, “Paused” and “Stopped”. In v2 they are: “NotStarted”, “Started”, “Paused”, “Stopped”, “TooManyRespondents” and “Unknown”.

Endpoint

MethodURL
GETsurveys/{surveyId}

Gets the details of a specific survey identified by the surveyId path variable.

Parameters

Path parameters

Path parameterDescription
{surveyId}The id of the survey. This is the survey GUID and not the Interview URL.

Query string parameters

None

Sample Request

curl --location --request GET 'http://<servername>/snaponline/api/surveys/e819df57-0a01-4592-a7aa-8918dbe54e00' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2.0'

(In the above code, replace {APIKEY} with your actual API key and {USERNAME} with your actual username.)

Sample Response

200 OK with body:

{
        "id": "6834a5f1-46e5-4b12-9e0c-a38a3d9be12c", 
        "ownerId": "644f58a7-8526-4901-af7d-20969e5c68e4", 
        "ownerName": "sb4@titan.local", 
        "name": "APIv2 Example Survey", 
        "path": [ 
            "Your work", 
            "APIv2"
        ], 
        "title": "APIv2 Example Survey", 
        "url": "https:// <servername>/snaponline/Home/Index/6834a5f1-46e5-4b12-9e0ca38a3d9be12c", 
        "interviewUrl": "https:// <servername>/interview/6834a5f1-46e5-4b12-9e0ca38a3d9be12c", 
        "interviewPreviewUrl": "https:// <servername>/interview/6834a5f1-46e5-4b12-
9e0c-a38a3d9be12c?preview=true", 
        "isPublished": true, 
        "interviewingState": "Live", 
        "numberOfResponses": 4, 
        "numberOfPartials": 0, 
        "responsesLastChanged": "2022-06-09T13:40:25.7"
}

Response Definitions

Response ItemDescriptionData Type
idThe survey Id.String: containing a GUID
ownerIdThe owner Id of the survey.String: containing GUID
ownerName The owner name of the survey.String
nameThe display name of the survey.String
pathThe path to the survey. List: containing strings
titleThe title used in the questionnaire.String
urlThe url of the survey in Snap Online.String
interviewUrlThe interview url.String
interviewPreviewUrlThe preview interview url.String
isPublishedWhether the survey is published.Boolean
interviewingStateThe current interviewing state.String:
“NotStarted”,
“Started” – when live,
“Paused”,
“Stopped” – when closed,
“TooManyRespondents”,
“Unknown”
numberOfResponsesThe number of responses submitted.Integer
numberOfPartialsThe number of partial responses.Integer
responsesLastChanged
The date and time that the list of responses for the survey was last changed, i.e. response added, deleted or edited.String: containing DateTime

HTTP Status Codes

  • 200 OK

Other API calls

The post Get Survey appeared first on SnapSurveys.

]]>
Get Survey List https://www.snapsurveys.com/support-snapxmp/snapxmp/api-get-survey-list/ Thu, 23 Sep 2021 10:50:17 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=6479 Get a list of surveys that are accessible by the user. This includes surveys that are shared to the user. Changes from v1.0 Endpoint Method URL GET surveys Get a list of surveys that are accessible by the user. Parameters Path parameters None Query string parameters None Sample Request (In the above code, replace {APIKEY} […]

The post Get Survey List appeared first on SnapSurveys.

]]>
Get a list of surveys that are accessible by the user. This includes surveys that are shared to the user.

Changes from v1.0

  • Response JSON is now in name property order.
  • The ‘displayName’ property is now called ‘name’.
  • The ‘questionnaireTitle’ property is now called ‘title’.
  • An ‘ownerId’ property has been added. This gives the owner’s id (GUID).
  • An ‘ownerName’ property has been added. This is the owner’s username.
  • A ‘path’ property has been added. This is the path up to the survey as an array. E.g. A survey called ‘Survey001’ in folder ‘New Surveys’ in the user’s account will show as “Your work”, New Surveys” and the name will be ‘Survey001’.
  • The interviewingState property has a different set of possible values. In v1 they were: “NotStarted”, “Live”, “Paused” and “Stopped”. In v2 they are: “NotStarted”, “Started”, “Paused”, “Stopped”, “TooManyRespondents” and “Unknown”.

Endpoint

MethodURL
GETsurveys

Get a list of surveys that are accessible by the user.

Parameters

Path parameters

None

Query string parameters

None

Sample Request

curl --location --request GET 'http://<servername>/snaponline/api/surveys' \
--header 'X-USERNAME: {USERNAME}' \
--header 'X-API-KEY: {APIKEY}' \
--header 'X-VERSION: 2.0'

(In the above code, replace {APIKEY} with your actual API key and {USERNAME} with your actual username.)

Sample Response

200 OK with body:

[
    {
        "id": "2c4be70c-fe6d-4883-9fd3-629943bec836",
        "ownerId": "644f58a7-8526-4901-af7d-20969e5c68e4", 
        "ownerName": "sb4@titan.local", 
        "name": "APIv2 Example Survey", 
        "path": [ 
            "Your work", 
            "APIv2"
        ], 
        "title": "APIv2 Example Survey", 
        "url": "https:// <servername>/snaponline/Home/Index/6834a5f1-46e5-4b12-9e0c-a38a3d9be12c", 
        "interviewUrl": "https:// <servername>/interview/6834a5f1-46e5-4b12-9e0ca38a3d9be12c", 
        "interviewPreviewUrl": "https:// <servername>/interview/6834a5f1-46e5-4b12-9e0c-a38a3d9be12c?preview=true", 
        "isPublished": true, 
        "interviewingState": "Live", 
        "numberOfResponses": 4, 
        "numberOfPartials": 0
    },
    {
        "id": "de8e8ca3-b7e7-4810-93e6-84c65da7e7aa",
        "ownerId": "644f58a7-8526-4901-af7d-20969e5c68e4", 
        "ownerName": "sb4@titan.local", 
        "name": "Test 1", 
        "path": [ 
            "Your work"
        ], 
        "title": "", 
        "url": "https:// <servername>/snaponline/Home/Index/faae664a-0287-459b83f8-782cafae8622", pg. 18 issue 2.3
        "interviewUrl": "https:// <servername>/interview/faae664a-0287-459b-83f8-782cafae8622", 
        "interviewPreviewUrl": "https:// <servername>/interview/faae664a-0287-459b83f8-782cafae8622?preview=true", 
        "isPublished": false, 
        "interviewingState": "NotStarted", 
        "numberOfResponses": 0, 
        "numberOfPartials": 0, 
        "responsesLastChanged": "2022-06-09T13:40:25.7"
    }
]

Response Definitions

Response ItemDescriptionData Type
idThe survey Id.String: containing a GUID
ownerIdThe owner Id of the survey.String: containing a GUID
ownerNameThe owner name of the survey.String
nameThe display name of the survey.String
pathThe path to the survey.List: containing strings
titleThe title used in the questionnaire.String
urlThe url of the survey in Snap Online.String
interviewUrlThe interview url.String
interviewPreviewUrlThe preview interview url.String
isPublishedWhether the survey is published.Boolean
interviewingStateThe current interviewing state.String:
“NotStarted”,
“Started” – when live,
“Paused”,
“Stopped” – when closed,
“TooManyRespondents”,
“Unknown”
numberOfResponsesThe number of responses submitted.Integer
numberOfPartialsThe number of partial responses.Integer
responsesLastChanged
The date and time that the list of responses for the survey was last changed, i.e. response added, deleted or edited.String: containing DateTime

HTTP Status Codes

  • 200 OK

Other API calls

The post Get Survey List appeared first on SnapSurveys.

]]>
Recommendation https://www.snapsurveys.com/support-snapxmp/snapxmp/api-recommendation/ Thu, 23 Sep 2021 09:34:35 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=6477 Prior to creating your code we strongly recommend that you make use of a tool called Postman. Postman can be installed on a PC or accessed via a web browser. It is free for most of the tasks that an API consuming developer would want to achieve. Postman allows the developer to “play” with an […]

The post Recommendation appeared first on SnapSurveys.

]]>
Prior to creating your code we strongly recommend that you make use of a tool called Postman. Postman can be installed on a PC or accessed via a web browser. It is free for most of the tasks that an API consuming developer would want to achieve. Postman allows the developer to “play” with an API prior to writing any code. Once the request has been formulated in Postman it can then be used to give a head start to writing the code.

The post Recommendation appeared first on SnapSurveys.

]]>
HTTP Status Codes https://www.snapsurveys.com/support-snapxmp/snapxmp/api-http-status-codes/ Thu, 23 Sep 2021 09:33:16 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=6475 As well as specific return codes listed in the API Reference section, all end-points can return the following HTTP status codes: HTTP status code Description 400 Bad Request If a query parameter is incorrect or does not exist or is not provided when not optional. Note: This is a change from v1.0 version. 401 Unauthorized […]

The post HTTP Status Codes appeared first on SnapSurveys.

]]>
As well as specific return codes listed in the API Reference section, all end-points can return the following HTTP status codes:

HTTP status codeDescription
400 Bad RequestIf a query parameter is incorrect or does not exist or is not provided when not optional.
Note: This is a change from v1.0 version.
401 UnauthorizedIf the user does not exist or API access is not enabled for the user or the X-API-KEY parameter is incorrect.
If the end-point requires a surveyId and either the survey does not exist or the user does not have access to the survey.
429 Too Many RequestsToo many API requests have been made.
Further information is available at Handling throttling.
500 Internal Server ErrorUnanticipated system error

The post HTTP Status Codes appeared first on SnapSurveys.

]]>
Versioning https://www.snapsurveys.com/support-snapxmp/snapxmp/api-versioning/ Thu, 23 Sep 2021 09:19:26 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=6473 From time to time we need to make changes to the API. In order to prevent our changes from breaking your client code we will employ the following versioning strategy. Versioning is achieved by use of request and response headers. If you don’t specify a version in your request, then you will be using the […]

The post Versioning appeared first on SnapSurveys.

]]>
From time to time we need to make changes to the API. In order to prevent our changes from breaking your client code we will employ the following versioning strategy.

Versioning is achieved by use of request and response headers.

If you don’t specify a version in your request, then you will be using the v1.0 version of the API.

The following response header tells you which versions are available:

  • api-supported-versions

The value is a comma-separated list of versions.

To use a new version you have to supply the following header parameter in the request:

  • X-VERSION

Set the value to the version that you require.

You should check to see whether use of the new version is advised and what changes (if any) you
need to make to your code in order to use a new version.

Note. At some point it may become necessary to deprecate a version. We will strive to avoid this but sometimes it is unavoidable. We will give you plenty of notice.

Breaking changes

A breaking change is a change that may require you to make changes to your integration. The following are examples of changes we consider to be breaking changes:

  • Removal of a parameter, request field or response field
  • Addition of a required parameter or request field without default values
  • Changes to the intended functionality of an endpoint
  • Introduction of additional validation

A non-breaking change is a change that should not require you to make changes to your integration. In most cases, we will communicate non-breaking changes after they have been released.

Please ensure that your application is designed to be able to handle the following types of non-breaking
changes:

  • Addition of new endpoints
  • Addition of new methods to existing endpoints
  • Addition of new fields in the following scenarios:
    • New fields in responses
    • New optional request fields or parameters
    • New required request fields that have default values
  • Addition of a new value returned for an existing text field
  • Changes to the order of fields returned within a response
  • Addition of an optional request header
  • Removal of redundant request header
  • Changes to the length of data returned within a field
  • Changes to the overall response size
  • Changes to error messages. We do not recommend parsing error messages to perform business logic. Instead, you should only rely on HTTP response codes and error codes.
  • Fixes to HTTP response codes and error codes from incorrect code to correct code

The post Versioning appeared first on SnapSurveys.

]]>
Handling Throttling https://www.snapsurveys.com/support-snapxmp/snapxmp/api-handling-throttling/ Thu, 23 Sep 2021 09:17:33 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=6471 To protect the resources of Snap XMP Online we have implemented throttling. This means that some of your API calls may return a status code of 429 – Too many requests. You should ensure that you don’t attempt to make more than one call per second or more than ten calls per minute. One way […]

The post Handling Throttling appeared first on SnapSurveys.

]]>
To protect the resources of Snap XMP Online we have implemented throttling. This means that some of your API calls may return a status code of 429 – Too many requests.

You should ensure that you don’t attempt to make more than one call per second or more than ten calls per minute. One way to achieve this is to perform a “sleep” in between calls.

We reserve the right to change the throttling limits at any time.

Current throttling metrics are returned in the following response headers:

Response headerDescription
X-RateLimit-Limit-Per-Secthe current limit per second
X-RateLimit-Remaining-Per-Sechow many requests are remaining in this second period. This can be negative.
X-RateLimit-Reset-Per-Secthe UNIX time of when the next request is allowed
X-RateLimit-Limit-Per-Minthe current limit per minute
X-RateLimit-Remaining-Per-Minhow many requests are remaining in this minute period. This can be negative.
X-RateLimit-Reset-Per-Minthe UNIX time of when the next request is allowed

Ideally, when a 429 status code is received your code should automatically change its “sleep” behaviour based on these metrics. Alternatively, you may decide to wait say 15 seconds between calls which should satisfy all future per second and per minute requirements.

The post Handling Throttling appeared first on SnapSurveys.

]]>
Security https://www.snapsurveys.com/support-snapxmp/snapxmp/api-security/ Thu, 23 Sep 2021 09:06:27 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=6466 The API is stateless so each API call needs to be authenticated. Each call to the API must include the following request headers: Creating the key To create the key for the user’s account do the following: Your API key is now in the clipboard and you can paste this into your API calls. Failure […]

The post Security appeared first on SnapSurveys.

]]>
The API is stateless so each API call needs to be authenticated. Each call to the API must include the following request headers:

  • X-USERNAME containing the Snap XMP Online email address for the user
  • X-API-KEY containing the API key for the user

Creating the key

To create the key for the user’s account do the following:

  1. Log onto Snap XMP Online.
  2. Go to the Your account section.
  1. Click on the Integrations link.
  1. Click the Generate key button.
Note: This API key is shown as an example. Your API key should remain private.
  1. Click the Copy to clipboard button.

Your API key is now in the clipboard and you can paste this into your API calls.

Failure to include the X-USERNAME and X-API-KEY header parameters, or an incorrect X-API-KEY or use of a revoked API token will result in a 401 – Unauthorised response code, from all API calls.

Note: You should never reveal your API key to anyone or add it to code that is publicly accessible – this includes code in JavaScript files that is easily viewed using the Developer tools in a web browser.

Failure to secure your API key could result in your data being accessible by someone else.

If you think your API key has become known, then you should revoke your key (with the Revoke now button on the Integrations page) or replace the key (with the Replace key button which will make the previous key no longer usable). You will then have to change your client code to use the new key.

The post Security appeared first on SnapSurveys.

]]>
Introduction https://www.snapsurveys.com/support-snapxmp/snapxmp/api-introduction/ Wed, 22 Sep 2021 15:42:29 +0000 https://www.snapsurveys.com/support-snapxmp/?post_type=epkb_post_type_1&p=6464 The Snap XMP Online API (application programming interface) allows customers to access the data in their account programmatically. Note that if you give anyone else API access to your account you will be giving them access to all of your surveys and all of your survey responses and (depending on the share permissions) access to […]

The post Introduction appeared first on SnapSurveys.

]]>
The Snap XMP Online API (application programming interface) allows customers to access the data in their account programmatically.

Note that if you give anyone else API access to your account you will be giving them access to all of your surveys and all of your survey responses and (depending on the share permissions) access to all surveys and survey responses shared to you by others. Do not give anyone API access if this will be a problem for you.

The API is a RESTful API (Representational State Transfer). It utilises the HTTP transport mechanism and is stateless. Data submitted in the body of a request and data returned in the body of the response is in the JSON format. The API only supports the JSON representation at present. We may allow other representations such as XML in future versions.

Each call made to the API is stateless and as such each call must include the authorisation information. The return from each call consists of a standard HTTP response which consists of a HTTP response code, response body and response headers.

Please note that from Monday 5th December 2022 usage of the API becomes chargeable. The charge is that 0.1 unit will be consumed each time a survey response is delivered by the API.  This applies if the API delivers the same survey response multiple times. Use the Get Survey Responses endpoint to deliver the survey responses.

The post Introduction appeared first on SnapSurveys.

]]>