Snap XMP Help

Get Survey List

You are here:
< All Topics

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

Contents