If you’re a software developer and would like to integrate SurveyMill into your apps, this API is for you. If you have any questions, please get in touch.
If you’re a software developer and would like to integrate SurveyMill into your apps, this API is for you. If you have any questions, please get in touch.
Instead of uploading contacts via the website, this API allows you to send a survey to contacts one at a time, programmatically. At the moment you cannot have contacts uploaded via the website and trigger sending via the API. To use the API you will need to be able to send an HTTP POST request and set a custom header.
By default, we hide the API options to keep things simple for everyone. To turn on the API, follow these steps:
You can now choose whether you want a Survey to use web uploads or the API on a survey by survey basis. To start sending a survey via the API, follow the two steps below.
Construct a HTTP POST request in the following form. Values in braces should be replaced {with your own values}.
POST HTTPS://app.surveymill.co.uk/api/survey/{Survey ID}
Custom Header:
Name: ApiKey
Value: {Api Key}
Body:
Encoding: URL Form Encoded
Fields:
Name: {Contact Name}
Number: {UK Contact Number}
After inserting your own Survey ID, Api Key, Contact Name and Contact Number an example post request using cURL might look like this:
curl -X POST -H "ApiKey: live_8a6d4e6f721dae78a6d4e6f721dae7901ac7865" -d "Name=Joe%20Bloggs&Number=447700900461" "https://app.surveymill.co.uk/api/survey/2543"
The API will send back a HTTP response code and a JSON formatted body containing a description. This is in the following format:
{
"message": "Survey Not Started"
}
Everything is fine, we will send out the survey shortly.
The mobile number you sent us doesn’t look like a real number, double check it.
You missed step 1 of the “Switching a survey to use the API” above.
Sorry, we are UK only for the moment, get in touch with us if you need to send overseas.
You missed off, or have given the wrong name to, the custom ApiKey header in the Sending to the API section above.
The API key you sent us doesn’t match the one on your Account Page, double check it.
You haven’t got enough credit on your account to send this survey. Time to top-up.
The request is fine, but you don’t have permissions to send to this survey. Is your Survey ID correct?
We couldn’t find this survey. Is your Survey ID correct?
The request is fine, but you missed step 2 of the “Switching a survey to use the API” above.
You have already sent this survey to this recipient, we don’t support sending the survey multiple times.
Something went wrong on our end. Get in touch and let us know what you were trying.
Construct a HTTP GET request in the following form. Values in braces should be replaced {with your own values}.
GET https://app.surveymill.co.uk/api/response/{Survey ID}
Custom Header:
Name: ApiKey
Value: {Api Key}
After inserting your own Survey ID and Api Key an example GET request using cURL might look like this:
curl -X GET -H "ApiKey: live_8a6d4e6f721dae78a6d4e6f721dae7901ac7865" "HTTPS://app.surveymill.co.uk/api/response/174"
You can also filter results by providing a From Reply Date an example GET request using cURL might look like this
curl -X GET -H "ApiKey: live_8a6d4e6f721dae78a6d4e6f721dae7901ac7865" "https://app.surveymill.co.uk/api/response/174?fromDate=2000-03-31"
Date format must conform to ISO 8601 as shown below:
2000-03-31
Everything is fine.
You missed step 1 of the “Switching a survey to use the API” above.
You missed off, or have given the wrong name to, the custom ApiKey header in the Sending to the API section above.
The API key you sent us doesn’t match the one on your Account Page, double check it.