You can add answers to survey via API. This is commonly use with mobile application or web pages where survey form is build with own UI framework but answer must go to Surveypal survey.
Here is an example survey where we add answers later in this article: https://my.surveypal.com/form/preview?sid=1925235371&sh=SkuwZdu2wrZN5FbsHNts5ZJkeOm59Nlt79-PwU3wEOjYw_EDOoZ-fHm7_arVi3-3&showPreviewBar=true
Surveypal REST API using Basic Auth for authentication: Read here how to generate credentials
If your Surveypal organization is created before 31.08.2022 then you can use also API key for authentication.
Basic Authentication and API key allow access to all surveys which are made or shared to Surveypal account which created API key. This is why it's good to create a separated integration user account and share surveys to this user.
Create an answer
First you need to create an answer
You can add answer background information with meta parameter:
- Key is background information name what you can select freely but avoid special characters.
- Value is background information value.
- You can add these key-value pairs as many as you need.
Above request returns new answer information, for example:
You need to copy answerId value from this response and use it with next API request.
Add answers to survey questions
Above request adds these answers
- First page first question: value 6
- Second page first question: selects first and third options
- Third page first question: adds text "Cup of coffee"
Element identifier style is p0e0 where p is page index and e is element index. Index starts from zero.
Read how to find element identifier.