Get Survey Variable
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
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 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 |
---|---|---|
surveyId | The survey Id. | String: containing GUID |
variable | The variable. | Object |
variable/order | The positional order of the variable. | Integer |
variable/variableId | The V number of the variable | String |
variable/label | The label of the variable. | String |
variable/name | The name of the variable. | String |
variable/questionText | The question text of the variable. i.e. the question shown to the respondent. | String |
variable/variableTypeId | The numeric code for the variable type. | Integer: Unknown = 0, Precoded = 1, Numeric = 2, Alphanumeric = 3, Derived = 5, Question = 6, Note = 7 |
variable/responseTypeId | The numeric code for the response type. | Integer: Unknown = 0, Single = 1, Multiple = 2, Quantity = 3, Literal = 4, None = 5, Date = 6, Time = 7 |
variable/variableType | The type of the variable. | String: “Unknown”, “Precoded”, “Numeric”, “Alphanumeric”, “Derived”, “Question”, “Note”. |
variable/responseType | The response type of the answer. | String: “Unknown”, “Single”, “Multiple”, “Quantity”, “Literal”, “None”, “Date”, “Time” |
variable/codeCount | If a choice question this states the number of codes. If not a choice question then this will be 0. | Integer |
variable/codes | A list of codes. | List: containing objects |
variable/codes/codeIndex | The index of the variable code. | Integer |
variable/codes/codeValue | The value of the variable code. | Integer |
variable/codes/codeLabel | The label of the variable code. | String |
HTTP Status Codes
- 200 OK
- 404 Not Found – if survey variable does not exist.
Other API calls
- Get Survey List
- Get Survey
- Get Survey Variables
- Get Survey Responses
- Get User Info
- Get Participant List
- Get Participant
- Add Participant
- Update Participant
- Delete Participant
- Get Participants Subjects
- Get Participant Subject
- Add Participant Subject
- Update Participant Subject
- Delete Participant Subject