API v1 » v2 Migration guide

The following guide will help you migrate from QuestionPro surveys API V1 to API V2.


Migration Checklist
  1. Figure out which v1 endpoints your app uses, and look up the equivalent ones in API v2 using our v1 » v2 mapping table.
  2. Update your app’s code, replacing API v1 calls with API v2 calls.
  3. Update the error handling in your app to utilize v2 errors.

API Endpoints: v1 » v2 Mapping

The following is the mapping of how v1 functionality maps to v2. All v1 endpoints are listed in the left column, and the equivalent v2 endpoints are in the right column. Not all v2 endpoints are listed here.

Responses

In API V1 we had a different endpoint to get the response counts for a survey but in API V2 we can get the response count in the Get Survey API call. Also, in API V2 we have added the pagination schema for responses which helps the developers while dealing with the large number of responses.

V1 V2
Get Total Response Count
https://api.questionpro.com/a/api/questionpro.survey.responseCount
/surveys/{{survey-id}}
Get Survey Responses
https://api.questionpro.com/a/api/questionpro.survey.surveyResponses
/surveys/{{survey-id}}/responses
Get Specific Responses
https://api.questionpro.com/a/api/questionpro.survey.surveyResponse
/surveys/{{survey-id}}/responses/{{response-id}}
Delete a Specific Response
https://api.questionpro.com/a/api/questionpro.survey.deleteResponse
/surveys/{{survey-id}}/responses/{{response-id}}

Surveys

In API V1, we didn't have the capability to create or update a survey but in API V2 we have added two new endpoints to create and update the survey.

V1 V2
Get All Surveys
https://api.questionpro.com/a/api/questionpro.survey.getAllSurveys
/users/{{user-id}}/surveys
Get Survey
https://api.questionpro.com/a/api/questionpro.survey.getSurvey
/surveys/{{survey-id}}
Delete Survey
https://api.questionpro.com/a/api/questionpro.survey.deleteSurvey
/users/{{user-id}}/surveys/{{survey-id}}

Send Survey

In API V1, we had a single API endpoint for fetching the email lists and the email templates but in API V2 we have seperate endpoints for the email lists and the email templates which simplies the process. Also, in API V2 we have added a new endpoint to send a batch along with an email filter.

V1 V2
Get Send Survey Metadata
https://api.questionpro.com/a/api/questionpro.survey.sendSurveyMetaData
Get Email Lists: /surveys/{{survey-id}}/emaillists
Get Email Templates: /surveys/{{survey-id}}/templates
Send Survey
https://api.questionpro.com/a/api/questionpro.survey.sendSurvey
/surveys/{{survey-id}}/batches
Get Survey Invite History
https://api.questionpro.com/a/api/questionpro.survey.emailBatchStatistics
/surveys/{{survey-id}}/batches

Email List

In API V1, we didn't have the capability of updating an existing email list but in API V2 we have addedd a new endpoint to update an existing email list.

V1 V2
Create Email List
https://api.questionpro.com/a/api/questionpro.survey.createEmailGroup
/surveys/{{survey-id}}/emaillists
Get All Email Lists
https://api.questionpro.com/a/api/questionpro.survey.getEmailLists
/surveys/{{survey-id}}/emaillists
Get Specific Email List
http://api.questionpro.com/a/api/questionpro.survey.getEmailList
/surveys/{{survey-id}}/emaillists/{{email-list-id}}
Delete Specific Email List
http://api.questionpro.com/a/api/questionpro.survey.deleteEmailList
/{{survey-id}}/emaillists/{{email-list-id}}

Email Templates

In API V1, we didn't have the capability to create and update an email template but in API V2 we have added two new endpoints to create and update an email template.

V1 V2
Get All Email Templates
https://api.questionpro.com/a/api/questionpro.survey.getEmailTemplates
/surveys/{{survey-id}}/templates
Get Email Template
https://api.questionpro.com/a/api/questionpro.survey.getEmailTemplate
/surveys/{{survey-id}}/templates/{{template-id}}
Delete Email Template
https://api.questionpro.com/a/api/questionpro.survey.deleteEmailTemplate
/surveys/{{survey-id}}/templates/{{template-id}}

Email Addresses

In API V1, we didn't have the capability to create, update or delete an email address but in API V2 we have addedd three new endpoints to create, update and delete an email address.

V1 V2
Get Unsubscribed Email List
http://api.questionpro.com/a/api/questionpro.survey.getUnsubscribedEmailAddresses
/surveys/{{survey-id}}/emaillists/{{email-list-id}}

User Accounts

In API V2, we have added new endpoints to create, update and delete a user in the organization.

V1 V2
Get All Accounts
https://api.questionpro.com/a/api/questionpro.survey.getAllAccounts
/organizations/{{organization-id}}/users
Get Specific Account
https://api.questionpro.com/a/api/questionpro.survey.getAccount
/users/{{user-id}}