Snap XMP Help

Get Survey

You are here:
< All Topics

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

Contents