Surveypal API using Basic Auth for authentication. Basic Auth consists of user name and password and this combination is Base64 encoded. When you have generated this then just add it to your request header which name is Authorization.
Basic Auth user name
Basic Auth user name is your Surveypal user name, for example test.account@surveypal.com
Generate Basic Auth password
First you need API key. To create API key, select your name from the bottom left corner on the Surveypal front page. Then select 'Your account'. In the account page select: API keys
- Create your first token by clicking 'Create key'.
- Give your API key a name and click 'Create'.
When you have API key, you can generate Basic Auth password so that you combine text "token" and your API key. For example if API key is "AA_HvXX0A1Y1X11113ZV3v11cXX" then Basic Auth password is
token-AA_HvXX0A1Y1X11113ZV3v11cXX
Encode user name and password
You have to encode your user name and password to Base64 format.
Take your user name and password and combine these like this:
username:password
for example
test.account@surveypal.com:token-AA_HvXX0A1Y1X11113ZV3v11cXX
and encode this with Base64. You can use text editor like Notepad++ or some service like https://www.base64encode.org/
Above username and password Base64 encoded: dGVzdC5hY2NvdW50QHN1cnZleXBhbC5jb206dG9rZW4tQUFfSHZYWDBBMVkxWDExMTEzWlYzdjExY1hY
Add authorization header to your request
Now when you have encoded Basic Auth key, just add it to your request header like this
Authorization: Basic dGVzdC5hY2NvdW50QHN1cnZleXBhbC5jb206dG9rZW4tQUFfSHZYWDBBMVkxWDExMTEzWlYzdjExY1hY