API stands for "application programming interface." This Wikipedia article covers APIs in more detail, but it can be helpful to think of the API as a way for different apps to talk to one another. For many users, the main interaction with the API will be through API access key, a way for other apps to access your account without you giving out your password.
Method: questionpro.cx.importTransaction
This API call is used to upload the information of customers and can also send SMS and Email to customers.
Name | Value | Required |
apiKey | This is an encrypted alphanumeric string to authenticate your credentials. | ✔ |
surveyID | This is the survey id for which contacts are to be imported. | ✔ |
sendEmail | This is used to specify if email is to be sent to the imported contacts or not. | ✕ |
sendSMS | This is used to specify if sms is to be sent to the imported contacts or not. If true, then mobile no. needs to be specified. Note: To send sms, you need to have sufficient sms credit in your account. | ✕ |
firstName | This is the first name of the contact which is to be imported. | ✕ |
lastName | This is the last name of the contact which is to be imported. | ✕ |
mobile | This is the mobile number of the contact which is to be imported. | ✕ |
segmentCode | This is the segment code for which contacts are to be imported. | ✕ |
transactionDate | This is the date on which transaction was done by the contact(mm/dd/yyyy). | ✕ |
This is the email address of the contact which is to be imported | ✔ | |
field1 | This is the Custom1 variable of the contact which is to be imported. Note: Similary, we can have field2,field3,...field20, except field5, for importing Custom2,Custom3,...Custom20 variables. | ✕ |
productName | This is the product name of the contact which is to be imported. If the specified product do not exist, new product will be created. | ✕ |
productGroup | This is the product group name of the contact which is to be imported. If the specified product group do not exist, new product group will be created. Note: To have a product group, product is mandatory. | ✕ |
invitationTemplateID | This is the id of the customized created email template, if any. Note: The value for Default email template is -1. | ✕ |
status |
Following are the status of response generated, after importing the
contacts via this API.
|
NOTE:
*All the parameter names are Case Sensitive.
*One API call cannot exceed 500 contacts.
http://www.questionpro.com/a/questionpro.cx.importTransaction?apiKey={API-KEY}
POST
https://www.questionpro.com/a/api/questionpro.cx.importTransaction?apiKey=4dbedabb-631f-4d68-b40a-e5cd47d610ce
HTTP/1.1
Accept: application/json
{
"surveyID": 6069695,
"sendEmail": "true",
"sendSMS": "false",
"contacts": [
{
"firstName": "John",
"lastName": "Johnson",
"mobile": "+12066688987",
"segmentCode": "SANFRAN",
"transactionDate": "11/30/2016",
"email": "[email protected]",
"productName": "Laptop",
"productGroup": "Lenovo"
}
],
"invitationTemplateID": 423382
}
{
"response": {
"emailStatus": "Successful: Initiated email send process.",
"ImportStatus": "Successful: Contact imported.",
"ImportCount": 1
},
"status": {
"method": "questionpro.cx.importTransaction",
"apiKey": "4dbedabb-631f-4d68-b40a-e5cd47d610ce",
"serverUTC": 1522768600787,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.cx.importTransaction"
}
}
http://www.questionpro.com/a/questionpro.cx.importTransaction?apiKey={API-KEY}
public JSONObject processTransactions() throws Exception {
String path = getAPIURL();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject requestJSON = getRequestJSON();
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 getRequestJSON() throws JSONException {
JSONObject requestJSON = new JSONObject();
requestJSON.put("surveyID", 234); // Valid Survey ID - IF not found contacts will
not be processed.
requestJSON.put("sendEmail", true); //Optional field : Default : false ; No Email
will be sent for the contacts.
requestJSON.put("sendSMS", true); //Optional field : Default : false ; No SMS will
be sent for the contacts.
requestJSON.put("contacts", getTransactions());
requestJSON.put("invitationTemplateID", 20);
return requestJSON;
}
public JSONArray getTransactions() throws JSONException{
JSONArray transactions = new JSONArray();
JSONObject transaction = new JSONObject();
transaction.put("email", "[email protected]");
transaction.put("firstName", "John");
transaction.put("lastName", "Johnson");
transaction.put("mobile","+12066688987");
transaction.put("segmentCode","SANFRAN"); // You need a valid segment code
here.
transaction.put("transactionDate","11/30/2016");
transaction.put("productName","Sony Television"); // Valid Product Name , New
product will be added, if the name is not present already.
transaction.put("productGroup","Televisions"); // Valid Product Group , New Group
will be added if the group is not present already.
transactions.put(transaction); // One API call cannot exceed
500 contacts.
return transactions;
}
public String getAPIURL() {
return " http://cx.questionpro.com/a/questionpro.cx.importTransaction?apiKey={API-KEY}"
+ getAccessKey();
}
{
"response": {
"emailStatus": "Successful: Initiated email send process.",
"ImportStatus": "Successful: Contact imported.",
"ImportCount": 1
},
"status": {
"method": "questionpro.cx.importTransaction",
"apiKey": "4dbedabb-631f-4d68-b40a-e5cd47d610ce",
"serverUTC": 1522768600787,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.cx.importTransaction"
}
}
Method: questionpro.cx.exportDetractorData
This API call is used to download the information of unsatisfied customers or detractor data which can be further used for improving the services.
Name | Value | Required |
apiKey | This is an encrypted alphanumeric string to authenticate your credentials. | ✔ |
segmentID | This is the segment id for which detractor ticket information is to be downloaded. | ✔ |
status |
Following are the status of detractor tickets, for which information is to
be downloaded.
|
✕ |
NOTE:
*All the parameter names are Case Sensitive.
*One API call cannot exceed 500 contacts.
http://www.questionpro.com/a/questionpro.cx.exportDetractorData?apiKey={API-KEY}
POST
https://www.questionpro.com/a/api/questionpro.cx.exportDetractorData?apiKey=4dbedabb-631f-4d68-b40a-e5cd47d610ce
HTTP/1.1
Accept: application/json
{
"segmentID": 39273,
"status": 0
}
{
"response": {
"PendingCount": 6,
"data": [
{
"emailAddress": "[email protected]",
"phoneNumber": "+12066688987",
"rating": "2",
"comment": "The product packaging was not proper",
"ticketID": 1769,
"timestamp": "2018-04-03 05:47:15.0",
"timelimit": 72
}
],
"ExportDetractorDataStatus": "Successful detractor data exported."
},
"status": {
"method": "questionpro.cx.exportDetractorData",
"apiKey": "4dbedabb-631f-4d68-b40a-e5cd47d610ce",
"serverUTC": 1522769264099,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.cx.exportDetractorData"
}
}
http://www.questionpro.com/a/questionpro.cx.exportDetractorData?apiKey={API-KEY}
public JSONObject processTransactions() throws Exception {
String path = getAPIURL();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject requestJSON = getRequestJSON();
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 getRequestJSON() throws JSONException {
JSONObject requestJSON = new JSONObject();
requestJSON.put("segmentID", 1); // Valid Segment ID - IF not found contacts will
not be processed.
requestJSON.put("status", 0); // Shows the status of exported detractor data.
return requestJSON;
}
public String getAPIURL() {
return "
http://www.questionpro.com/a/questionpro.cx.exportDetractorData?apiKey={API-KEY}"
+ getAccessKey();
}
{
"response": {
"PendingCount": 1,
"data": [
{
"emailAddress": "[email protected]",
"phoneNumber": "",
"rating": "0",
"comment": "",
"ticketID": 1,
"timestamp": "2017-04-25 12:21:34.0",
"timelimit": 2
}
],
"ExportDetractorDataStatus": "Successful detractor data exported."
},
"status": {
"method": "questionpro.cx.exportDetractorData",
"apiKey": "04845f6f-01f0-40e1-b34c-27521f55f83b",
"serverUTC": 1494486930629,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.cx.exportDetractorData"
}
}
Method: questionpro.cx.getSurveyURL
This API call is used to retrieve survey URL.
Name | Value | Required |
apiKey | This is an encrypted alphanumeric string to authenticate your credentials. | ✔ |
surveyID | This is the survey ID for which survey url is to be generated. | ✔ |
firstName | This is the first name of the contact which will be imported and survey url will be generated. | ✕ |
lastName | This is the last name of the contact which will be imported and survey url will be generated. | ✕ |
mobile | This is the mobile number of the contact which will be imported and survey url will be generated. | ✕ |
segmentCode | This is segment code for which contact will be imported and survey url will be generated. | ✔ |
transactionDate | This is the date on which transaction was done (mm/dd/yyyy), for which survey url is to be generated. | ✕ |
This is email address of the contact which is to be imported, for which survey url will be generated. | ✔ |
NOTE:
*All the parameter names are Case Sensitive.
*One API call cannot exceed 500 contacts.
https://www.questionpro.com/a/api/questionpro.cx.getSurveyURL?apiKey={API-KEY}
POST
https://www.questionpro.com/a/api/questionpro.cx.getSurveyURL?apiKey=4dbedabb-631f-4d68-b40a-e5cd47d610ce
HTTP/1.1
Accept: application/json
{
"firstName": "John",
"lastName": "Johnson",
"surveyID": 6069695,
"mobile": "+12066688987",
"segmentCode": "SANFRAN",
"transactionDate": "11/30/2016",
"email": "[email protected]"
}
{
"response": {
"SurveyURL": "http://www.questionpro.com/t/ZlIsWZK7dYK4j"
},
"status": {
"method": "questionpro.cx.getSurveyURL",
"apiKey": "4dbedabb-631f-4d68-b40a-e5cd47d610ce",
"serverUTC": 1522770697813,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.cx.getSurveyURL"
}
}
http://www.questionpro.com/a/questionpro.cx.getSurveyURL?apiKey={API-KEY}
public JSONObject processTransactions() throws Exception {
String path = getAPIURL();
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(path);
JSONObject requestJSON = getRequestJSON();
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 getRequestJSON() throws JSONException {
JSONObject requestJSON = new JSONObject();
requestJSON.put("contacts", getTransactions());
return requestJSON;
}
public JSONArray getTransactions() throws JSONException{
JSONArray transactions = new JSONArray();
JSONObject transaction = new JSONObject();
transaction.put("surveyID", 8980);// Valid Survey ID - IF not found contacts will not be
processed.
transaction.put("firstName", "John");
transaction.put("lastName", "Johnson");
transaction.put("mobile","+12066688987");
transaction.put("segmentCode","SANFRAN"); // You need a valid segment code here.
transaction.put("transactionDate","11/30/2016");
transaction.put("email", "[email protected]");
transactions.put(transaction); // One API call cannot exceed 500
contacts.
return transactions;
}
public String getAPIURL() {
return " http://www.questionpro.com/a/questionpro.cx.getSurveyURL?apiKey={API-KEY}"
+ getAccessKey();
}
{
"response": {
"SurveyURL": "http://www.questionpro.com/t/ZlJnZL99YB"
},
"status": {
"method": "questionpro.cx.getsurveyurl",
"apiKey": "04845f6f-01f0-40e1-b34c-27521f55f83b",
"serverUTC": 1494496456446,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.cx.getsurveyurl"
}
}
Method: questionpro.cx.sendReminder
This API call is used to send reminder to the contacts who haven't responded to the survey.
Name | Value | Required |
apiKey | This is an encrypted alphanumeric string to authenticate your credentials. | ✔ |
surveyID | This is the survey id for which reminder is to be sent. | ✔ |
sendEmail | This is used to specify if reminder email is to be sent to the contact or not. | ✕ |
sendSMS | This is used to specify if reminder sms is to be sent to the imported contact or not. If true, then mobile no. needs to be specified. Note: To send sms, you need to have sufficient sms credit in your account. | ✕ |
firstName | This is the first name of the contact to which reminder is to be sent. | ✕ |
lastName | This is the last name of the contact to which reminder is to be sent. | ✕ |
mobile | This is the mobile number of the contact to which reminder is to be sent. | ✕ |
segmentCode | This is the segment code for which reminder is to be sent. | ✕ |
transactionDate | This is the date on which transaction was done (mm/dd/yyyy), for which transaction is to be sent. | ✕ |
This is email address to which reminder email is to be sent | ✔ | |
custom1 | This is the Custom1 variable of the contact to which reminder is to be sent. Note: Similary, we can have custom2,custom3,...custom20, except custom5, for importing Custom2,Custom3,...Custom20 variables. | ✕ |
invitationTemplateID | This is the id of the customized created Email template, if any. Note: The value for Default Email template is -1. | ✕ |
smsTemplateID | This is the id of the customized created SMS template, if any. Note: The value for Default sms template is -1. | ✕ |
NOTE:
*All the parameter names are Case Sensitive.
*One API call cannot exceed 500 contacts.
https://www.questionpro.com/a/api/questionpro.cx.sendReminderForEmail?apiKey={API-KEY}
POST
https://www.questionpro.com/a/api/questionpro.cx.sendReminderForEmail?apiKey=4dbedabb-631f-4d68-b40a-e5cd47d610ce
HTTP/1.1
Accept: application/json
{
"surveyID": 6069695,
"sendEmail": "true",
"sendSMS": "false",
"contact":
{
"firstName": "John",
"lastName": "Johnson",
"mobile": "+12066688987",
"segmentCode": "SANFRAN",
"transactionDate": "11/30/2016",
"email": "[email protected]",
"custom1" : "Custom variable 1"
},
"invitationTemplateID": 423382,
"smsTemplateID": 103
}
{
"response": {
"status": "Reminder sent successfully"
},
"status": {
"method": "questionpro.cx.sendReminderForEmail",
"apiKey": "4dbedabb-631f-4d68-b40a-e5cd47d610ce",
"serverUTC": 1522770697813,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.cx.sendReminderForEmail"
}
}
http://www.questionpro.com/a/questionpro.cx.sendReminderForEmail?apiKey={API-KEY}
{
"response": {
"SurveyURL": "http://www.questionpro.com/t/ZlJnZL99YB"
},
"status": {
"method": "questionpro.cx.getsurveyurl",
"apiKey": "04845f6f-01f0-40e1-b34c-27521f55f83b",
"serverUTC": 1494496456446,
"id": 200,
"message": "OK",
"url": "/a/api/questionpro.cx.getsurveyurl"
}
}