Upload responses (JSON array)
POST
/v2/projects/{projectId}/questions/{questionId}/upload/json
const url = 'https://api.surveycoder.io/v2/projects/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/questions/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/upload/json';const options = { method: 'POST', headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'}, body: '{"responses":[{"id":"example","text":"example"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.surveycoder.io/v2/projects/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/questions/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/upload/json \ --header 'Content-Type: application/json' \ --header 'x-api-key: <x-api-key>' \ --data '{ "responses": [ { "id": "example", "text": "example" } ] }'Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ” projectId
required
string format: uuid
questionId
required
string format: uuid
Request Body required
Section titled “Request Body required ” Media type application/json
object
responses
required
Array<object>
object
id
required
string
text
required
string
Example generated
{ "responses": [ { "id": "example", "text": "example" } ]}Responses
Section titled “ Responses ”Responses uploaded
Request body failed validation.
Media type application/json
Standard error envelope.
object
success
required
boolean
error
required
object
code
required
Machine-readable error code. See the error reference for the full list.
string
message
required
Human-readable explanation of what went wrong.
string
request_id
Echo of the X-Request-Id header, when provided.
string format: uuid
doc_url
Link to documentation for this specific error code.
string format: uri
Example
{ "success": false, "error": { "code": "VALIDATION_ERROR", "message": "responses array is required and must not be empty", "doc_url": "https://docs.surveycoder.io/errors/validation-error" }}