API Basics
How can I test my Survey REST/JSON API?
Go to: Integration >> API/Data Flow >> Developer API >> REST/JSON API
1. Screenshot
How can I test my Panel REST/JSON API?
www.surveyanalytics.com/a/api/surveyanalytics.micropanel. {FUNCTION-NAME} ?apiKey= {API-KEY}
Where
{API-KEY}:
To set up API Key, go to:
- Login » Surveys » Communities » (Select Community) » SurveySwipe » API Key
2. Screenshot
Now Using API Key Panel API call will look like:
http://www.surveyanalytics.com/a/api/surveyanalytics.micropanel.panelMemberUpdate?apiKey=01ded258-c03a-4cfa-bd1a-89b55b4f318f
Now Go to: Integration >> API/Data Flow >> Developer API >> REST/JSON API
Paste the Panel API URL to API URL and click on Submit
3. Screenshot
surveyResponse
Purpose |
You can use this surveyResponses API to retrieve responses based on the filtering criteria |
||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Request URL |
www.surveyanalytics.com/a/api/surveyanalytics.survey.surveyResponses?apiKey={API-KEY} |
||||||||||||||||||||||||||||||||||||||||||||||||||||
Request Parameters |
* - Mandatory parameter |
||||||||||||||||||||||||||||||||||||||||||||||||||||
JSON Data Format | The JSON Format contains the key value pair of the required parameter. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Input JSON Parameters |
* - Mandatory parameter. All the parameter names are Case Sensitive. Either both Start Date and End Date have to be entered else neither
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
Input JSON Example |
{ "id": 3154843, "startingResponseCounter": 0, "resultMode": 0, "startDate": "2014-11-24T15:48:58", "endDate": "2014-11-24T17:48:58" } |
||||||||||||||||||||||||||||||||||||||||||||||||||||
Response (Output) JSON Parameters |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
Response (Output) JSON Example |
{ "response":{ "id":3154843, "name":"Survey API Test", "responseCount":3, "responses":[ { "timestamp":"2014-08-18 23:43:26.0", "responseID":8046001, "regionCode":"16", "results":[ { "index":1, "questionID":29901782 }, { "index":4, "questionID":29901783 }, { "index":5, "questionID":29901783 }, { "index":1, "questionID":29901784 } ], "customVariables":[ ], "countryCode":"IN", "timeTaken":20, "ipAddress":"115.112.111.66" }, { "timestamp":"2014-08-18 23:43:54.0", "responseID":8046003, "regionCode":"16", "results":[ { "index":2, "questionID":29901782 }, { "index":3, "questionID":29901783 }, { "index":2, "questionID":29901784 } ], "customVariables":[ ], "countryCode":"IN", "timeTaken":15, "ipAddress":"115.112.111.66" }, { "timestamp":"2014-08-18 23:44:14.0", "responseID":8046005, "regionCode":"16", "results":[ { "index":3, "questionID":29901782 }, { "index":1, "questionID":29901783 }, { "index":1, "questionID":29901784 } ], "customVariables":[ ], "countryCode":"IN", "timeTaken":15, "ipAddress":"115.112.111.66" } ], "metaData":[ { "questionID":29901782, "questionText":"Single select Question?", "answers":[ { "index":1, "answerText":"Weekly" }, { "index":2, "answerText":"Monthly" }, { "index":3, "answerText":"Quarterly" }, { "index":4, "answerText":"Annually" } ] }, { "questionID":29901783, "questionText":"Multiple Select Question?", "answers":[ { "index":1, "answerText":"Visa" }, { "index":2, "answerText":"Mastercard" }, { "index":3, "answerText":"American Express" }, { "index":4, "answerText":"Discover" }, { "index":5, "answerText":"Diners Club" } ] }, { "questionID":29901784, "questionText":"Drop Down Menu?", "answers":[ { "index":1, "answerText":"Male" }, { "index":2, "answerText":"Female" } ] } ] }, "status":{ "message":"OK", "id":200, "method":"surveyanalytics.survey.surveyResponses", "serverUTC":1408430727496, "url":"/a/api/surveyanalytics.survey.surveyResponses", "apiKey":"96bee62d-7c3c-486f-8e34-91df1806d887" } } |
responseCount
Purpose |
You can use this responseCount API to get started, terminated and completed response count for the specified survey and criteria. |
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Request URL |
www.surveyanalytics.com/a/api/surveyanalytics.survey.responseCount?apiKey={API-KEY} |
||||||||||||
Request Parameter |
* - Mandatory parameter |
||||||||||||
Input JSON Parameters |
* - Mandatory parameter. All the parameter names are Case Sensitive. Either both Start Date and End Date have to be entered else neither
|
||||||||||||
Input JSON Example |
{"id":3119678, "startDate":"2014-11-24T15:48:58", "endDate":"2014-11-24T17:48:58"} |
||||||||||||
Response (Output) JSON Parameters |
|
||||||||||||
Response (Output) JSON Example |
{"response":{"id":3643,"name":"Survey API Test","startedCount":3,"terminatedCount":0,"completeCount":3},"status":{"message":"OK","id":200,"method":"surveyanalytics.survey.responseCount","serverUTC":1374483638575,"url":"/a/api/surveyanalytics.survey.responseCount","apiKey":"77407dc0-9c05-4d5d-afe6-1d65c15ada64"}} |
sendSurvey
Purpose |
You can use this sendSurvey API to send survey to single respondent. |
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Request URL |
www.surveyanalytics.com/a/api/surveyanalytics.survey.sendSurvey?apiKey={API-KEY} |
||||||||||||
Request Parameters |
* - Mandatory parameter |
||||||||||||
JSON Data Format |
The JSON Format contains the key value pair of the required parameter. |
||||||||||||
Input JSON Parameters |
* - Mandatory parameter. All the parameter names are Case Sensitive. |
||||||||||||
Input JSON Example |
{"id":3643, "sendToEmailAddress": "[email protected]", "sendToEmailText":"hello, test email.", "sendToEmailSubject":"test email subject"} |
||||||||||||
Response (Output) JSON Parameters |
|
||||||||||||
Response (Output) JSON Example |
{ "response":{ "id":3643, "name":"Survey API Test", "sendToEmailAddress":"[email protected]", "success":"Email Successfully Sent" }, "status":{ "message":"OK", "id":200, "method":"surveyanalytics.survey.sendSurvey", "serverUTC":1374484093534, "url":"/a/api/surveyanalytics.survey.sendSurvey", "apiKey":"77407dc0-9c05-4d5d-afe6-1d65c15ada64" } } |
surveyStatistics
Purpose |
You can use this surveyStatistics API to retrieve the survey statistics for the specified survey. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Request URL |
www.surveyanalytics.com/a/api/surveyanalytics.survey.surveyStatistics?apiKey={API-KEY} |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Request Parameters |
* - Mandatory parameter |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
JSON Data Format |
The JSON Format contains the key value pair of the required parameter. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Input JSON Parameters |
* - Mandatory parameter. All the parameter names are Case Sensitive. Either both Start Date and End Date have to be entered else neither
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Input JSON Example |
{"id":3119678, "resultMode":0, "startDate":"2014-11-24T15:48:58", "endDate":"2014-11-24T17:48:58"} |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Response (Output) JSON Parameters |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Response (Output) JSON Example |
{ "response":{ "surveyID":3981, "surveyName":"Test Survey", "viewedCount":184, "dropOutCount":118, "startedCount":127, "terminatedCount":0, "completionRate":"7.09%", "averageTimeInSeconds":"38", "completeCount":9, "surveyStatistics":[ { "sectionID":1, "description":"How satisfied are you with the following:", "type":"B", "questions":[ { "id":17598515, "text":"McDonalds", "answers":[ { "id":69126, "text":"Very Unsatisfied", "index":1, "percent":"12.5", "count":1 }, { "id":69127, "text":"Unsatisfied", "index":2, "percent":"0", "count":0 }, { "id":69128, "text":"Neutral", "index":3, "percent":"50", "count":4 }, { "id":69129, "text":"Satisfied", "index":4, "percent":"0", "count":0 }, { "id":69130, "text":"Very Satisfied", "index":5, "percent":"25", "count":2 }, { "id":71258, "text":"N/A", "index":6, "percent":"12.5", "count":1 } ] }, { "id":17598516, "text":"Cafe Coffee Day", "answers":[ { "id":69131, "text":"Very Unsatisfied", "index":1, "percent":"0", "count":0 }, { "id":69132, "text":"Unsatisfied", "index":2, "percent":"28.57", "count":2 }, { "id":69133, "text":"Neutral", "index":3, "percent":"28.57", "count":2 }, { "id":69134, "text":"Satisfied", "index":4, "percent":"14.29", "count":1 }, { "id":69135, "text":"Very Satisfied", "index":5, "percent":"28.57", "count":2 }, { "id":71259, "text":"N/A", "index":6, "percent":"0", "count":0 } ] }, { "id":17598516, "text":"Starbucks", "answers":[ { "id":69136, "text":"Very Unsatisfied", "index":1, "percent":"0", "count":0 }, { "id":69137, "text":"Unsatisfied", "index":2, "percent":"28.57", "count":2 }, { "id":69138, "text":"Neutral", "index":3, "percent":"42.86", "count":3 }, { "id":69139, "text":"Satisfied", "index":4, "percent":"14.29", "count":1 }, { "id":69140, "text":"Very Satisfied", "index":5, "percent":"14.29", "count":1 }, { "id":71260, "text":"N/A", "index":6, "percent":"0", "count":0 } ] } ] }, { "sectionID":2, "description":"How often do you conduct surveys?", "type":"U", "questions":[ { "id":17598984, "text":"How often do you conduct surveys?", "answers":[ { "id":71267, "text":"Weekly", "index":1, "percent":"50", "count":2 }, { "id":71268, "text":"Monthly", "index":2, "percent":"0", "count":0 }, { "id":71269, "text":"Quarterly", "index":3, "percent":"0", "count":0 }, { "id":71270, "text":"Annually", "index":4, "percent":"50", "count":2 }, { "id":71321, "text":"Other", "index":5, "percent":"0", "count":0 } ] } ] }, { "sectionID":3, "type":"D", "description":[ { "subHeading":["Not Important", "Very Important"], "title":"Importance", "mdmSectionNum":0 } , { "subHeading":["Not Satisfied", "Very Satisfied"], "title":"Satisfaction", "mdmSectionNum":1 } ], "questions":[ { "id":17599138, "text":"Customer Service", "answers":[ { "id":71938, "text":"1", "index":1, "percent":"0", "count":0 }, { "id":71939, "text":"2", "index":2, "percent":"50", "count":1 }, { "id":71940, "text":"3", "index":3, "percent":"50", "count":1 }, { "id":71941, "text":"4", "index":4, "percent":"0", "count":0 }, { "id":71942, "text":"5", "index":5, "percent":"0", "count":0 } ], "mdmSectionNum":0 }, { "id":17599141, "text":"Customer Service", "answers":[ { "id":71953, "text":"1", "index":1, "percent":"0", "count":0 }, { "id":71954, "text":"2", "index":2, "percent":"0", "count":0 }, { "id":71955, "text":"3", "index":3, "percent":"0", "count":0 }, { "id":71956, "text":"4", "index":4, "percent":"100", "count":2 }, { "id":71957, "text":"5", "index":5, "percent":"0", "count":0 } ], "mdmSectionNum":1 }, { "id":17599139, "text":"Product Packaging", "answers":[ { "id":71943, "text":"1", "index":1, "percent":"0", "count":0 }, { "id":71944, "text":"2", "index":2, "percent":"0", "count":0 }, { "id":71945, "text":"3", "index":3, "percent":"50", "count":1 }, { "id":71946, "text":"4", "index":4, "percent":"50", "count":1 }, { "id":71947, "text":"5", "index":5, "percent":"0", "count":0 } ], "mdmSectionNum":0 }, { "id":17599142, "text":"Product Packaging", "answers":[ { "id":71958, "text":"1", "index":1, "percent":"0", "count":0 } , { "id":71959, "text":"2", "index":2, "percent":"0", "count":0 } , { "id":71960, "text":"3", "index":3, "percent":"100", "count":2 } , { "id":71961, "text":"4", "index":4, "percent":"0", "count":0 } , { "id":71962, "text":"5", "index":5, "percent":"0", "count":0 } ], "mdmSectionNum":1 }, { "id":17599140, "text":"On-Time Arrival", "answers":[ { "id":71948, "text":"1", "index":1, "percent":"0", "count":0 } , { "id":71949, "text":"2", "index":2, "percent":"0", "count":0 } , { "id":71950, "text":"3", "index":3, "percent":"0", "count":0 } , { "id":71951, "text":"4", "index":4, "percent":"50", "count":1 } , { "id":71952, "text":"5", "index":5, "percent":"50", "count":1 } ], "mdmSectionNum":0 } , { "id":17599143, "text":"On-Time Arrival", "answers":[ { "id":71963, "text":"1", "index":1, "percent":"0", "count":0 } , { "id":71964, "text":"2", "index":2, "percent":"50", "count":1 } , { "id":71965, "text":"3", "index":3, "percent":"0", "count":0 } , { "id":71966, "text":"4", "index":4, "percent":"0", "count":0 } , { "id":71967, "text":"5", "index":5, "percent":"50", "count":1 } ], "mdmSectionNum":1 } ] } ] }, "status": { "message":"OK", "id":200, "method":"surveyanalytics.survey.surveyStatistics", "serverUTC":1374484093534, "url":"/a/api/surveyanalytics.survey.surveyStatistics", "apiKey":"77407dc0-9c05-4d5d-afe6-1d65c15ada64" } } |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sample Java Code |
import java.util.*; import org.apache.http.client.ResponseHandler; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.BasicResponseHandler; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public class SurveyAnalyticsAPIExample { public static final String API_KEY = "77407dc0-9c05-4d5d-afe6-1d65c15ada64"; public static final String DEVICE_KEY = "lbeud"; public static final String API_URL = "http://api.surveyanalytics.com/a/api/"; public static final String RESPONSE_COUNT_METHOD_NAME = "surveyanalytics.survey.responseCount"; public static final String SURVEY_RESPONSES_METHOD_NAME = "surveyanalytics.survey.surveyResponses"; public long surveyID = 3643; public long getCompletedResponseCount() throws Exception { String path = API_URL + RESPONSE_COUNT_METHOD_NAME + "?apiKey=" + API_KEY + "&deviceKey=" + DEVICE_KEY; DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httpost = new HttpPost(path); String data = "{\"id\":\"" + surveyID + "\",\"resultMode\":\"0\"}"; StringEntity se = new StringEntity(data); httpost.setEntity(se); httpost.setHeader("Accept", "application/json"); httpost.setHeader("Content-type", "application/json"); ResponseHandler responseHandler = new BasicResponseHandler(); Object resp = httpclient.execute(httpost, responseHandler); String json = resp.toString(); JSONObject obj = new JSONObject(json); obj = obj.getJSONObject("response"); return Long.parseLong(obj.getString("completeCount")); } public String getResponses(int startingResponseCounter) throws Exception { String path = API_URL + SURVEY_RESPONSES_METHOD_NAME + "?apiKey=" + API_KEY + "&deviceKey=" + DEVICE_KEY; DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httpost = new HttpPost(path); String data = "{\"id\":\"" + surveyID + "\",\"resultMode\":\"0\",\"startingResponseCounter\":\""+ startingResponseCounter +"\"}"; StringEntity se = new StringEntity(data); httpost.setEntity(se); httpost.setHeader("Accept", "application/json"); httpost.setHeader("Content-type", "application/json"); ResponseHandler responseHandler = new BasicResponseHandler(); Object resp = httpclient.execute(httpost, responseHandler); return resp.toString(); } public void printResponses() throws Exception { long totalResponses = getCompletedResponseCount(); System.out.println("Completed Response Count is: " + totalResponses); String responsesJson = getResponses(0); JSONObject jr = new JSONObject(responsesJson); jr = jr.getJSONObject("response"); JSONArray metaData = jr.getJSONArray("metaData"); Map questionMap = getQuestionMap(metaData); JSONArray responses = jr.getJSONArray("responses"); for (int j=0;j < responses.length();j++) { JSONObject response = (JSONObject)responses.get(j); System.out.println("RESPONSE ID : " + response.getLong("responseID")); System.out.println("Time Taken : " + response.getInt("timeTaken")); System.out.println("Timestamp : " + response.getString("timestamp")); if (response.has("ipAddress")) { System.out.println("IP Address : " + response.getString("ipAddress")); } JSONArray customVariables = response.getJSONArray("customVariables"); for (int k=0; k < customVariables.length(); k++) { JSONObject customVarResult = customVariables.getJSONObject(k); System.out.print("Custom" + customVarResult.getInt("index") + " Value: " + customVarResult.getString("value")); } JSONArray results = response.getJSONArray("results"); //Print result for each question one by one Iterator it = questionMap.values().iterator(); while (it.hasNext()) { Question question = (Question)it.next(); List values = filterResponse(question, results); System.out.println((j+1) + ". Question ID: " + question.questionID); System.out.println((j+1) + ". Question Text: " + question.questionText); System.out.print((j+1) + ". Results: "); if (values.size() == 0) { System.out.println("Not Answered."); } for (int i=0; i < values.size(); i++) { AnswerResponse aR = (AnswerResponse)values.get(i); Answer a = (Answer)question.answerMap.get(String.valueOf(aR.index)); System.out.print((i+1) + ". index=" + aR.index + (aR.text != null ? ", text= " + aR.text : "")); if (aR.rank > 0) { System.out.print(", Rank=" + aR.rank); } if (a.isOther) { System.out.print(", Is Other Type: true"); } if (a.isDynamicText) { System.out.print(", Is Dynamic Text: true"); } //if you want answer Text instead of index System.out.println("Answer Text=" + a.answerText); } } } } private class Question { public long questionID; public String questionText; public boolean hasRank = false; Map answerMap = new HashMap(); } private class Answer { public int index; public boolean isOther = false; public boolean isDynamicText = false; public String answerText; } private class AnswerResponse { public int index = -1; public String text; public int rank = -1; } public Map getQuestionMap(JSONArray metaData) throws JSONException { Map questions = new HashMap(); for (int i=0; i < metaData.length(); i++) { JSONObject obj = metaData.getJSONObject(i); Question question = new Question(); question.questionID = obj.getLong("questionID"); question.questionText = obj.getString("questionText"); //for rank type question if (obj.has("hasRank")) { question.hasRank = true; } JSONArray answers = obj.getJSONArray("answers"); for (int j=0; j < answers.length(); j++) { JSONObject aObj = answers.getJSONObject(j); Answer answer = new Answer(); answer.index = aObj.getInt("index"); answer.answerText = aObj.getString("answerText"); if (aObj.has("dynamicText")) { answer.isDynamicText = true; } if (aObj.has("other")) { answer.isOther = true; } question.answerMap.put(String.valueOf(answer.index), answer); } questions.put(String.valueOf(question.questionID), question); } return questions; } public List filterResponse(Question question, JSONArray questionResults) throws JSONException { List values = new ArrayList(); for (int i=0; i < questionResults.length(); i++) { JSONObject result = questionResults.getJSONObject(i); if (result.getString("questionID").equals(String.valueOf(question.questionID))) { AnswerResponse answerResponse = new AnswerResponse(); answerResponse.index = result.getInt("index"); if (result.has("text")) { answerResponse.text = result.getString("text"); } if (result.has("rank")) { answerResponse.rank = result.getInt("rank"); } values.add(answerResponse); } } return values; } } |
getSurveys
Purpose |
You can use this getSurveys API to retrieve all the active surveys for the account |
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Request URL |
www.surveyanalytics.com/a/api/surveyanalytics.survey.getSurveys?apiKey={API-KEY} |
||||||||||||||||||
Request Parameters |
* - Mandatory parameter |
||||||||||||||||||
Response (Output) JSON Parameters |
|
||||||||||||||||||
Response (Output) JSON Example |
{ "response":{ "surveys:":[ { "id":3159814, "name":"Survey Swipe", "folderName":"DashBoardFolder", "folderID":885263 }, { "id":3151330, "name":"Training Program Interest", "folderName":"Main/Default", "folderID":0 }, { "id":3151329, "name":"NullBugParticipantID", "folderName":"Main/Default", "folderID":0 }, { "id":3148638, "name":"javascriptExicute", "folderName":"Main/Default", "folderID":0 }, { "id":3147610, "name":"Conjoint", "folderName":"Main/Default", "folderID":0 }, { "id":3147591, "name":"test1", "folderName":"Main/Default", "folderID":0 }, { "id":3147590, "name":"test1", "folderName":"Main/Default", "folderID":0 }, { "id":3147170, "name":"test1", "folderName":"Main/Default", "folderID":0 } ] }, "status":{ "message":"OK", "id":200, "method":"surveyanalytics.survey.getSurveys", "serverUTC":1414652080621, "url":"/a/api/surveyanalytics.survey.getSurveys", "apiKey":"9432f6d03-ab73-4bb8-a841-8dc1a91ba6ee" } } |
panelMemberUpdate
Purpose |
You can use the panelMemberUpdate method to update or modify the panel members profile. |
||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Request URL |
www.surveyanalytics.com/a/api/surveyanalytics.micropanel. panelMemberUpdate ?apiKey={ API-KEY } |
||||||||||||||||||||||||||||||
Request Parameters |
* - Mandatory parameter NOTE :- For each member added through API call an email-verification Email will be sent if Double-Opt-In Verification is turned on. To disable got to: Login>>Panels>>Email Preferences>>(New User Email Verification Template)>>(Enable Double Opt/In Verification Email for Web-Signups - Template) |
||||||||||||||||||||||||||||||
JSON Data Format |
The JSON format starts with the panelMembers object which is an array where each element has parameters for the specified panel Member to be updated. Each JSON parameter has been explained below. After the JSON parameters there is an example of JSON structure with explanation. |
||||||||||||||||||||||||||||||
JSON Parameters |
* - Mandatory parameter. All the parameter names are Case Sensitive. |
||||||||||||||||||||||||||||||
Example |
Below is an example of JSON format for updating details for two panel members ([email protected] & [email protected]). For both panel members we are updating four fields. Where profile fields are:
{ "panelMembers":[ { "emailAddress":"[email protected]", "firstName":"abc", "lastName":"last name", "address1":"1234 W Main St.", "address2":"Suite 102", "city":"Newark", "state":"New Jersey", "zipCode":"37064", "country":"USA", "fields":[ { "id":1001, "answers":[ 1, 3 ] }, { "id":1002, "answers":[ 2 ] }, { "id":1003, "date":"04-22-2012" }, { "id":1004, "text":"No comments" } ] }, { "emailAddress":"[email protected]", "firstName":"xyz", "lastName":"last name", "fields":[ { "id":1001, "answers":[ 0, 2, 4 ] }, { "id":1002, "answers":[ 3 ] }, { "id":1003, "date":"04-21-2012" }, { "id":1004, "text":"It was a great experience." } ] } ] } |
panelDataExport
Purpose |
You can use the panelDataExport method to export details for all the Panel Members. |
||||||
---|---|---|---|---|---|---|---|
Request URL |
www.surveyanalytics.com/a/api/surveyanalytics.micropanel. panelDataExport ?apiKey={ API-KEY } |
||||||
Request Parameters |
* - Mandatory parameter |
||||||
Example |
{ "response": { "id": 9100, "title": "Panel Name", "name": "Panel Name", "report": { "title": "Panel Data Export", "data": [ { "US universities": "", "Last Invitation Date": "", "Surveys Sent": 0, "Profile Complete Date": "", "Completed Surveys": 0, "single select global": "", "Timestamp": "2012-03-23 01:44:17.0", "Zip code": "", "Signup IP Address": "Imported Member", "Source": "Survey", "Status": "New", "Birthday": "", "Total Points": 10, "ID": 789356, "Tracking Source": "", "Email Address": "[email protected]", "Zip Code": "", "US university 2": "", "Last Name": "Sharma", "First Name": "Vishal" }, { "US universities": "", "Last Invitation Date": "2012-03-11 08:26:15.0", "Surveys Sent": 10, "Profile Complete Date": "2012-02-15 21:37:31.0", "Completed Surveys": 3, "single select global": "1", "Timestamp": "2011-12-29 03:41:04.0", "Zip code": "1234", "Signup IP Address": "Imported Member", "Source": "Upload", "Status": "Verified", "Birthday": "1901-01-01", "Total Points": 90, "ID": 316486, "Tracking Source": "", "Email Address": "[email protected]", "Zip Code": "1234", "US university 2": "", "Last Name": "", "First Name": "" } ] } }, "status": { "message": "OK", "id": 200, "method": "surveyanalytics.micropanel.panelDataExport", "serverUTC": 1335427753345, "url": "/a/api/surveyanalytics.micropanel.panelDataExport", "apiKey": "7042c040-11a7-4344-a8b2-66cd473fee6b" } } |
exportRewardStats
Purpose |
You can use the exportRewardStats method to export the Rewards Summary report and details for each reward. |
||||||
---|---|---|---|---|---|---|---|
Request URL |
www.surveyanalytics.com/a/api/surveyanalytics.micropanel. exportRewardStats ?apiKey={ API-KEY } |
||||||
Request Parameters |
* - Mandatory parameter |
||||||
Example |
{ "response": { "id": 9100, "title": "Panel Name", "name": "Panel Name", "report": { "sheets": [ { "title": "Rewards Summary Report", "data": [ { "Status": "Active", "Reward ": "$10 Amazon Gift Certificate", "ID": 673, "Points required to Claim": 0 } ] }, { "Reward ID": 673, "title": "Summary for $10 Amazon Gift Certificate", "Reward": "$10 Amazon Gift Certificate", "data": [] } ] } }, "status": { "message": "OK", "id": 200, "method": "surveyanalytics.micropanel.exportRewardStats", "serverUTC": 1335427846205, "url": "/a/api/surveyanalytics.micropanel.exportRewardStats", "apiKey": "7042c040-11a7-4344-a8b2-66cd473fee6b" } } |
panelMemberExport
Purpose |
You can use the panelMemberExport method to view panel member details for Active Campaign Batches. You can view each member's survey Status (completed, pending, etc.), reminder count, points, etc. |
||||||
---|---|---|---|---|---|---|---|
Request URL |
www.surveyanalytics.com/a/api/surveyanalytics.micropanel. panelMemberExport ?apiKey={ API-KEY } |
||||||
Request Parameters |
* - Mandatory parameter |
||||||
Example |
{ "response": { "id": 9100, "title": "Panel Name", "name": "Panel Name", "report": { "title": "Panel Member Data", "data": [ { "Status": "Pending", "Response ID": 0, "Survey ID": 2817650, "Survey Name": "One Question", "Panel Member ID": 316486, "Email Address": "[email protected]", "Points": 25, "Reminder Count": 0, "Timestamp": "2012-03-11 08:26:15.0" }, { "Status": "Pending", "Response ID": 0, "Survey ID": 2817650, "Survey Name": "One Question", "Panel Member ID": 316486, "Email Address": "[email protected]", "Points": 25, "Reminder Count": 0, "Timestamp": "2012-02-11 02:38:38.0" }, { "Status": "Terminated", "Response ID": 6231410, "Survey ID": 2903524, "Survey Name": "survey with terminate", "Panel Member ID": 316486, "Email Address": "[email protected]", "Points": 10, "Reminder Count": 0, "Timestamp": "2012-02-15 21:36:22.0" } ] } }, "status": { "message": "OK", "id": 200, "method": "surveyanalytics.micropanel.panelMemberExport", "serverUTC": 1335427623336, "url": "/a/api/surveyanalytics.micropanel.panelMemberExport", "apiKey": "7042c040-11a7-4344-a8b2-66cd473fee6b" } } |
getSampleCriteria
Purpose |
You can use the getSampleCriteria call to get the available sample criteria to select/filter members. |
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Request Parameters |
www.surveyanalytics.com/a/api/surveyanalytics.micropanel.getSampleCriteria?apiKey={API-KEY} |
||||||||||||||||||
Response JSON Parameters |
* - Mandatory parameter
|
||||||||||||||||||
Response JSON Example |
{"response": {"title": "Sample Panel", "customFieldCriteria": [ { "customFieldID": 426, "title": "Which country do you live in?", "customFieldChoices": [ { "name": "India", "choiceID": 472 }, { "name": "USA", "choiceID": 473 }, { "name": "Canada", "choiceID": 474 }, { "name": "England", "choiceID": 475 }, { "name": "France", "choiceID": 493 } ], "label": "Which country do you live in?", "type": 21 }, { "customFieldID": 437, "title": "In which type of industry do you work?", "customFieldChoices": [ { "name": "Healthcare", "choiceID": 485 }, { "name": "Education", "choiceID": 486 }, { "name": "Banking/Finance", "choiceID": 487 }, { "name": "Government", "choiceID": 488 } ], "label": "In which type of industry do you work?", "type": 20 }, { "customFieldID": 438, "title": "Do you work full-time or part-time?", "customFieldChoices": [ { "name": "Full-Time", "choiceID": 489 }, { "name": "Part-Time", "choiceID": 490 } ], "label": "Do you work full-time or part-time?", "type": 20 } ], "description": "Sample Panel" }, "status": { "message": "OK", "id": 200, "method": "surveyanalytics.micropanel.getSampleCriteria", "serverUTC": 1391507297387, "url": "/a/api/surveyanalytics.micropanel.getSampleCriteria", "apiKey": "3d14fd32-5ec7-4c60-bc49-583e01fa528a" } } |
getCountForSample
Purpose |
You can use the getCountForSample call to get the available sample count for given selection/sample criteria. |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Request URL |
www.surveyanalytics.com/a/api/surveyanalytics.micropanel.getCountForSample?apiKey={API-KEY} |
||||||||||
Request Parameters |
* - Mandatory parameter |
||||||||||
JSON Data Format |
The JSON format starts with the customFieldCriteria JSON array with each element being field for which you want to filter panel members. |
||||||||||
JSON Parameters |
* - Mandatory parameter. All the parameter names are Case Sensitive. |
||||||||||
Input JSON Example |
{"customFieldCriteria":[{"customFieldID":426, "customFieldChoices":[472]}]} |
||||||||||
Response JSON Parameters |
|
||||||||||
Response JSON Example |
{"response":{"availableSampleCount":5291, "title":"Sample Panel"}, "status":{"message":"OK", "id":200, "method":"surveyanalytics.micropanel.getCountForSample", "serverUTC":1391512758696, "url":"/a/api/surveyanalytics.micropanel.getCountForSample", "apiKey":"3d14fd32-5ec7-4c60-bc49-583e01fa528a"}} |
getPricingForSample
Purpose |
You can use the getPricingForSample call to get the price per response for the given selection/sample criteria. |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Request URL |
www.surveyanalytics.com/a/api/surveyanalytics.micropanel.getPricingForSample?apiKey={API-KEY} |
||||||||||
Request Parameters |
* - Mandatory parameter |
||||||||||
JSON Parameters |
* - Mandatory parameter. All the parameter names are Case Sensitive. |
||||||||||
Input JSON Example |
{"customFieldCriteria":[{"customFieldID":426, "customFieldChoices":[472]}]} |
||||||||||
Response JSON Parameters |
|
||||||||||
Response JSON Example |
{"response":{"title":"Sample Panel", "costPerResponse":5}, "status":{"message":"OK", "id":200, "method":"surveyanalytics.micropanel.getPricingForSample", "serverUTC":1391513279758, "url":"/a/api/surveyanalytics.micropanel.getPricingForSample", "apiKey":"3d14fd32-5ec7-4c60-bc49-583e01fa528a"}} |
executeSampleForCriteria
Purpose | You can use the executeSampleForCriteria API call to send survey invitation to panel members for the given selection/sample criteria. | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Request URL |
www.surveyanalytics.com/a/api/surveyanalytics.micropanel.executeSampleForCriteria?apiKey={API-KEY} |
||||||||||||||||||||||||||||||||
Request Parameters |
* - Mandatory parameter |
||||||||||||||||||||||||||||||||
JSON Parameters |
* - Mandatory parameter. All the parameter names are Case Sensitive. |
||||||||||||||||||||||||||||||||
Input JSON Example |
{"customFieldCriteria":[{"customFieldID":426, "customFieldChoices":[472]}],"isExternalSurvey": false, "surveyID": 3652, "emailSubject": "Take survey now!", "emailMessage": "Thank you for joining the Panel research community. We have a very interesting study for you, which shouldn't take more than 8 minutes of your time. As always, we value your feedback and assure you that the data collected will only be used for research purposes. In essence, we ask that you provide your candid and honest opinion"} |
||||||||||||||||||||||||||||||||
Response JSON Parameters |
|
||||||||||||||||||||||||||||||||
Response JSON Examples | Success: {"response":{"title":"Sample Panel", "success":"Batch created successfully. Delivery in progress."}, "status":{"message":"OK", "id":200, "method":"surveyanalytics.micropanel.executeSampleForCriteria", "serverUTC":1391587759449, "url":"/a/api/surveyanalytics.micropanel.executeSampleForCriteria", "apiKey":"3d14fd32-5ec7-4c60-bc49-583e01fa528a"}} Error: {"response":{"title":"Sample Panel", "errors":["Survey not found for ID 32652"]}, "status":{"message":"OK", "id":200, "method":"surveyanalytics.micropanel.executeSampleForCriteria", "serverUTC":1391588038334, "url":"/a/api/surveyanalytics.micropanel.executeSampleForCriteria", "apiKey":"3d14fd32-5ec7-4c60-bc49-583e01fa528a"}} |
getRewardsListForMember
Purpose |
www.surveyanalytics.com/a/api/surveyanalytics.micropanel. getRewardsListForMember ?apiKey={ API-KEY } |
||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Request Parameters |
* - Mandatory parameter |
||||||||||||||||||||||
JSON Data Format |
The JSON Format contains the key value pair of the required parameter. |
||||||||||||||||||||||
Request JSON Parameters |
* - Mandatory parameter. All the parameter names are Case Sensitive. |
||||||||||||||||||||||
Input JSON Example |
{"memberEmailAddress":"[email protected]"} |
||||||||||||||||||||||
Response JSON Parameters |
|
||||||||||||||||||||||
Response JSON Example |
{ "response": { "panelID":571, "panelMemberID":1217, "Rewards": [ { "eligibleForRedemptionMessage":"Redeem Reward", "giftCardDescription":"$10 Amazon.com Gift Card", "imageUrl":"http://www.surveyanalytics.com/images/amazon.gif", "qPointRewardID":311, "points":100, "isEligibleForRedemption":"Y" }, { "eligibleForRedemptionMessage":"Redeem Reward", "giftCardDescription":"2 Movie Tickets", "imageUrl":"http://www.surveyanalytics.com/images/movie-ticket.jpg", "qPointRewardID":312, "points":100, "isEligibleForRedemption":"Y" }, { "eligibleForRedemptionMessage":"Not Available", "giftCardDescription":"1000 Points = $10 Donation", "imageUrl":"http://www.surveyanalytics.com/images/charity.png", "qPointRewardID":313, "points":100, "isEligibleForRedemption":"N" }, { "eligibleForRedemptionMessage":"Redeem Reward", "giftCardDescription":"$10 Amazon.ca", "imageUrl":"https://dwwvg90koz96l.cloudfront.net/graphics/item-images/amazon-canada-gift-card.png", "qPointRewardID":315, "points":100, "isEligibleForRedemption":"Y" } ] }, "status": { "message":"OK", "id":200, "method":"surveyanalytics.micropanel.getRewardsListForMember", "serverUTC":1403775450735, "url":"/a/api/surveyanalytics.micropanel.getRewardsListForMember", "apiKey":"44262182-f3d2-410c-9fb8-675042180785" } } |
redeemReward
Purpose |
You can use the redeemReward API call to redeem points against reward. You can view the redemption reward details such as rewardID, amount redeemed, reward identifier, redeem message, etc. |
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Request URL |
www.surveyanalytics.com/a/api/surveyanalytics.micropanel. redeemReward ?apiKey={ API-KEY } |
||||||||||||||||||
Request Parameters |
* - Mandatory parameter |
||||||||||||||||||
JSON Data Format |
The JSON Format contains the key value pair of the required parameter. |
||||||||||||||||||
JSON Parameters |
* - Mandatory parameter. All the parameter names are Case Sensitive. |
||||||||||||||||||
Input JSON Example |
{"memberEmailAddress":"[email protected]","rewardID":315,"disclaimerAccepted":"Survey Analytics is not liable for redemption related issues"} |
||||||||||||||||||
Response JSON Parameters |
|
||||||||||||||||||
Response JSON Example |
{ "response": { "amountRedeemed":100, "redeemMessage":"Reward redeemed successfully", "redemmedDate":"24-25-2014 18:24:05", "orderID":"114-06516166-25", "qPointRewardID":315, "rewardIdentifier":"$10 Amazon.ca", "panelMemberID":1217, "panelID":571 } , "status": { "message":"OK", "id":200, "method":"surveyanalytics.micropanel.redeemReward", "serverUTC":1403775969379, "url":"/a/api/surveyanalytics.micropanel.redeemReward", "apiKey":"44262182-f3d2-410c-9fb8-675042180785" } } |