Matrix question:-
To get all questions: GET https://api.surveysparrow.com/v3/questions?=survey_id={surveyId}
Sample response:-
{
"data": [
{
"id": 100001141, // parent question id;
"type": "Matrix",
},
"parent_question_id": null,
"position": "0.000000000000",
"created_at": "2023-11-14T11:43:21.229Z",
"updated_at": "2023-11-14T11:43:35.447Z",
"section": {
"position": "0.000000000000000",
"title": null
},
"annotations": [],
"scale_points": [
{
"id": 100000069,
"name": "sp1",
"position": "0.000000000000"
},
{
"id": 100000070,
"name": "sp2",
"position": "1.000000000000"
}
],
"choices": [
{
"id": 100000566, // can be used in answers array "txt": "",
"img": null,
"position": "0.000000000000",
"question_id": 100001141,
"scale_point_id": 100000069
},
{
"id": 100000567, // can be used in answers array "txt": "",
"img": null,
"position": "0.000000000000",
"question_id": 100001141,
"scale_point_id": 100000070
}
],
"tags": []
},
{
"id": 100001142, // actual question id to be used in api "rtxt": "st1",
"type": "Matrix_Statement",
"parent_question_id": 100001141, // parent question id
"position": "0.000000000000",
"created_at": "2023-11-14T11:43:21.392Z",
"updated_at": "2023-11-14T11:43:38.596Z",
"choices": [],
"tags": []
},
{
"id": 100001143, // actual question id to be used in api "rtxt": "st2",
"type": "Matrix_Statement",
"parent_question_id": 100001141, // parent question id
"position": "1.000000000000",
"created_at": "2023-11-14T11:43:21.392Z",
"updated_at": "2023-11-14T11:43:40.723Z",
"scale_points": [],
"choices": [],
"tags": []
}
],
"has_next_page": false
}
To Create a response:- POST https://api.surveysparrow.com/v3/responses
Example-1 for radio type
{
"survey_id": 100000239, "answers": [
{
"question_id": 100001142,
"parent_question_id": 100001141,
"answer": [100000566] // array of choice id
}
]
}
Example-2 for checkbox type
{
"survey_id": 100000239, "answers": [
{
"question_id": 100001142,
"parent_question_id": 100001141,
"answer": [100000566, 100000567] // array of choice id
}
]
}
Example-3 for text box type
{
"survey_id": 100000239, "answers": [
{
"question_id": 100001142,
"parent_question_id": 100001141,
"answer": [100000566, 100000567], // array of choice id "matrix_txt": ["aaa", "bbb"] // array of texts
}
]
}
Example-4 for rating type
{
"survey_id": 100000239, "answers": [
{
"question_id": 100001142,
"parent_question_id": 100001141,
"answer": [100000566, 100000567], // array of choice id "matrix_int": [4, 3] // array of ratings
}
]
}
Contact Form question:-
To get all questions: GET https://api.surveysparrow.com/v3/questions?=survey_id={surveyId}
Sample response:-
{
"data": [
{
"id": 100001155,
"rtxt": "Contact Form",
"type": "ContactForm",
"choices": [],
"tags": []
},
{
"id": 100001156, // actual question id to be used in api "rtxt": "Name",
"type": "ContactForm_Name",
"multiple_answers": false,
"is_required": true,
"properties": {
"data": {
"type": "string",
"name": "name"
}
},
"parent_question_id": 100001155,
"choices": [],
"tags": []
},
{
"id": 100001157, // actual question id to be used in api "rtxt": "Email",
"type": "ContactForm_Email",
"multiple_answers": false,
"is_required": true,
"properties": {
"data": {
"type": "email",
"name": "email"
}
},
"parent_question_id": 100001155,
"choices": [],
"tags": []
},
{
"id": 100001161, // actual question id to be used in api "rtxt": "City",
"type": "ContactForm_City",
"multiple_answers": false,
"is_required": true,
"properties": {
"data": {
"type": "string",
"name": "city"
}
},
"parent_question_id": 100001155,
"choices": [],
"tags": []
},
{
"id": 100001162, // actual question id to be used in api "rtxt": "State",
"type": "ContactForm_State",
"multiple_answers": false,
"is_required": true,
"properties": {
"data": {
"type": "string",
"name": "state"
}
},
"parent_question_id": 100001155,
"choices": [],
"tags": []
},
{
"id": 100001163, // actual question id to be used in api "rtxt": "Country",
"type": "ContactForm_Country",
"multiple_answers": false,
"is_required": true,
"properties": {
"data": {
"type": "string",
"name": "country"
}
},
"parent_question_id": 100001155,
"choices": [],
"tags": []
},
{
"id": 100001165, // actual question id to be used in api "rtxt": "Company",
"type": "ContactForm_Company",
"multiple_answers": false,
"is_required": true,
"properties": {
"data": {
"type": "string",
"name": "company"
}
},
"parent_question_id": 100001155,
"tags": []
}
],
"has_next_page": false
}
Sample API payload:- POST https: //api.surveysparrow.com/v3/responses
{
"survey_id": 100000239,
"answers": [
{
"question_id": 100001156,
"parent_question_id": 100001155,
"answer": "hello"
},
{
"question_id": 100001157,
"parent_question_id": 100001155,
"answer": "hello@test.com"
},
{
"question_id": 100001161,
"parent_question_id": 100001155,
"answer": "hogwarts"
},
{
"question_id": 100001165,
"parent_question_id": 100001155,
"answer": "HP&Co."
}
]
}
Comments
0 comments
Please sign in to leave a comment.