Skip to main content
POST
/
api
/
v1
/
client
/
{workspaceId}
/
responses
Create Response
curl --request POST \
  --url https://{baseurl}/api/v1/client/{workspaceId}/responses \
  --header 'Content-Type: application/json' \
  --data '
{
  "data": {
    "hs8yd14l9h8u353tjmv6rzaw": "clicked",
    "tcgls0063n8ri7dtrbnepcmz": "Who? Who? Who?"
  },
  "finished": false,
  "meta": {
    "action": "test action",
    "source": "Postman API",
    "url": "https://postman.com"
  },
  "surveyId": "{{surveyId}}",
  "userId": "{{userId}}"
}
'
import requests

url = "https://{baseurl}/api/v1/client/{workspaceId}/responses"

payload = {
"data": {
"hs8yd14l9h8u353tjmv6rzaw": "clicked",
"tcgls0063n8ri7dtrbnepcmz": "Who? Who? Who?"
},
"finished": False,
"meta": {
"action": "test action",
"source": "Postman API",
"url": "https://postman.com"
},
"surveyId": "{{surveyId}}",
"userId": "{{userId}}"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
hs8yd14l9h8u353tjmv6rzaw: 'clicked',
tcgls0063n8ri7dtrbnepcmz: 'Who? Who? Who?'
},
finished: false,
meta: {action: 'test action', source: 'Postman API', url: 'https://postman.com'},
surveyId: '{{surveyId}}',
userId: '{{userId}}'
})
};

fetch('https://{baseurl}/api/v1/client/{workspaceId}/responses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://{baseurl}/api/v1/client/{workspaceId}/responses",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'hs8yd14l9h8u353tjmv6rzaw' => 'clicked',
'tcgls0063n8ri7dtrbnepcmz' => 'Who? Who? Who?'
],
'finished' => false,
'meta' => [
'action' => 'test action',
'source' => 'Postman API',
'url' => 'https://postman.com'
],
'surveyId' => '{{surveyId}}',
'userId' => '{{userId}}'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://{baseurl}/api/v1/client/{workspaceId}/responses"

payload := strings.NewReader("{\n \"data\": {\n \"hs8yd14l9h8u353tjmv6rzaw\": \"clicked\",\n \"tcgls0063n8ri7dtrbnepcmz\": \"Who? Who? Who?\"\n },\n \"finished\": false,\n \"meta\": {\n \"action\": \"test action\",\n \"source\": \"Postman API\",\n \"url\": \"https://postman.com\"\n },\n \"surveyId\": \"{{surveyId}}\",\n \"userId\": \"{{userId}}\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://{baseurl}/api/v1/client/{workspaceId}/responses")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"hs8yd14l9h8u353tjmv6rzaw\": \"clicked\",\n \"tcgls0063n8ri7dtrbnepcmz\": \"Who? Who? Who?\"\n },\n \"finished\": false,\n \"meta\": {\n \"action\": \"test action\",\n \"source\": \"Postman API\",\n \"url\": \"https://postman.com\"\n },\n \"surveyId\": \"{{surveyId}}\",\n \"userId\": \"{{userId}}\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{baseurl}/api/v1/client/{workspaceId}/responses")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"hs8yd14l9h8u353tjmv6rzaw\": \"clicked\",\n \"tcgls0063n8ri7dtrbnepcmz\": \"Who? Who? Who?\"\n },\n \"finished\": false,\n \"meta\": {\n \"action\": \"test action\",\n \"source\": \"Postman API\",\n \"url\": \"https://postman.com\"\n },\n \"surveyId\": \"{{surveyId}}\",\n \"userId\": \"{{userId}}\"\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "id": "clvc3aool000p494jzjuukfzu"
  }
}
{
"code": "bad_request",
"details": {
"surveyId": "Invalid cuid2"
},
"message": "Fields are missing or incorrectly formatted"
}
{
"code": "not_found",
"details": {
"resource_id": "hs8yd14l9h8u353tjmv6rzaw",
"resource_type": "Survey"
},
"message": "Survey not found"
}

Path Parameters

workspaceId
string
required

Body

application/json
surveyId
string
required
data
object
finished
boolean
language
enum<string>

Language of the response (survey should have this language enabled)

Available options:
en,
de,
pt,
etc..
meta
object
userId
string

Response

OK

The response is of type object.