Create a New Response
POST {{baseUrl}}/surveys/:surveyId/responses
Import Response Format
The fields in
values
depend on the survey definition. The easiest way to find this format is to perform a get a single response call for the survey which you are trying import values for Retrieve a Survey Response. The result of that call will demonstrate the format for the Create a New Response Call.
Uploading Files for File Upload Questions
Files can be included in your import to be associated with file upload questions in your survey. Select
multipart/form-data
as the request type in the documentation below to see the full request format.
multipart/form-data
requests allow you to send multiple different entities as body parts in a single request. We can use this to create a request to upload a survey response with file attachments. A minimum of two body parts are required in addition to the files you wish to upload. 1.response
: This body part is the JSON representation of the survey response. As with the regularapplication/json
POST request for this endpoint, the minimum required object is{"values": {}}
. Note that you do not need to include any file metadata in the survey response as the necessary metadata will automatically be added to the response from the files that you upload with it. 1.fileMapping
: This body part is also a JSON object. Its purpose is to tell the importer which files go with which questions in your survey. E.g. if we wanted to import a file with the body part key offile1
and we wanted that file to be associated with the file upload questionQID1
, ourfileMapping
object would be{"file1": "QID1"}
. For the remainder of your request you can attach up to five files. Each file must have a body part key offile1
,file2
,file3
,file4
, orfile5
.
Request Body
[{"name"=>"response", "value"=>"[object Object]", "datatype"=>"string"}, {"name"=>"fileMapping", "value"=>"[object Object]", "datatype"=>"string"}, {"name"=>"file1", "value"=>"<string>", "datatype"=>"string"}, {"name"=>"file2", "value"=>"<string>", "datatype"=>"string"}, {"name"=>"file3", "value"=>"<string>", "datatype"=>"string"}, {"name"=>"file4", "value"=>"<string>", "datatype"=>"string"}, {"name"=>"file5", "value"=>"<string>", "datatype"=>"string"}]
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Idempotency-Key | string | In order to make a request to create a survey response idempotent, pass a UUID in this header. Repeated requests with the same Idempotency Key will not create duplicates. | |
Content-Type | string | ||
Accept | string |
RESPONSES
status: OK
{"result":{"responseId":"\u003cstring\u003e"},"meta":{"httpStatus":"\u003cstring\u003e","requestId":"\u003cstring\u003e","notice":"\u003cstring\u003e"}}