The Qrvey API Step-by-Step

Not sure where to start with the Qrvey API?  Here's a suggested workflow to get you going.  In this example, we'll start with a brand new API key and walk you step by step through the process of creating a survey, collecting responses and viewing the results. 

 

Step 1.

Create a new user for yourself using the Add User API.

curl -X POST -H "Content-Type: application/json" -H "x-api-key: <api-key>" -d '{
"email": "testuser@qrvey.com",
"password": "test",
"first_name": "Test",
"organization": "Qrvey",
"last_name": "API"
}' "<base URL>/user"

 

Step 2.

Create a new survey by using the following API calls:

- Create Quick Survey - creates a new survey for your user.

curl -X POST -H "Content-Type: application/json" -H "x-api-key: <api-key>" -d '{
"name": "New Survey from API",
"description": "This is the description for Survey via API"
}' "<Base URL>/user/LNez3by/survey"

 

- Update Quick Survey - add a question to your survey.

curl -X PUT -H "Content-Type: application/json" -H "x-api-key: <api-key>" -d '{
"name": "New Survey from API",
"description": "This is the description for survey created from API",
"questions": {
"data": [
{
"id": 1,
"time": 6,
"text": "Have you voted for a congressman or President in the past five years?",
"answers": [
{
"answer": "Yes"
},
{
"answer": "No"
}
],
"question": "main",
"type": "YES_NO"
}
]
},
"duration": {
"number": 1,
"period": "day"
},
"totalQuestions": 1,
"totalTime": 6
}' "<Base URL>/user/<userid>/survey/<surveyid>"

 

- Activate Survey - make your survey live so it can begin accepting responses. 

- Get Survey URL - retrieve the URL respondents will use to submit their answers. Alternatively, you can use our collect widgets to embed the survey right into your application. For an example of our collect widget, look here.

 

Step 3.

Once your survey has collected responses, the final step is to view them using this API:

- Get Survey Results - retrieves the results for a specified survey. You can also quickly display results using our results widgets. An example of using the results widget can be found here.

 

If you have any questions about using our API, please visit our developer forum or contact our support team.