Get Total Response Count
Method: questionpro.survey.responseCount
This API call will return total survey response count based on the filtering
criteria.
Attributes
Name
|
Value
|
Required
|
id
|
Survey ID
|
✔
|
resultMode
|
Assign following values to resultMode to get different responses
- 0 - All survey responses (Default)
- 1 - Started but Not Completed survey responses
- 2 - Completed survey responses
- 3 - Terminated via Branching survey responses
|
✔
|
startDate*
|
Start Date for response time range. Date Format must be dateTime.iso8601
|
✕
|
endDate*
|
End Date for response time range. Date Format must be dateTime.iso8601
|
✕
|
*Either both Start Date and End Date have to be entered else neither
URL
http://api.questionpro.com/a/api/questionpro.survey.responseCount
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.responseCount
HTTP/1.1
Accept: application/json
{
"id":3889871,
"startDate":"2016-10-19T21:12:13+05:30",
"endDate":"2016-10-22T23:10:10+05:30",
"resultMode":"0"
}
Sample Response
{ "response" : { "completeCount" : 6,
"id" : 3896108,
"name" : "Sample Survey",
"overallCompleteCount" : 6,
"overallStartedCount" : 6,
"overallTerminatedCount" : 0,
"overallViewedCount" : 7,
"partialCount" : 6,
"startedCount" : 6,
"status" : "Active",
"terminatedCount" : 0
},
"status" : { "id" : 200,
"message" : "OK",
"method" : "questionpro.survey.responseCount",
"serverUTC" : 1403250725110,
"url" : "/a/api/questionpro.survey.responseCount"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.responseCount
Sample Request
public String getSurveyResponseCountUrl() {
return "http://api.questionpro.com/a/api/questionpro.survey.responseCount?accessKey=" +
getAccessKey();
}
public long getResponseCount() throws Exception {
String path = getSurveyResponseCountUrl();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
String data = "{"id":"" + getSurveyID() + "","resultMode":"0",
"startDate":"2016-10-19T21:12:13+05:30"," +
""endDate":"2016-10-22T23:10:10+05:30"}";
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");
System.out.println(" Survey : " + obj.opt("name") +
" Status : " + obj.opt("status") +
" Overall Viewed : " + obj.optLong("overallViewedCount") +
" Overall Started : " + obj.optLong("overallStartedCount") +
" Overall Complete : " + obj.optLong("overallCompleteCount") +
" Started Count: " + obj.optLong("startedCount") +
" Complete Count : " + obj.optLong("completeCount"));
return obj.getLong("overallStartedCount");
}
Sample Response
{ "response" : { "completeCount" : 6,
"id" : 3896108,
"name" : "Sample Survey",
"overallCompleteCount" : 6,
"overallStartedCount" : 6,
"overallTerminatedCount" : 0,
"overallViewedCount" : 7,
"partialCount" : 6,
"startedCount" : 6,
"status" : "Active",
"terminatedCount" : 0
},
"status" : { "id" : 200,
"message" : "OK",
"method" : "questionpro.survey.responseCount",
"serverUTC" : 1403250725110,
"url" : "/a/api/questionpro.survey.responseCount"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.responseCount
Sample Request
public function getSurveyResponseCountUrl() {
return
"http://api.questionpro.com/a/api/questionpro.survey.responseCount?accessKey=".$this->getAccessKey();
}
public function getResponseCount() {
$path = $this->getSurveyResponseCountUrl();
$data = array('id' => $this->getSurveyID(), 'resultMode' => '0');
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
$json = json_decode($resp, true);
$count = $json['response']['overallStartedCount'];
return $count;
}
Sample Response
{ "response" : { "completeCount" : 6,
"id" : 3896108,
"name" : "Sample Survey",
"overallCompleteCount" : 6,
"overallStartedCount" : 6,
"overallTerminatedCount" : 0,
"overallViewedCount" : 7,
"partialCount" : 6,
"startedCount" : 6,
"status" : "Active",
"terminatedCount" : 0
},
"status" : { "id" : 200,
"message" : "OK",
"method" : "questionpro.survey.responseCount",
"serverUTC" : 1403250725110,
"url" : "/a/api/questionpro.survey.responseCount"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.responseCount
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.responseCount'
payload = { 'id':3889871, 'startDate':'01/01/2013', 'endDate':'07/24/2013', 'resultMode':0 }
r = requests.post(url, data=json.dumps(payload))
Sample Response
{ "response" : { "completeCount" : 6,
"id" : 3896108,
"name" : "Sample Survey",
"overallCompleteCount" : 6,
"overallStartedCount" : 6,
"overallTerminatedCount" : 0,
"overallViewedCount" : 7,
"partialCount" : 6,
"startedCount" : 6,
"status" : "Active",
"terminatedCount" : 0
},
"status" : { "id" : 200,
"message" : "OK",
"method" : "questionpro.survey.responseCount",
"serverUTC" : 1403250725110,
"url" : "/a/api/questionpro.survey.responseCount"
}
}
Get Survey Responses
Method: questionpro.survey.surveyResponses
This API call is used to retrieve survey responses for a survey based on the filtering
criteria.
Attributes
Name
|
Value
|
Required
|
id
|
Survey ID
|
✔
|
resultMode
|
Assign following values to resultMode to get different responses
- 0 - All survey responses (Default)
- 1 - Started but Not Completed survey responses
- 2 - Completed survey responses
- 3 - Terminated via Branching survey responses
|
✔
|
startDate*
|
Start Date for response time range. Date Format must be dateTime.iso8601
|
✕
|
endDate*
|
End Date for response time range. Date Format must be dateTime.iso8601
|
✕
|
startingResponseCounter
|
This parameter is used to get responses in a particular range sequentially.
If this parameter is not specified the first 100 responses will be returned,
If '2' is specified, responses in the range 201-300 will be returned and so on.
|
✕
|
*Either both Start Date and End Date have to be entered else neither
URL
http://api.questionpro.com/a/api/questionpro.survey.surveyResponses
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.surveyResponses
HTTP/1.1
Accept: application/json
{
"id":3889871,
"startDate":"2016-10-19T21:12:13+05:30",
"endDate":"2016-10-22T23:10:10+05:30",
"resultMode":"0"
"startingResponseCounter":"0"
}
Sample Response
{ "response" : { "id" : 3896108,
"name" : "Sample Survey",
"responses" : [ { "country" : "IN",
"duplicate" : false,
"externalReference" : "test_response",
"id" : 23749765,
"ipAddress" : "115.248.168.125",
"region" : "16",
"responseSet" : [ { "questionCode" : "Q1",
"questionDescription" : " ",
"questionID" : 36860852,
"questionText" : "How often do you conduct surveys?",
"values" : [ { "answerText" : "Weekly",
"id" : "181377002",
"value" : { "scale" : "1" }
} ]
} ],
"responseStatus" : "Yes",
"timeTaken" : 2,
"timestamp" : "20 Jun, 2014 11:50:05 AM MSD"
},
{ "country" : "IN",
"duplicate" : false,
"externalReference" : "test_response",
"id" : 23749766,
"ipAddress" : "115.248.168.125",
"region" : "16",
"responseSet" : [ { "questionCode" : "Q1",
"questionDescription" : " ",
"questionID" : 36860852,
"questionText" : "How often do you conduct surveys?",
"values" : [ { "answerText" : "Quarterly",
"id" : "181377004",
"value" : { "scale" : "3" }
} ]
} ],
"responseStatus" : "Yes",
"timeTaken" : 1,
"timestamp" : "20 Jun, 2014 11:50:09 AM MSD"
}
],
"status" : "Active",
"surveyStatistics" : { "completedCount" : 6,
"startedCount" : 6,
"viewedCount" : 0
}
},
"status" : { "id" : 200,
"message" : "OK",
"method" : "questionpro.survey.surveyResponses",
"serverUTC" : 1403258290868,
"url" : "/a/api/questionpro.survey.surveyResponses"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.surveyResponses
Sample Request
public String getSurveyResponseUrl() {
return "http://api.questionpro.com/a/api/questionpro.survey.surveyResponse?accessKey=" +
getAccessKey();
}
public String getResponses(int startingResponseCounter) throws Exception {
String path = getSurveyResponsesUrl();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
String data = "{"id":"" + getSurveyID() + "","resultMode":"0","startDate":"2016-10-19T21:12:13+05:30","
+
""endDate":"2016-10-22T23:10:10+05:30","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();
}
Sample Response
{ "response" : { "id" : 3896108,
"name" : "Sample Survey",
"responses" : [ { "country" : "IN",
"duplicate" : false,
"externalReference" : "test_response",
"id" : 23749765,
"ipAddress" : "115.248.168.125",
"region" : "16",
"responseSet" : [ { "questionCode" : "Q1",
"questionDescription" : " ",
"questionID" : 36860852,
"questionText" : "How often do you conduct surveys?",
"values" : [ { "answerText" : "Weekly",
"id" : "181377002",
"value" : { "scale" : "1" }
} ]
} ],
"responseStatus" : "Yes",
"timeTaken" : 2,
"timestamp" : "20 Jun, 2014 11:50:05 AM MSD"
},
{ "country" : "IN",
"duplicate" : false,
"externalReference" : "test_response",
"id" : 23749766,
"ipAddress" : "115.248.168.125",
"region" : "16",
"responseSet" : [ { "questionCode" : "Q1",
"questionDescription" : " ",
"questionID" : 36860852,
"questionText" : "How often do you conduct surveys?",
"values" : [ { "answerText" : "Quarterly",
"id" : "181377004",
"value" : { "scale" : "3" }
} ]
} ],
"responseStatus" : "Yes",
"timeTaken" : 1,
"timestamp" : "20 Jun, 2014 11:50:09 AM MSD"
}
],
"status" : "Active",
"surveyStatistics" : { "completedCount" : 6,
"startedCount" : 6,
"viewedCount" : 0
}
},
"status" : { "id" : 200,
"message" : "OK",
"method" : "questionpro.survey.surveyResponses",
"serverUTC" : 1403258290868,
"url" : "/a/api/questionpro.survey.surveyResponses"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.surveyResponses
Sample Request
public function getSurveyResponsesUrl() {
return
"http://api.questionpro.com/a/api/questionpro.survey.surveyResponses?accessKey=".$this->getAccessKey();
}
public function getResponses($startingResponseCounter) {
$path = $this->getSurveyResponsesUrl();
$startingResponseCounter = $this->getResponseCount();
$data = array('id' => $this->getSurveyID(), 'resultMode' => '0', 'startDate' =>
'01/01/2014', 'endDate' => '06/24/2014', 'startingResponseCounter' =>
$startingResponseCounter);
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{ "response" : { "id" : 3896108,
"name" : "Sample Survey",
"responses" : [ { "country" : "IN",
"duplicate" : false,
"externalReference" : "test_response",
"id" : 23749765,
"ipAddress" : "115.248.168.125",
"region" : "16",
"responseSet" : [ { "questionCode" : "Q1",
"questionDescription" : " ",
"questionID" : 36860852,
"questionText" : "How often do you conduct surveys?",
"values" : [ { "answerText" : "Weekly",
"id" : "181377002",
"value" : { "scale" : "1" }
} ]
} ],
"responseStatus" : "Yes",
"timeTaken" : 2,
"timestamp" : "20 Jun, 2014 11:50:05 AM MSD"
},
{ "country" : "IN",
"duplicate" : false,
"externalReference" : "test_response",
"id" : 23749766,
"ipAddress" : "115.248.168.125",
"region" : "16",
"responseSet" : [ { "questionCode" : "Q1",
"questionDescription" : " ",
"questionID" : 36860852,
"questionText" : "How often do you conduct surveys?",
"values" : [ { "answerText" : "Quarterly",
"id" : "181377004",
"value" : { "scale" : "3" }
} ]
} ],
"responseStatus" : "Yes",
"timeTaken" : 1,
"timestamp" : "20 Jun, 2014 11:50:09 AM MSD"
}
],
"status" : "Active",
"surveyStatistics" : { "completedCount" : 6,
"startedCount" : 6,
"viewedCount" : 0
}
},
"status" : { "id" : 200,
"message" : "OK",
"method" : "questionpro.survey.surveyResponses",
"serverUTC" : 1403258290868,
"url" : "/a/api/questionpro.survey.surveyResponses"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.surveyResponses
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.surveyResponses'
payload = { 'id':3889871, 'startDate':'01/01/2013', 'endDate':'07/24/2013', 'resultMode':0, 'startingResponseCounter':0 }
r = requests.post(url, data=json.dumps(payload))
Sample Response
{ "response" : { "id" : 3896108,
"name" : "Sample Survey",
"responses" : [ { "country" : "IN",
"duplicate" : false,
"externalReference" : "test_response",
"id" : 23749765,
"ipAddress" : "115.248.168.125",
"region" : "16",
"responseSet" : [ { "questionCode" : "Q1",
"questionDescription" : " ",
"questionID" : 36860852,
"questionText" : "How often do you conduct surveys?",
"values" : [ { "answerText" : "Weekly",
"id" : "181377002",
"value" : { "scale" : "1" }
} ]
} ],
"responseStatus" : "Yes",
"timeTaken" : 2,
"timestamp" : "20 Jun, 2014 11:50:05 AM MSD"
},
{ "country" : "IN",
"duplicate" : false,
"externalReference" : "test_response",
"id" : 23749766,
"ipAddress" : "115.248.168.125",
"region" : "16",
"responseSet" : [ { "questionCode" : "Q1",
"questionDescription" : " ",
"questionID" : 36860852,
"questionText" : "How often do you conduct surveys?",
"values" : [ { "answerText" : "Quarterly",
"id" : "181377004",
"value" : { "scale" : "3" }
} ]
} ],
"responseStatus" : "Yes",
"timeTaken" : 1,
"timestamp" : "20 Jun, 2014 11:50:09 AM MSD"
}
],
"status" : "Active",
"surveyStatistics" : { "completedCount" : 6,
"startedCount" : 6,
"viewedCount" : 0
}
},
"status" : { "id" : 200,
"message" : "OK",
"method" : "questionpro.survey.surveyResponses",
"serverUTC" : 1403258290868,
"url" : "/a/api/questionpro.survey.surveyResponses"
}
}
Send Survey
Method: questionpro.survey.sendSurvey
This API is used to send survey invitations to individual respondents as well as email
lists.
Attributes
Name
|
Value
|
Required
|
surveyID
|
Survey ID
|
✔
|
mode
|
- 1 - Send invites to an existing email list using an existing email
template
- 2 - Send invites to individual email addresses using an existing email
template
- 3 - Send invites to existing email list using a custom email template
- 4 - Send invites to individual email addresses using a custom email
template
|
✔
|
emailGroupID
|
ID for the email list to which you want to send invites.
|
Required with mode 1 and mode 3
|
templateID
|
Email template to be used.
|
Required with mode 1 and mode 2
|
emails
|
Email addresses of the respondents (JSONArray).
|
Required with mode 2 and mode 4
|
template
|
Custom email template (JSONArray with attributes 'body' & 'subject').
|
Required with mode 3 and mode 4
|
URL
http://api.questionpro.com/a/api/questionpro.survey.sendSurvey
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.sendSurvey
HTTP/1.1
Accept: application/json
{
"surveyID":"336541",
"emailGroupID":"1234",
"templateID":"5678",
"mode":"3"
}
Sample Response
{ "response" : { "result" : "Message successful." },
"status" : { "id" : 200,
"message" : "OK",
"method" : "questionpro.survey.sendSurvey",
"serverUTC" : 1378810004358,
"url" : "/a/api/questionpro.survey.sendSurvey"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.sendSurvey
Sample Request
public String getSendSurveyUrl() {
return "http://api.questionpro.com/a/api/questionpro.survey.sendSurvey?accessKey=" +
getAccessKey();
}
public JSONObject getSendSurvey1() throws Exception {
String path = getSendSurveyUrl();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
data.put("surveyID", getSurveyID());
data.put("emailGroupID", 1234);
data.put("templateID", 5678);
data.put("mode", 1);
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
public JSONObject getSendSurvey2() throws Exception {
String path = getSendSurveyUrl();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
JSONArray emails = new JSONArray();
emails.put("[email protected]");
emails.put("[email protected]");
data.put("surveyID", getSurveyID());
data.put("emails", emails);
data.put("templateID", 5678);
data.put("mode", 2);
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
public JSONObject getSendSurvey3() throws Exception {
String path = getSendSurveyUrl();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
JSONObject template = new JSONObject();
template.put("body", "Please take the survey :
");
template.put("subject", "This is subject");
data.put("surveyID", getSurveyID());
data.put("emailGroupID", 1234);
data.put("template", template);
data.put("mode", 3);
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
public JSONObject getSendSurvey4() throws Exception {
String path = getSendSurveyUrl();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
JSONArray emails = new JSONArray();
emails.put("[email protected]");
emails.put("[email protected]");
JSONObject template = new JSONObject();
template.put("body", "Please take the survey :
");
template.put("subject", "This is subject");
data.put("surveyID", getSurveyID());
data.put("emails", emails);
data.put("template", template);
data.put("mode", 4);
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
Sample Response
{ "response" : { "result" : "Message successful." },
"status" : { "id" : 200,
"message" : "OK",
"method" : "questionpro.survey.sendSurvey",
"serverUTC" : 1378810004358,
"url" : "/a/api/questionpro.survey.sendSurvey"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.sendSurvey
Sample Request
public function getSendSurveyUrl(){
return
"http://api.questionpro.com/a/api/questionpro.survey.sendSurvey?accessKey=".$this->getAccessKey();
}
public function getSendSurvey1() {
$path = $this->getSendSurveyUrl();
$data = array('surveyID' => $this->getSurveyID(), 'emailGroupID' => '1234', 'templateID'
=> '5678', 'mode' => '1');
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
public function getSendSurvey2() {
$path = $this->getSendSurveyUrl();
$emails = array('[email protected]','[email protected]');
$data = array('surveyID' => $this->getSurveyID(), 'emails' => $emails, 'templateID' =>
'5678', 'mode' => '2');
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
public function getSendSurvey3() {
$path = $this->getSendSurveyUrl();
$template = array('body' => 'Please take the survey :
','Subject' => 'This is subject');
$data = array('surveyID' => $this->getSurveyID(), 'emailGroupID' => '1234',
'template' => $template, 'mode' => '3');
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
public function getSendSurvey4() {
$path = $this->getSendSurveyUrl();
$emails = array('[email protected]','[email protected]');
$template = array('body' => 'Please take the survey :
','Subject' => 'This is subject');
$data = array('surveyID' => $this->getSurveyID(), 'emails' => $emails,
'template' => $template, 'mode' => '4');
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{ "response" : { "result" : "Message successful." },
"status" : { "id" : 200,
"message" : "OK",
"method" : "questionpro.survey.sendSurvey",
"serverUTC" : 1378810004358,
"url" : "/a/api/questionpro.survey.sendSurvey"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.sendSurvey
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.sendSurvey'
payload = { 'surveyID':'336541', 'emailGroupID':'1234', 'templateID':'5678', 'mode':'3' }
r = requests.post(url, data=json.dumps(payload))
Sample Response
{ "response" : { "result" : "Message successful." },
"status" : { "id" : 200,
"message" : "OK",
"method" : "questionpro.survey.sendSurvey",
"serverUTC" : 1378810004358,
"url" : "/a/api/questionpro.survey.sendSurvey"
}
}
Get Survey Invite History
Method: questionpro.survey.emailBatchStatistics
This API call can be used to get the send survey history for a specific survey.
Attributes
Name
|
Value
|
Required
|
surveyID
|
Survey ID
|
✔
|
URL
http://api.questionpro.com/a/api/questionpro.survey.emailBatchStatistics
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.getSurvey
HTTP/1.1
Accept: application/json
{
"surveyID":3889871,
}
Sample Response
{
"response": {
"emailBatches": [
{
"emailGroup": "Default List-1",
"viewed": 0,
"completed": 0,
"batchID": 1499762,
"participationRate": "0%",
"batchType": "Normal",
"participationPending": 2,
"timestamp": "02/08/2016 16:02:53",
"initialSent": 2,
"status": "Completed Successfully"
},
{
"emailGroup": "test",
"viewed": 0,
"completed": 0,
"batchID": 945908,
"participationRate": "0%",
"batchType": "Normal",
"participationPending": 3,
"timestamp": "18/04/2013 11:35:38",
"initialSent": 3,
"status": "Completed Successfully"
}
]
},
"status": {
"method": "questionpro.survey.emailBatchStatistics",
"serverUTC": 1470390987145,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.emailBatchStatistics"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.emailBatchStatistics
Sample Request
public String getEmailBatchStatisticsURL(){
return "http://api.questionpro.com/a/api/questionpro.survey.emailBatchStatistics?accessKey="
+ getAccessKey();
}
public JSONObject getEmailBatchStatistics() throws Exception {
String path = deleteSurveyURL();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
data.put("surveyID", getSurveyID());
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
Sample Response
{
"response": {
"emailBatches": [
{
"emailGroup": "Default List-1",
"viewed": 0,
"completed": 0,
"batchID": 1499762,
"participationRate": "0%",
"batchType": "Normal",
"participationPending": 2,
"timestamp": "02/08/2016 16:02:53",
"initialSent": 2,
"status": "Completed Successfully"
},
{
"emailGroup": "test",
"viewed": 0,
"completed": 0,
"batchID": 945908,
"participationRate": "0%",
"batchType": "Normal",
"participationPending": 3,
"timestamp": "18/04/2013 11:35:38",
"initialSent": 3,
"status": "Completed Successfully"
}
]
},
"status": {
"method": "questionpro.survey.emailBatchStatistics",
"serverUTC": 1470390987145,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.emailBatchStatistics"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.emailBatchStatistics
Sample Request
public function getEmailBatchStatisticsURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.emailBatchStatistics?accessKey=".$this->getAccessKey();
}
public function getEmailBatchStatistics() {
$path = $this->deleteSurveyURL();
$data = array('surveyID' => $this->getSurveyID());
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{
"response": {
"emailBatches": [
{
"emailGroup": "Default List-1",
"viewed": 0,
"completed": 0,
"batchID": 1499762,
"participationRate": "0%",
"batchType": "Normal",
"participationPending": 2,
"timestamp": "02/08/2016 16:02:53",
"initialSent": 2,
"status": "Completed Successfully"
},
{
"emailGroup": "test",
"viewed": 0,
"completed": 0,
"batchID": 945908,
"participationRate": "0%",
"batchType": "Normal",
"participationPending": 3,
"timestamp": "18/04/2013 11:35:38",
"initialSent": 3,
"status": "Completed Successfully"
}
]
},
"status": {
"method": "questionpro.survey.emailBatchStatistics",
"serverUTC": 1470390987145,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.emailBatchStatistics"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getSurvey
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.getSurvey'
payload = { 'id':3889871 }
r = requests.post(url, data=json.dumps(payload))
Sample Response
{
"response": {
"emailBatches": [
{
"emailGroup": "Default List-1",
"viewed": 0,
"completed": 0,
"batchID": 1499762,
"participationRate": "0%",
"batchType": "Normal",
"participationPending": 2,
"timestamp": "02/08/2016 16:02:53",
"initialSent": 2,
"status": "Completed Successfully"
},
{
"emailGroup": "test",
"viewed": 0,
"completed": 0,
"batchID": 945908,
"participationRate": "0%",
"batchType": "Normal",
"participationPending": 3,
"timestamp": "18/04/2013 11:35:38",
"initialSent": 3,
"status": "Completed Successfully"
}
]
},
"status": {
"method": "questionpro.survey.emailBatchStatistics",
"serverUTC": 1470390987145,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.emailBatchStatistics"
}
}
Send Reminders
Method: questionpro.survey.sendReminder
This API call is used to send reminders to previously sent email batches
Attributes
Name
|
Value
|
Required
|
surveyID
|
Survey ID
|
✔
|
emailGroupID
|
ID for the email list to which you want to send reminders.
|
✔
|
templateID
|
Email template to be used.
|
✔
|
URL
http://api.questionpro.com/a/api/questionpro.survey.sendReminder
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.sendReminder
HTTP/1.1
Accept: application/json
{
"id":3889871,
"emailGroupID":"1234",
"templateID":"5678",
}
Sample Response
{ "response" : { "result" : "Message successful." },
"status" : { "id" : 200,
"message" : "OK",
"method" : "questionpro.survey.sendSurvey",
"serverUTC" : 1378810004358,
"url" : "/a/api/questionpro.survey.sendSurvey"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.sendReminder
Sample Request
public String getSendReminderUrl() {
return "http://api.questionpro.com/a/api/questionpro.survey.sendReminder?accessKey=" +
getAccessKey();
}
public JSONObject getSendReminder() throws Exception {
String path = getSendReminderUrl();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
data.put("surveyID", getSurveyID());
data.put("emailGroupID", 1234);
data.put("templateID", 5678);
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
Sample Response
{ "response" : { "result" : "Message successful." },
"status" : { "id" : 200,
"message" : "OK",
"method" : "questionpro.survey.sendSurvey",
"serverUTC" : 1378810004358,
"url" : "/a/api/questionpro.survey.sendSurvey"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.sendReminder
Sample Request
public function getSendReminderUrl(){
return
"http://api.questionpro.com/a/api/questionpro.survey.sendReminder?accessKey=".$this->getAccessKey();
}
public function getSendReminder() {
$path = $this->getSendReminderUrl();
$data = array('surveyID' => $this->getSurveyID(), 'emailGroupID' => '1234', 'templateID'
=> '5678');
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{ "response" : { "result" : "Message successful." },
"status" : { "id" : 200,
"message" : "OK",
"method" : "questionpro.survey.sendSurvey",
"serverUTC" : 1378810004358,
"url" : "/a/api/questionpro.survey.sendSurvey"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.sendReminder
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.sendReminder'
payload = { 'id':3889871, 'emailGroupID':'1234', 'templateID':'5678' }
r = requests.post(url, data=json.dumps(payload))
Sample Response
{ "response" : { "result" : "Message successful." },
"status" : { "id" : 200,
"message" : "OK",
"method" : "questionpro.survey.sendSurvey",
"serverUTC" : 1378810004358,
"url" : "/a/api/questionpro.survey.sendSurvey"
}
}
Create Email List
Method: questionpro.survey.createEmailGroup
This API call can be used to create email lists for a specific survey.
Attributes
Name
|
Value
|
Required
|
surveyID
|
Survey ID
|
|
emails
|
Email addresses with custom variables (JSON Array)
|
|
emailGroupName
|
Specify the name of the email list to be created
|
✕
|
URL
http://api.questionpro.com/a/api/questionpro.survey.createEmailGroup
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.createEmailGroup
HTTP/1.1
Accept: application/json
{
"surveyID":3889871,
"emails":["[email protected],priyesh,ghamandi","[email protected],2"],
"emailGroupName":"MyList",
}
Sample Response
{
"response":{
"result":{
"emailGroupID":847771
}
},
"status":{
"method":"questionpro.survey.createEmailGroup",
"serverUTC":1439556596337,
"id":200,
"message":"OK",
"url":"/a/api/questionpro.survey.createEmailGroup"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.createEmailGroup
Sample Request
public String getCreateEmailGroupURL(){
return "http://api.questionpro.com/a/api/questionpro.survey.createEmailGroup?accessKey="
+ getAccessKey();
}
public JSONObject createEmailGroup() throws Exception {
String path = getCreateEmailGroupURL();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
JSONArray emails = new JSONArray();
emails.put("[email protected],custom1,custom2");
emails.put("[email protected],custom1,custom2");
data.put("surveyID", getSurveyID());
data.put("emails", emails);
data.put("emailGroupName":"MyList");
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
Sample Response
{
"response":{
"result":{
"emailGroupID":847771
}
},
"status":{
"method":"questionpro.survey.createEmailGroup",
"serverUTC":1439556596337,
"id":200,
"message":"OK",
"url":"/a/api/questionpro.survey.createEmailGroup"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.createEmailGroup
Sample Request
public function getCreateEmailGroupURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.createEmailGroup?accessKey=".$this->getAccessKey();
}
public function createEmailGroup() {
$path = $this->getCreateEmailGroupURL();
$emails = array('[email protected],custom1,custom2','[email protected],custom1,custom2');
$data = array('surveyID' => $this->getSurveyID(), 'emails' => $emails,'emailGroupName'=>'MyList');
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{
"response":{
"result":{
"emailGroupID":847771
}
},
"status":{
"method":"questionpro.survey.createEmailGroup",
"serverUTC":1439556596337,
"id":200,
"message":"OK",
"url":"/a/api/questionpro.survey.createEmailGroup"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.createEmailGroup
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.createEmailGroup'
payload = { 'id':3889871, 'emails':'emails', 'emailGroupName':'MyList' }
r = requests.post(url, data=json.dumps(payload))
Sample Response
{
"response":{
"result":{
"emailGroupID":847771
}
},
"status":{
"method":"questionpro.survey.createEmailGroup",
"serverUTC":1439556596337,
"id":200,
"message":"OK",
"url":"/a/api/questionpro.survey.createEmailGroup"
}
}
List All User Accounts
Method: questionpro.survey.getAllAccounts
You can get all user accounts using this API call. Please note that you will require a
global access key to make this call.
Attributes
*User ID is extracted from access key and this call requires
no data
to be passed in request
URL
http://api.questionpro.com/a/api/questionpro.survey.getAllAccounts
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.getAllAccounts
HTTP/1.1
Sample Response
{
"response": {
"accounts": [
{
"firstName": "xyz",
"lastName": "pqr",
"lastLogin": "0 days(s) ago",
"emailAddress": "[email protected]",
"phone": "(IN)9876543210",
"accountType": "Uber Admin User",
"creationDate": "Nov 17, 2010",
"userID": 1234
},
{
"lastLogin": "1288 days(s) ago",
"emailAddress": "[email protected]",
"phone": "",
"accountType": "Recurring Billing Deactivated",
"creationDate": "Feb 21, 2011",
"userID": 2345
},
{
"lastLogin": "N/A",
"emailAddress": "[email protected]",
"phone": "",
"accountType": "Dashboard",
"creationDate": "May 12, 2015",
"userID": 3456
},
]
},
"status": {
"method": "questionpro.survey.getAllAccounts",
"apiKey": "xxx",
"serverUTC": 1461565670022,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getAllAccounts"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getAllAccounts
Sample Request
public String getAllAccountsUrl() {
return "http://api.questionpro.com/a/api/questionpro.survey.getAllAccounts?accessKey=" +
getGlobalAccessKey();
}
public JSONObject getAllAccounts() throws Exception {
String path = getAllAccountsUrl();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
httpost.setHeader("Accept", "application/json");
httpost.setHeader("Content-type", "application/json");
ResponseHandler responseHandler = new BasicResponseHandler();
Object resp = httpclient.execute(httpost, responseHandler);
return resp;
}
Sample Response
{
"response": {
"accounts": [
{
"firstName": "xyz",
"lastName": "pqr",
"lastLogin": "0 days(s) ago",
"emailAddress": "[email protected]",
"phone": "(IN)9876543210",
"accountType": "Uber Admin User",
"creationDate": "Nov 17, 2010",
"userID": 1234
},
{
"lastLogin": "1288 days(s) ago",
"emailAddress": "[email protected]",
"phone": "",
"accountType": "Recurring Billing Deactivated",
"creationDate": "Feb 21, 2011",
"userID": 2345
},
{
"lastLogin": "N/A",
"emailAddress": "[email protected]",
"phone": "",
"accountType": "Dashboard",
"creationDate": "May 12, 2015",
"userID": 3456
},
]
},
"status": {
"method": "questionpro.survey.getAllAccounts",
"apiKey": "xxx",
"serverUTC": 1461565670022,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getAllAccounts"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getAllAccounts
Sample Request
public function getAllAccountsUrl(){
return
"http://api.questionpro.com/a/api/questionpro.survey.getAllAccounts?accessKey=".$this->getGlobalAccessKey();
}
public function getAllAccounts() {
$path = $this->getAllAccountsUrl();
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json')
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{
"response": {
"accounts": [
{
"firstName": "MainUser",
"lastName": "",
"lastLogin": "0 days(s) ago",
"emailAddress": "[email protected]",
"phone": "(IN)9876543210",
"accountType": "Uber Admin User",
"creationDate": "Nov 17, 2010",
"userID": 1234
},
{
"lastLogin": "1288 days(s) ago",
"emailAddress": "[email protected]",
"phone": "",
"accountType": "Recurring Billing Deactivated",
"creationDate": "Feb 21, 2011",
"userID": 2345
},
{
"lastLogin": "N/A",
"emailAddress": "[email protected]",
"phone": "",
"accountType": "Dashboard",
"creationDate": "May 12, 2015",
"userID": 3456
},
]
},
"status": {
"method": "questionpro.survey.getAllAccounts",
"apiKey": "xxxx",
"serverUTC": 1461565670022,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getAllAccounts"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getAllAccounts
Sample Request
import requests
url = 'http://api.questionpro.com/a/api/questionpro.survey.getAllAccounts'
Sample Response
{
"response": {
"accounts": [
{
"firstName": "MainUser",
"lastName": "",
"lastLogin": "0 days(s) ago",
"emailAddress": "[email protected]",
"phone": "(IN)9876543210",
"accountType": "Uber Admin User",
"creationDate": "Nov 17, 2010",
"userID": 1234
},
{
"lastLogin": "1288 days(s) ago",
"emailAddress": "[email protected]",
"phone": "",
"accountType": "Recurring Billing Deactivated",
"creationDate": "Feb 21, 2011",
"userID": 2345
},
{
"lastLogin": "N/A",
"emailAddress": "[email protected]",
"phone": "",
"accountType": "Dashboard",
"creationDate": "May 12, 2015",
"userID": 3456
},
]
},
"status": {
"method": "questionpro.survey.getAllAccounts",
"apiKey": "xxxx",
"serverUTC": 1461565670022,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getAllAccounts"
}
}
Get Specific Account
Method: questionpro.survey.getAccount
This API call can be used to get a specific account based on userID.
Attributes
Name
|
Value
|
Required
|
userID
|
User ID
|
✔
|
URL
http://api.questionpro.com/a/api/questionpro.survey.getAccount
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.getAccount
HTTP/1.1
Accept: application/json
{
"userID":3889871,
}
Sample Response
{
"response": {
"account": {
"firstName": "xyz",
"lastName": "pqr",
"lastLogin": "0 days(s) ago",
"emailAddress": "[email protected]",
"phone": "(IN)9876543210",
"creationDate": "Nov 17, 2010",
"userID": 1234
}
},
"status": {
"method": "questionpro.survey.getAccount",
"apiKey": "xxxx",
"serverUTC": 1461565902891,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getAccount"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getAccount
Sample Request
public String getAccountURL(){
return "http://api.questionpro.com/a/api/questionpro.survey.getAccount?accessKey="
+ getAccessKey();
}
public JSONObject getAccount() throws Exception {
String path = getAccountURL();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
data.put("userID", getUserID());
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
Sample Response
{
"response": {
"account": {
"firstName": "xyz",
"lastName": "pqr",
"lastLogin": "0 days(s) ago",
"emailAddress": "[email protected]",
"phone": "(IN)9876543210",
"creationDate": "Nov 17, 2010",
"userID": 1234
}
},
"status": {
"method": "questionpro.survey.getAccount",
"apiKey": "xxxx",
"serverUTC": 1461565902891,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getAccount"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getAccount
Sample Request
public function getAccountURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.getAccount?accessKey=".$this->getAccessKey();
}
public function getAccount() {
$path = $this->getAccountURL();
$data = array('userID' => $this->getUserID());
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{
"response": {
"account": {
"firstName": "xyz",
"lastName": "pqr",
"lastLogin": "0 days(s) ago",
"emailAddress": "[email protected]",
"phone": "(IN)9876543210",
"creationDate": "Nov 17, 2010",
"userID": 1234
}
},
"status": {
"method": "questionpro.survey.getAccount",
"apiKey": "xxxx",
"serverUTC": 1461565902891,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getAccount"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getAccount
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.getAccount'
payload = { 'userID':3889871 }
r = requests.post(url, data=json.dumps(payload))
Sample Response
{
"response": {
"account": {
"firstName": "xyz",
"lastName": "pqr",
"lastLogin": "0 days(s) ago",
"emailAddress": "[email protected]",
"phone": "(IN)9876543210",
"creationDate": "Nov 17, 2010",
"userID": 1234
}
},
"status": {
"method": "questionpro.survey.getAccount",
"apiKey": "xxxx",
"serverUTC": 1461565902891,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getAccount"
}
}
Get All Surveys
Method: questionpro.survey.getAllSurveys
This API call can be used to get all surveys belonging to a specific user account.
URL
http://api.questionpro.com/a/api/questionpro.survey.getAllSurveys
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.getAllSurveys
HTTP/1.1
Sample Response
{
"response":{
"surveys:":[
{
"surveyID":4794284,
"surveyName":"QP (V1.24) CNC Assessment 2016-2017",
"surveyURL":"https://www.questionpro.com/a/TakeSurvey?id=4794284"
},
{
"surveyID":4794283,
"surveyName":"(Copy) (V1.24 TEST)",
"surveyURL":"https://www.questionpro.com/a/TakeSurvey?id=4794283"
}
"status":{
"method":"questionpro.survey.getAllSurveys",
"serverUTC":1472021401080,
"id":200,
"message":"OK",
"url":"/a/api/questionpro.survey.getAllSurveys"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getAllSurveys
Sample Request
public String getSurveysURL(){
return "http://api.questionpro.com/a/api/questionpro.survey.getAllSurveys?accessKey="
+ getAccessKey();
}
public JSONObject getSurveys() throws Exception {
String path = getSurveysURL();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
httpost.setHeader("Accept", "application/json");
httpost.setHeader("Content-type", "application/json");
ResponseHandler responseHandler = new BasicResponseHandler();
Object resp = httpclient.execute(httpost, responseHandler);
return new JSONObject(resp.toString());
}
Sample Response
{
"response":{
"surveys:":[
{
"surveyID":4794284,
"surveyName":"QP (V1.24) CNC Assessment 2016-2017",
"surveyURL":"https://www.questionpro.com/a/TakeSurvey?id=4794284"
},
{
"surveyID":4794283,
"surveyName":"(Copy) (V1.24 TEST)",
"surveyURL":"https://www.questionpro.com/a/TakeSurvey?id=4794283"
}
"status":{
"method":"questionpro.survey.getAllSurveys",
"serverUTC":1472021401080,
"id":200,
"message":"OK",
"url":"/a/api/questionpro.survey.getAllSurveys"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getAllSurveys
Sample Request
public function getSurveysURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.getAllSurveys?accessKey=".$this->getAccessKey();
}
public function getSurveys() {
$path = $this->getSurveysURL();
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json')
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{
"response":{
"surveys:":[
{
"surveyID":4794284,
"surveyName":"QP (V1.24) CNC Assessment 2016-2017",
"surveyURL":"https://www.questionpro.com/a/TakeSurvey?id=4794284"
},
{
"surveyID":4794283,
"surveyName":"(Copy) (V1.24 TEST)",
"surveyURL":"https://www.questionpro.com/a/TakeSurvey?id=4794283"
}
"status":{
"method":"questionpro.survey.getAllSurveys",
"serverUTC":1472021401080,
"id":200,
"message":"OK",
"url":"/a/api/questionpro.survey.getAllSurveys"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getAllSurveys
Sample Request
import requests
url = 'http://api.questionpro.com/a/api/questionpro.survey.getAllSurveys'
Sample Response
{
"response":{
"surveys:":[
{
"surveyID":4794284,
"surveyName":"QP (V1.24) CNC Assessment 2016-2017",
"surveyURL":"https://www.questionpro.com/a/TakeSurvey?id=4794284"
},
{
"surveyID":4794283,
"surveyName":"(Copy) (V1.24 TEST)",
"surveyURL":"https://www.questionpro.com/a/TakeSurvey?id=4794283"
}
"status":{
"method":"questionpro.survey.getAllSurveys",
"serverUTC":1472021401080,
"id":200,
"message":"OK",
"url":"/a/api/questionpro.survey.getAllSurveys"
}
}
Get Survey
Method: questionpro.survey.getSurvey
This API call can be used to get a specific survey.
Attributes
Name
|
Value
|
Required
|
id
|
Survey ID
|
✔
|
URL
http://api.questionpro.com/a/api/questionpro.survey.getSurvey
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.getSurvey
HTTP/1.1
Accept: application/json
{
"id":3889871,
}
Sample Response
{
"response":{
"connectURL":"http://www.questionpro.com/t/AIBHLZVEJR",
"subtitle":"Aug 05 2016",
"languageContent":[
],
"thankYouMessage":"Thank you for completing this survey.",
"surveyLanguages":[
{
"isDefault":true,
"name":"English"
}
],
"id":4782051,
"hasScoringLogic":false,
"title":"CSat Survey",
"sections":[
{
"numTasks":0,
"exactMinAnswers":0,
"orientation":2,
"code":"Q1",
"maxAnswers":0,
"questions":[
{
"orderNumber":0,
"answers":[
{
"score":0,
"isDefault":false,
"excludeRandomize":0,
"id":252834875,
"text":"Weekly"
},
{
"score":0,
"isDefault":false,
"excludeRandomize":0,
"id":252834876,
"text":"Monthly"
},
{
"score":0,
"isDefault":false,
"excludeRandomize":0,
"id":252834877,
"text":"Quarterly"
},
{
"score":0,
"isDefault":false,
"excludeRandomize":0,
"id":252834878,
"text":"Annually"
}
],
"id":48612631,
"text":"How often do you conduct surveys?"
}
],
"dynamicExplodeText":"",
"sectionID":1,
"type":"U",
"minAnswers":0,
"required":false,
"hasPageBreak":false,
"random":false,
"randomSection":false,
"subtype":"A"
}
],
"surveyTheme":{
"titleBarBGGrad":"#233954",
"buttonHoverBG":"#9e9f9f",
"surveyBGGrad":"#4f4f4f",
"titleBarTextColor":"#ffffff",
"buttonTextColor":"#3b3b3b"
},
"numericTitle":0
},
"status":{
"method":"questionpro.survey.getSurvey",
"serverUTC":1470390437541,
"id":200,
"message":"OK",
"url":"/a/api/questionpro.survey.getSurvey"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getSurvey
Sample Request
public String getSurveyURL(){
return "http://api.questionpro.com/a/api/questionpro.survey.getSurvey?accessKey="
+ getAccessKey();
}
public JSONObject getSurvey() throws Exception {
String path = getSurveyURL();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
data.put("id", getSurveyID());
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
Sample Response
{
"response":{
"connectURL":"http://www.questionpro.com/t/AIBHLZVEJR",
"subtitle":"Aug 05 2016",
"languageContent":[
],
"thankYouMessage":"Thank you for completing this survey.",
"surveyLanguages":[
{
"isDefault":true,
"name":"English"
}
],
"id":4782051,
"hasScoringLogic":false,
"title":"CSat Survey",
"sections":[
{
"numTasks":0,
"exactMinAnswers":0,
"orientation":2,
"code":"Q1",
"maxAnswers":0,
"questions":[
{
"orderNumber":0,
"answers":[
{
"score":0,
"isDefault":false,
"excludeRandomize":0,
"id":252834875,
"text":"Weekly"
},
{
"score":0,
"isDefault":false,
"excludeRandomize":0,
"id":252834876,
"text":"Monthly"
},
{
"score":0,
"isDefault":false,
"excludeRandomize":0,
"id":252834877,
"text":"Quarterly"
},
{
"score":0,
"isDefault":false,
"excludeRandomize":0,
"id":252834878,
"text":"Annually"
}
],
"id":48612631,
"text":"How often do you conduct surveys?"
}
],
"dynamicExplodeText":"",
"sectionID":1,
"type":"U",
"minAnswers":0,
"required":false,
"hasPageBreak":false,
"random":false,
"randomSection":false,
"subtype":"A"
}
],
"surveyTheme":{
"titleBarBGGrad":"#233954",
"buttonHoverBG":"#9e9f9f",
"surveyBGGrad":"#4f4f4f",
"titleBarTextColor":"#ffffff",
"buttonTextColor":"#3b3b3b"
},
"numericTitle":0
},
"status":{
"method":"questionpro.survey.getSurvey",
"serverUTC":1470390437541,
"id":200,
"message":"OK",
"url":"/a/api/questionpro.survey.getSurvey"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getSurvey
Sample Request
public function getSurveyURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.getSurvey?accessKey=".$this->getAccessKey();
}
public function getSurvey() {
$path = $this->getSurveyURL();
$data = array('id' => $this->getSurveyID());
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{
"response":{
"connectURL":"http://www.questionpro.com/t/AIBHLZVEJR",
"subtitle":"Aug 05 2016",
"languageContent":[
],
"thankYouMessage":"Thank you for completing this survey.",
"surveyLanguages":[
{
"isDefault":true,
"name":"English"
}
],
"id":4782051,
"hasScoringLogic":false,
"title":"CSat Survey",
"sections":[
{
"numTasks":0,
"exactMinAnswers":0,
"orientation":2,
"code":"Q1",
"maxAnswers":0,
"questions":[
{
"orderNumber":0,
"answers":[
{
"score":0,
"isDefault":false,
"excludeRandomize":0,
"id":252834875,
"text":"Weekly"
},
{
"score":0,
"isDefault":false,
"excludeRandomize":0,
"id":252834876,
"text":"Monthly"
},
{
"score":0,
"isDefault":false,
"excludeRandomize":0,
"id":252834877,
"text":"Quarterly"
},
{
"score":0,
"isDefault":false,
"excludeRandomize":0,
"id":252834878,
"text":"Annually"
}
],
"id":48612631,
"text":"How often do you conduct surveys?"
}
],
"dynamicExplodeText":"",
"sectionID":1,
"type":"U",
"minAnswers":0,
"required":false,
"hasPageBreak":false,
"random":false,
"randomSection":false,
"subtype":"A"
}
],
"surveyTheme":{
"titleBarBGGrad":"#233954",
"buttonHoverBG":"#9e9f9f",
"surveyBGGrad":"#4f4f4f",
"titleBarTextColor":"#ffffff",
"buttonTextColor":"#3b3b3b"
},
"numericTitle":0
},
"status":{
"method":"questionpro.survey.getSurvey",
"serverUTC":1470390437541,
"id":200,
"message":"OK",
"url":"/a/api/questionpro.survey.getSurvey"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getSurvey
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.getSurvey'
payload = { 'id':3889871 }
r = requests.post(url, data=json.dumps(payload))
Sample Response
{
"response":{
"connectURL":"http://www.questionpro.com/t/AIBHLZVEJR",
"subtitle":"Aug 05 2016",
"languageContent":[
],
"thankYouMessage":"Thank you for completing this survey.",
"surveyLanguages":[
{
"isDefault":true,
"name":"English"
}
],
"id":4782051,
"hasScoringLogic":false,
"title":"CSat Survey",
"sections":[
{
"numTasks":0,
"exactMinAnswers":0,
"orientation":2,
"code":"Q1",
"maxAnswers":0,
"questions":[
{
"orderNumber":0,
"answers":[
{
"score":0,
"isDefault":false,
"excludeRandomize":0,
"id":252834875,
"text":"Weekly"
},
{
"score":0,
"isDefault":false,
"excludeRandomize":0,
"id":252834876,
"text":"Monthly"
},
{
"score":0,
"isDefault":false,
"excludeRandomize":0,
"id":252834877,
"text":"Quarterly"
},
{
"score":0,
"isDefault":false,
"excludeRandomize":0,
"id":252834878,
"text":"Annually"
}
],
"id":48612631,
"text":"How often do you conduct surveys?"
}
],
"dynamicExplodeText":"",
"sectionID":1,
"type":"U",
"minAnswers":0,
"required":false,
"hasPageBreak":false,
"random":false,
"randomSection":false,
"subtype":"A"
}
],
"surveyTheme":{
"titleBarBGGrad":"#233954",
"buttonHoverBG":"#9e9f9f",
"surveyBGGrad":"#4f4f4f",
"titleBarTextColor":"#ffffff",
"buttonTextColor":"#3b3b3b"
},
"numericTitle":0
},
"status":{
"method":"questionpro.survey.getSurvey",
"serverUTC":1470390437541,
"id":200,
"message":"OK",
"url":"/a/api/questionpro.survey.getSurvey"
}
}
Delete Survey
Method: questionpro.survey.deleteSurvey
This API call can be used to delete a specific survey.
Attributes
Name
|
Value
|
Required
|
surveyID
|
Survey ID
|
✔
|
URL
http://api.questionpro.com/a/api/questionpro.survey.deleteSurvey
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.deleteSurvey
HTTP/1.1
Accept: application/json
{
"surveyID":3889871,
}
Sample Response
{
"response": {
"surveyID": 6110,
"success": 1,
"message": "Survey deleted successfully"
},
"status": {
"method": "questionpro.survey.deleteSurvey",
"apiKey": "xxxx",
"serverUTC": 1461566204206,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.deleteSurvey"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.deleteSurvey
Sample Request
public String deleteSurveyURL(){
return "http://api.questionpro.com/a/api/questionpro.survey.deleteSurvey?accessKey="
+ getAccessKey();
}
public JSONObject deleteSurvey() throws Exception {
String path = deleteSurveyURL();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
data.put("surveyID", getSurveyID());
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
Sample Response
{
"response": {
"surveyID": 6110,
"success": 1,
"message": "Survey deleted successfully"
},
"status": {
"method": "questionpro.survey.deleteSurvey",
"apiKey": "xxxx",
"serverUTC": 1461566204206,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.deleteSurvey"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.deleteSurvey
Sample Request
public function deleteSurveyURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.deleteSurvey?accessKey=".$this->getAccessKey();
}
public function deleteSurvey() {
$path = $this->deleteSurveyURL();
$data = array('surveyID' => $this->getSurveyID());
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{
"response": {
"surveyID": 6110,
"success": 1,
"message": "Survey deleted successfully"
},
"status": {
"method": "questionpro.survey.deleteSurvey",
"apiKey": "xxxx",
"serverUTC": 1461566204206,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.deleteSurvey"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.deleteSurvey
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.deleteSurvey'
payload = { 'surveyID':3889871 }
r = requests.post(url, data=json.dumps(payload))
Sample Response
{
"response": {
"surveyID": 6110,
"success": 1,
"message": "Survey deleted successfully"
},
"status": {
"method": "questionpro.survey.deleteSurvey",
"apiKey": "xxxx",
"serverUTC": 1461566204206,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.deleteSurvey"
}
}
Get All Email Lists
Method: questionpro.survey.getEmailLists
This API call can be used to get all email lists for a given survey.
It returns global as well as survey-specific list.
Attributes
Name
|
Value
|
Required
|
surveyID
|
Survey ID
|
✔
|
URL
http://api.questionpro.com/a/api/questionpro.survey.getEmailLists
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.getEmailLists
HTTP/1.1
Accept: application/json
{
"surveyID":3889871,
}
Sample Response
{
"response": {
"emailLists": [
{
"surveyID": 0,
"name": "my global list",
"emailGroupID": 1300,
"email": "[email protected], [email protected], [email protected]",
"statistics": {
"unsubscribed": "3",
"total": 3,
"active": "0",
"pendinVerification": 0,
"bounced": "0"
}
},
{
"surveyID": 5395,
"name": "Email-List-test",
"emailGroupID": 1354,
"email": "[email protected]",
"statistics": {
"unsubscribed": "0",
"total": 1,
"active": "1",
"pendinVerification": 0,
"bounced": "0"
}
},
{
"surveyID": 5395,
"name": "Default List-1",
"emailGroupID": 1355,
"email": "",
"statistics": {
"unsubscribed": "0",
"total": 0,
"active": "0",
"pendinVerification": 0,
"bounced": "0"
}
}
]
},
"status": {
"method": "questionpro.survey.getEmailLists",
"apiKey": "xxxx",
"serverUTC": 1461566830499,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getEmailLists"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getEmailLists
Sample Request
public String getEmailListsURL(){
return "http://api.questionpro.com/a/api/questionpro.survey.getEmailLists?accessKey="
+ getAccessKey();
}
public JSONObject getEmailLists() throws Exception {
String path = getEmailListsURL();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
data.put("surveyID", getSurveyID());
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
Sample Response
{
"response": {
"emailLists": [
{
"surveyID": 0,
"name": "my global list",
"emailGroupID": 1300,
"email": "[email protected], [email protected], [email protected]",
"statistics": {
"unsubscribed": "3",
"total": 3,
"active": "0",
"pendinVerification": 0,
"bounced": "0"
}
},
{
"surveyID": 5395,
"name": "Email-List-test",
"emailGroupID": 1354,
"email": "[email protected]",
"statistics": {
"unsubscribed": "0",
"total": 1,
"active": "1",
"pendinVerification": 0,
"bounced": "0"
}
},
{
"surveyID": 5395,
"name": "Default List-1",
"emailGroupID": 1355,
"email": "",
"statistics": {
"unsubscribed": "0",
"total": 0,
"active": "0",
"pendinVerification": 0,
"bounced": "0"
}
}
]
},
"status": {
"method": "questionpro.survey.getEmailLists",
"apiKey": "xxxx",
"serverUTC": 1461566830499,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getEmailLists"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getEmailLists
Sample Request
public function getEmailListsURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.getEmailLists?accessKey=".$this->getAccessKey();
}
public function getEmailLists() {
$path = $this->getEmailListsURL();
$data = array('surveyID' => $this->getSurveyID());
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{
"response": {
"emailLists": [
{
"surveyID": 0,
"name": "my global list",
"emailGroupID": 1300,
"email": "[email protected], [email protected], [email protected]",
"statistics": {
"unsubscribed": "3",
"total": 3,
"active": "0",
"pendinVerification": 0,
"bounced": "0"
}
},
{
"surveyID": 5395,
"name": "Email-List-test",
"emailGroupID": 1354,
"email": "[email protected]",
"statistics": {
"unsubscribed": "0",
"total": 1,
"active": "1",
"pendinVerification": 0,
"bounced": "0"
}
},
{
"surveyID": 5395,
"name": "Default List-1",
"emailGroupID": 1355,
"email": "",
"statistics": {
"unsubscribed": "0",
"total": 0,
"active": "0",
"pendinVerification": 0,
"bounced": "0"
}
}
]
},
"status": {
"method": "questionpro.survey.getEmailLists",
"apiKey": "xxxx",
"serverUTC": 1461566830499,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getEmailLists"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getEmailLists
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.getEmailLists'
payload = { 'surveyID':3889871 }
r = requests.post(url, data=json.dumps(payload))
Sample Response
{
"response": {
"emailLists": [
{
"surveyID": 0,
"name": "my global list",
"emailGroupID": 1300,
"email": "[email protected], [email protected], [email protected]",
"statistics": {
"unsubscribed": "3",
"total": 3,
"active": "0",
"pendinVerification": 0,
"bounced": "0"
}
},
{
"surveyID": 5395,
"name": "Email-List-test",
"emailGroupID": 1354,
"email": "[email protected]",
"statistics": {
"unsubscribed": "0",
"total": 1,
"active": "1",
"pendinVerification": 0,
"bounced": "0"
}
},
{
"surveyID": 5395,
"name": "Default List-1",
"emailGroupID": 1355,
"email": "",
"statistics": {
"unsubscribed": "0",
"total": 0,
"active": "0",
"pendinVerification": 0,
"bounced": "0"
}
}
]
},
"status": {
"method": "questionpro.survey.getEmailLists",
"apiKey": "xxxx",
"serverUTC": 1461566830499,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getEmailLists"
}
}
Get Specific Email List
Method: questionpro.survey.getEmailList
This API call can be used to get specific email list with requested email group id.
Attributes
Name
|
Value
|
Required
|
emailGroupID
|
Email Group ID
|
✔
|
URL
http://api.questionpro.com/a/api/questionpro.survey.getEmailList
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.getEmailList
HTTP/1.1
Accept: application/json
{
"emailGroupID":3889871,
}
Sample Response
{
"response": {
"emailList": {
"surveyID": 5395,
"name": "Email-List-test",
"emailGroupID": 1354,
"email": "[email protected]",
"statistics": {
"unsubscribed": "0",
"total": 1,
"active": "1",
"pendinVerification": 0,
"bounced": "0"
}
}
},
"status": {
"method": "questionpro.survey.getEmailList",
"apiKey": "xxxx",
"serverUTC": 1461567017465,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getEmailList"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getEmailList
Sample Request
public String getEmailListURL(){
return "http://api.questionpro.com/a/api/questionpro.survey.getEmailList?accessKey="
+ getAccessKey();
}
public JSONObject getEmailList() throws Exception {
String path = getEmailListURL();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
data.put("emailGroupID", getEmailGroupID());
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
Sample Response
{
"response": {
"emailList": {
"surveyID": 5395,
"name": "Email-List-test",
"emailGroupID": 1354,
"email": "[email protected]",
"statistics": {
"unsubscribed": "0",
"total": 1,
"active": "1",
"pendinVerification": 0,
"bounced": "0"
}
}
},
"status": {
"method": "questionpro.survey.getEmailList",
"apiKey": "xxxx",
"serverUTC": 1461567017465,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getEmailList"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getEmailList
Sample Request
public function getEmailListURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.getEmailList?accessKey=".$this->getAccessKey();
}
public function getEmailList() {
$path = $this->getEmailListURL();
$data = array('emailGroupID' => $this->getEmailGroupID());
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{
"response": {
"emailList": {
"surveyID": 5395,
"name": "Email-List-test",
"emailGroupID": 1354,
"email": "[email protected]",
"statistics": {
"unsubscribed": "0",
"total": 1,
"active": "1",
"pendinVerification": 0,
"bounced": "0"
}
}
},
"status": {
"method": "questionpro.survey.getEmailList",
"apiKey": "xxxx",
"serverUTC": 1461567017465,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getEmailList"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getEmailList
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.getEmailList'
payload = { 'emailGroupID':3889871 }
r = requests.post(url, data=json.dumps(payload))
Sample Response
{
"response": {
"emailList": {
"surveyID": 5395,
"name": "Email-List-test",
"emailGroupID": 1354,
"email": "[email protected]",
"statistics": {
"unsubscribed": "0",
"total": 1,
"active": "1",
"pendinVerification": 0,
"bounced": "0"
}
}
},
"status": {
"method": "questionpro.survey.getEmailList",
"apiKey": "xxxx",
"serverUTC": 1461567017465,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getEmailList"
}
}
Delete Specific Email List
Method: questionpro.survey.deleteEmailList
This API call can be used to delete specific email list with requested email group
id.
Attributes
Name
|
Value
|
Required
|
emailGroupID
|
Email Group ID
|
✔
|
URL
http://api.questionpro.com/a/api/questionpro.survey.deleteEmailList
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.deleteEmailList
HTTP/1.1
Accept: application/json
{
"emailGroupID":3889871
}
Sample Response
{
"response": {
"success": 1,
"message": "Email Group deleted successfully",
"emailGroupID": 1354
},
"status": {
"method": "questionpro.survey.deleteEmailList",
"apiKey": "xxxx",
"serverUTC": 1461567218720,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.deleteEmailList"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.deleteEmailList
Sample Request
public String deleteEmailListURL(){
return "http://api.questionpro.com/a/api/questionpro.survey.deleteEmailList?accessKey="
+ getAccessKey();
}
public JSONObject deleteEmailList() throws Exception {
String path = deleteEmailListURL();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
data.put("emailGroupID", getEmailGroupID());
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
Sample Response
{
"response": {
"success": 1,
"message": "Email Group deleted successfully",
"emailGroupID": 1354
},
"status": {
"method": "questionpro.survey.deleteEmailList",
"apiKey": "xxxx",
"serverUTC": 1461567218720,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.deleteEmailList"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.deleteEmailList
Sample Request
public function deleteEmailListURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.deleteEmailList?accessKey=".$this->getAccessKey();
}
public function deleteEmailList() {
$path = $this->deleteEmailListURL();
$data = array('emailGroupID' => $this->getEmailGroupID());
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{
"response": {
"success": 1,
"message": "Email Group deleted successfully",
"emailGroupID": 1354
},
"status": {
"method": "questionpro.survey.deleteEmailList",
"apiKey": "xxxx",
"serverUTC": 1461567218720,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.deleteEmailList"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.deleteEmailList
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.deleteEmailList'
payload = { 'emailgroupID':3889871 }
r = requests.post(url, data=json.dumps(payload))
Sample Response
{
"response": {
"success": 1,
"message": "Email Group deleted successfully",
"emailGroupID": 1354
},
"status": {
"method": "questionpro.survey.deleteEmailList",
"apiKey": "xxxx",
"serverUTC": 1461567218720,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.deleteEmailList"
}
}
Get All Email Templates
Method: questionpro.survey.getEmailTemplates
This API call can be used to get all email templates for a given survey.
Attributes
Name
|
Value
|
Required
|
surveyID
|
Survey ID
|
✔
|
URL
http://api.questionpro.com/a/api/questionpro.survey.getEmailTemplates
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.getEmailTemplates
HTTP/1.1
Accept: application/json
{
"surveyID":3889871
}
Sample Response
"response": {
"emailTemplates": [
{
"surveyID": 5395,
"templateID": 123,
"title": "Test-Survey-Specific",
"contentSummary": "Hello,\n\nWe would appreciate your feedback"
}
]
},
"status": {
"method": "questionpro.survey.getEmailTemplates",
"apiKey": "xxxx",
"serverUTC": 1461567860254,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getEmailTemplates"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getEmailTemplates
Sample Request
public String getEmailTemplatesURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.getEmailTemplates?accessKey="
+ getAccessKey();
}
public JSONObject getEmailTemplates() throws Exception {
String path = getEmailTemplatesURL();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
data.put("surveyID", getSurveyID());
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
Sample Response
"response": {
"emailTemplates": [
{
"surveyID": 5395,
"templateID": 123,
"title": "Test-Survey-Specific",
"contentSummary": "Hello,\n\nWe would appreciate your feedback"
}
]
},
"status": {
"method": "questionpro.survey.getEmailTemplates",
"apiKey": "xxxx",
"serverUTC": 1461567860254,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getEmailTemplates"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getEmailTemplates
Sample Request
public function getEmailTemplatesURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.getEmailTemplates?accessKey=".$this->getAccessKey();
}
public function getEmailTemplates() {
$path = $this->getEmailTemplatesURL();
$data = array('surveyID' => $this->getSurveyID());
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
"response": {
"emailTemplates": [
{
"surveyID": 5395,
"templateID": 123,
"title": "Test-Survey-Specific",
"contentSummary": "Hello,\n\nWe would appreciate your feedback"
}
]
},
"status": {
"method": "questionpro.survey.getEmailTemplates",
"apiKey": "xxxx",
"serverUTC": 1461567860254,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getEmailTemplates"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getEmailTemplates
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.getEmailTemplates'
payload = { 'surveyID':3889871 }
r = requests.post(url, data=json.dumps(payload))
Sample Response
"response": {
"emailTemplates": [
{
"surveyID": 5395,
"templateID": 123,
"title": "Test-Survey-Specific",
"contentSummary": "Hello,\n\nWe would appreciate your feedback"
}
]
},
"status": {
"method": "questionpro.survey.getEmailTemplates",
"apiKey": "xxxx",
"serverUTC": 1461567860254,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getEmailTemplates"
}
}
Get Email Template
Method: questionpro.survey.getEmailTemplate
This API call can be used to get a specific email template with requested template
id.
Attributes
Name
|
Value
|
Required
|
templateID
|
Template ID
|
✔
|
URL
http://api.questionpro.com/a/api/questionpro.survey.getEmailTemplate
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.getEmailTemplate
HTTP/1.1
Accept: application/json
{
"templateID":3889871
}
Sample Response
{
"response": {
"emailTemplate": {
"surveyID": 5395,
"templateID": 123,
"title": "Test-Survey-Specific",
"type": "2",
"contentSummary": "Hello,\n\nWe would appreciate your feedback"
}
},
"status": {
"method": "questionpro.survey.getEmailTemplate",
"apiKey": "xxxx",
"serverUTC": 1461567927522,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getEmailTemplate"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getEmailTemplate
Sample Request
public String getEmailTemplateURL(){
return "http://api.questionpro.com/a/api/questionpro.survey.getEmailTemplate?accessKey="
+ getAccessKey();
}
public JSONObject getEmailTemplate() throws Exception {
String path = getEmailTemplateURL();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
data.put("templateID", getTemplateID());
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
Sample Response
{
"response": {
"emailTemplate": {
"surveyID": 5395,
"templateID": 123,
"title": "Test-Survey-Specific",
"type": "2",
"contentSummary": "Hello,\n\nWe would appreciate your feedback"
}
},
"status": {
"method": "questionpro.survey.getEmailTemplate",
"apiKey": "xxxx",
"serverUTC": 1461567927522,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getEmailTemplate"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getEmailTemplate
Sample Request
public function getEmailTemplateURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.getEmailTemplate?accessKey=".$this->getAccessKey();
}
public function getEmailTemplate() {
$path = $this->getEmailTemplateURL();
$data = array('templateID' => $this->getTemplateID());
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{
"response": {
"emailTemplate": {
"surveyID": 5395,
"templateID": 123,
"title": "Test-Survey-Specific",
"type": "2",
"contentSummary": "Hello,\n\nWe would appreciate your feedback"
}
},
"status": {
"method": "questionpro.survey.getEmailTemplate",
"apiKey": "xxxx",
"serverUTC": 1461567927522,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getEmailTemplate"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getEmailTemplate
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.getEmailTemplate'
payload = { 'templateID':3889871 }
r = requests.post(url, data=json.dumps(payload))
Sample Response
{
"response": {
"emailTemplate": {
"surveyID": 5395,
"templateID": 123,
"title": "Test-Survey-Specific",
"type": "2",
"contentSummary": "Hello,\n\nWe would appreciate your feedback"
}
},
"status": {
"method": "questionpro.survey.getEmailTemplate",
"apiKey": "xxxx",
"serverUTC": 1461567927522,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.getEmailTemplate"
}
}
Delete Email Template
Method: questionpro.survey.deleteEmailTemplate
This API call can be used to delete a specific email template with requested template
id.
Attributes
Name
|
Value
|
Required
|
templateID
|
Template ID
|
✔
|
URL
http://api.questionpro.com/a/api/questionpro.survey.deleteEmailTemplate
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.deleteEmailTemplate
HTTP/1.1
Accept: application/json
{
"templateID":3889871
}
Sample Response
{
"response": {
"success": 1,
"templateID": 123,
"message": "Email Template deleted successfully"
},
"status": {
"method": "questionpro.survey.deleteEmailTemplate",
"apiKey": "xxxx",
"serverUTC": 1461568015962,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.deleteEmailTemplate"
}
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.deleteEmailTemplate
Sample Request
public String deleteEmailTemplateURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.deleteEmailTemplate?accessKey="
+ getAccessKey();
}
public JSONObject deleteEmailTemplate() throws Exception {
String path = deleteEmailTemplateURL();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
data.put("templateID", getTemplateID());
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
Sample Response
{
"response": {
"success": 1,
"templateID": 123,
"message": "Email Template deleted successfully"
},
"status": {
"method": "questionpro.survey.deleteEmailTemplate",
"apiKey": "xxxx",
"serverUTC": 1461568015962,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.deleteEmailTemplate"
}
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.deleteEmailTemplate
Sample Request
public function deleteEmailTemplateURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.deleteEmailTemplate?accessKey=".$this->getAccessKey();
}
public function deleteEmailTemplate() {
$path = $this->deleteEmailTemplateURL();
$data = array('templateID' => $this->getTemplateID());
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{
"response": {
"success": 1,
"templateID": 123,
"message": "Email Template deleted successfully"
},
"status": {
"method": "questionpro.survey.deleteEmailTemplate",
"apiKey": "xxxx",
"serverUTC": 1461568015962,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.deleteEmailTemplate"
}
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.deleteEmailTemplate
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.deleteEmailTemplate'
payload = { 'templateID':3889871 }
r = requests.post(url, data=json.dumps(payload))
Sample Response
{
"response": {
"success": 1,
"templateID": 123,
"message": "Email Template deleted successfully"
},
"status": {
"method": "questionpro.survey.deleteEmailTemplate",
"apiKey": "xxxx",
"serverUTC": 1461568015962,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.deleteEmailTemplate"
}
}
}
Get Specific Response
Method: questionpro.survey.surveyResponse
This API call can be used to get a specific survey response for a given survey.
Attributes
Name
|
Value
|
Required
|
surveyID
|
Survey ID
|
✔
|
responseID
|
Response ID
|
✔
|
URL
http://api.questionpro.com/a/api/questionpro.survey.surveyResponse
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.surveyResponse
HTTP/1.1
Accept: application/json
{
"surveyID":3889871,
"responseID":"12345"
}
Sample Response
{
"response": {
"surveyResponse": {
"externalReference": "test_response",
"timeTaken": 23,
"ipAddress": "127.0.0.1",
"UTCTimestamp": 13,
"id": 29245,
"duplicate": false,
"responseStatus": "Yes",
"responseSet": [
{
"questionDescription": " ",
"questionID": 17607029,
"questionCode": "Q1",
"values": [
{
"answerText": "Weekly",
"id": "135906",
"value": {
"scale": "1",
"dynamic": "[Weekly]\r\nabc "
}
}
],
"questionText": "How often do you conduct surveys?"
}
],
"timestamp": "24 Feb, 2016 05:00:13 PM IST"
},
"name": "emojiSurvey1",
"id": 123,
"status": "Active"
},
"status": {
"method": "questionpro.survey.surveyResponse",
"apiKey": "xxxx",
"serverUTC": 1461568638389,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.surveyResponse"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.surveyResponse
Sample Request
public String surveyResponseURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.surveyResponse?accessKey="
+ getAccessKey();
}
public JSONObject surveyResponse() throws Exception {
String path = surveyResponseURL();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
data.put("surveyID", getSurveyID());
data.put("responseID", getResponseID());
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
Sample Response
{
"response": {
"surveyResponse": {
"externalReference": "test_response",
"timeTaken": 23,
"ipAddress": "127.0.0.1",
"UTCTimestamp": 13,
"id": 29245,
"duplicate": false,
"responseStatus": "Yes",
"responseSet": [
{
"questionDescription": " ",
"questionID": 17607029,
"questionCode": "Q1",
"values": [
{
"answerText": "Weekly",
"id": "135906",
"value": {
"scale": "1",
"dynamic": "[Weekly]\r\nabc "
}
}
],
"questionText": "How often do you conduct surveys?"
}
],
"timestamp": "24 Feb, 2016 05:00:13 PM IST"
},
"name": "emojiSurvey1",
"id": 123,
"status": "Active"
},
"status": {
"method": "questionpro.survey.surveyResponse",
"apiKey": "xxxx",
"serverUTC": 1461568638389,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.surveyResponse"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.surveyResponse
Sample Request
public function surveyResponseURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.surveyResponse?accessKey=".$this->getAccessKey();
}
public function surveyResponse() {
$path = $this->surveyResponseURL();
$data = array('surveyID' => $this->getSurveyID(),'responseID' => $this->getResponseID());
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{
"response": {
"surveyResponse": {
"externalReference": "test_response",
"timeTaken": 23,
"ipAddress": "127.0.0.1",
"UTCTimestamp": 13,
"id": 29245,
"duplicate": false,
"responseStatus": "Yes",
"responseSet": [
{
"questionDescription": " ",
"questionID": 17607029,
"questionCode": "Q1",
"values": [
{
"answerText": "Weekly",
"id": "135906",
"value": {
"scale": "1",
"dynamic": "[Weekly]\r\nabc "
}
}
],
"questionText": "How often do you conduct surveys?"
}
],
"timestamp": "24 Feb, 2016 05:00:13 PM IST"
},
"name": "emojiSurvey1",
"id": 123,
"status": "Active"
},
"status": {
"method": "questionpro.survey.surveyResponse",
"apiKey": "xxxx",
"serverUTC": 1461568638389,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.surveyResponse"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.surveyResponse
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.surveyResponse'
payload = { 'surveyID':3889871, 'responseID':'12345' }
r = requests.post(url, data=json.dumps(payload))
Sample Response
{
"response": {
"surveyResponse": {
"externalReference": "test_response",
"timeTaken": 23,
"ipAddress": "127.0.0.1",
"UTCTimestamp": 13,
"id": 29245,
"duplicate": false,
"responseStatus": "Yes",
"responseSet": [
{
"questionDescription": " ",
"questionID": 17607029,
"questionCode": "Q1",
"values": [
{
"answerText": "Weekly",
"id": "135906",
"value": {
"scale": "1",
"dynamic": "[Weekly]\r\nabc "
}
}
],
"questionText": "How often do you conduct surveys?"
}
],
"timestamp": "24 Feb, 2016 05:00:13 PM IST"
},
"name": "emojiSurvey1",
"id": 123,
"status": "Active"
},
"status": {
"method": "questionpro.survey.surveyResponse",
"apiKey": "xxxx",
"serverUTC": 1461568638389,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.surveyResponse"
}
}
Delete a Specific Response
Method: questionpro.survey.deleteResponse
This API call can be used to get a specific survey response for a given survey.
Attributes
Name
|
Value
|
Required
|
surveyID
|
Survey ID
|
✔
|
responseID
|
Response ID
|
✔
|
URL
http://api.questionpro.com/a/api/questionpro.survey.deleteResponse
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.deleteResponse
HTTP/1.1
Accept: application/json
{
"surveyID":3889871,
"responseID":"12345"
}
Sample Response
{
"response": {
"surveyID": 123,
"success": 1,
"message": "Response deleted successfully",
"responseID": 4567
},
"status": {
"method": "questionpro.survey.deleteResponse",
"apiKey": "xxxx",
"serverUTC": 1461568860575,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.deleteResponse"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.deleteResponse
Sample Request
public String deleteResponseURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.deleteResponse?accessKey="
+ getAccessKey();
}
public JSONObject deleteResponse() throws Exception {
String path = deleteResponseURL();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject data = new JSONObject();
data.put("surveyID", getSurveyID());
data.put("responseID", getResponseID());
StringEntity se = new StringEntity(data.toString());
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 new JSONObject(resp.toString());
}
Sample Response
{
"response": {
"surveyID": 123,
"success": 1,
"message": "Response deleted successfully",
"responseID": 4567
},
"status": {
"method": "questionpro.survey.deleteResponse",
"apiKey": "xxxx",
"serverUTC": 1461568860575,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.deleteResponse"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.deleteResponse
Sample Request
public function deleteResponseURL(){
return
"http://api.questionpro.com/a/api/questionpro.survey.deleteResponse?accessKey=".$this->getAccessKey();
}
public function deleteResponse() {
$path = $this->deleteResponseURL();
$data = array('surveyID' => $this->getSurveyID(),'responseID' => $this->getResponseID());
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{
"response": {
"surveyID": 123,
"success": 1,
"message": "Response deleted successfully",
"responseID": 4567
},
"status": {
"method": "questionpro.survey.deleteResponse",
"apiKey": "xxxx",
"serverUTC": 1461568860575,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.deleteResponse"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.deleteResponse
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.deleteResponse'
payload = { 'surveyID':3889871, 'responseID':'12345' }
r = requests.post(url, data=json.dumps(payload))
Sample Response
{
"response": {
"surveyID": 123,
"success": 1,
"message": "Response deleted successfully",
"responseID": 4567
},
"status": {
"method": "questionpro.survey.deleteResponse",
"apiKey": "xxxx",
"serverUTC": 1461568860575,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.survey.deleteResponse"
}
}
Get Un-Subscribed Email List
Method: questionpro.survey.getUnsubscribedEmailAddresses
This API call will return list of unsubscribed email list based on the filtering criteria.
Attributes
Name
|
Value
|
Required
|
id
|
Survey ID
|
✕
|
startDate*
|
Start Date for response time range
|
✕
|
endDate*
|
End Date for response time range
|
✕
|
*Either both Start Date and End Date have to be entered else neither
URL
http://api.questionpro.com/a/api/questionpro.survey.getUnsubscribedEmailAddresses
Sample Request
POST http://api.questionpro.com/a/api/questionpro.survey.getUnsubscribedEmailAddresses
HTTP/1.1
Accept: application/json
{
"id":9051,
"startDate" : "2017-09-20T00:00:00+05:30",
"endDate":"2017-09-23T00:00:00+05:30"
}
Sample Response
{
"response": {
"response": [
{
"emailAddress": "[email protected]",
"id": 142048,
"unsubscribedTime": "2017-09-22 00:00:00.0"
}
]
},
"status": {
"apiKey": "c4ebeef1-63d9-4593-883c-c772a40f2719",
"id": 200,
"message": "OK",
"method": "questionpro.survey.getUnsubscribedEmailAddresses",
"serverUTC": 1507705009904,
"url": "/a/api/questionpro.survey.getUnsubscribedEmailAddresses"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getUnsubscribedEmailAddresses
Sample Request
public function getUnsubscribedEmailAddressesUrl() {
return "http://api.questionpro.com/a/api/questionpro.survey.getUnsubscribedEmailAddresses?accessKey=" + getAccessKey();
}
public String getUnsubscribedEmailAddresses() throws Exception {
String path = getUnsubscribedEmailAddressesUrl();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
String data = "{"id":"" + getSurveyID() + "","startDate":"2016-10-19T21:12:13+05:30","
+
""endDate":"2016-10-22T23:10:10+05:30""}";
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();
}
Sample Response
{
"response": {
"response": [
{
"emailAddress": "[email protected]",
"id": 142048,
"unsubscribedTime": "2017-09-22 00:00:00.0"
}
]
},
"status": {
"apiKey": "c4ebeef1-63d9-4593-883c-c772a40f2719",
"id": 200,
"message": "OK",
"method": "questionpro.survey.getUnsubscribedEmailAddresses",
"serverUTC": 1507705009904,
"url": "/a/api/questionpro.survey.getUnsubscribedEmailAddresses"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getUnsubscribedEmailAddresses
Sample Request
public function getUnsubscribedEmailAddressesUrl() {
return "http://api.questionpro.com/a/api/questionpro.survey.getUnsubscribedEmailAddresses?accessKey=".$this->getAccessKey();
}
public function getUnsubscribedEmailAddresses() {
$path = $this->getUnsubscribedEmailAddressesUrl();
$data = array('id' => $this->getSurveyID(), 'startDate' => '2017-09-20T00:00:00+05:30', 'endDate' => '2017-09-23T00:00:00+05:30');
$json_string = json_encode($data);
$ch = curl_init($path);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$resp = curl_exec($ch);
return $resp;
}
Sample Response
{
"response": {
"response": [
{
"emailAddress": "[email protected]",
"id": 142048,
"unsubscribedTime": "2017-09-22 00:00:00.0"
}
]
},
"status": {
"apiKey": "c4ebeef1-63d9-4593-883c-c772a40f2719",
"id": 200,
"message": "OK",
"method": "questionpro.survey.getUnsubscribedEmailAddresses",
"serverUTC": 1507705009904,
"url": "/a/api/questionpro.survey.getUnsubscribedEmailAddresses"
}
}
URL
http://api.questionpro.com/a/api/questionpro.survey.getUnsubscribedEmailAddresses
Sample Request
import requests
import json
url = 'http://api.questionpro.com/a/api/questionpro.survey.getUnsubscribedEmailAddresses?accessKey=xxxxx'
payload = { 'id':3889871, 'startDate':'2017-09-20T00:00:00+05:30', 'endDate':'2017-09-23T00:00:00+05:30'}
Sample Response
{
"response": {
"response": [
{
"emailAddress": "[email protected]",
"id": 142048,
"unsubscribedTime": "2017-09-22 00:00:00.0"
}
]
},
"status": {
"apiKey": "c4ebeef1-63d9-4593-883c-c772a40f2719",
"id": 200,
"message": "OK",
"method": "questionpro.survey.getUnsubscribedEmailAddresses",
"serverUTC": 1507705009904,
"url": "/a/api/questionpro.survey.getUnsubscribedEmailAddresses"
}
}