Skip to main content
POST
/
api
/
v1
/
management
/
responses
Create Response
curl --request POST \
  --url 'http://{{baseurl}}/api/v1/management/responses' \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <x-api-key>' \
  --data '
{
  "createdAt": "2024-09-05T08:44:16.051Z",
  "data": {
    "hg508afs7lgx8nlni5dtit5u": [
      "Hello World"
    ]
  },
  "finished": false,
  "language": "default",
  "surveyId": "clwj7hi7r0000vfhpfze6vjdg",
  "updatedAt": "2024-09-05T08:44:16.051Z"
}
'
import requests

url = "http://{{baseurl}}/api/v1/management/responses"

payload = {
"createdAt": "2024-09-05T08:44:16.051Z",
"data": { "hg508afs7lgx8nlni5dtit5u": ["Hello World"] },
"finished": False,
"language": "default",
"surveyId": "clwj7hi7r0000vfhpfze6vjdg",
"updatedAt": "2024-09-05T08:44:16.051Z"
}
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
createdAt: '2024-09-05T08:44:16.051Z',
data: {hg508afs7lgx8nlni5dtit5u: ['Hello World']},
finished: false,
language: 'default',
surveyId: 'clwj7hi7r0000vfhpfze6vjdg',
updatedAt: '2024-09-05T08:44:16.051Z'
})
};

fetch('http://{{baseurl}}/api/v1/management/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 => "http://{{baseurl}}/api/v1/management/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([
'createdAt' => '2024-09-05T08:44:16.051Z',
'data' => [
'hg508afs7lgx8nlni5dtit5u' => [
'Hello World'
]
],
'finished' => false,
'language' => 'default',
'surveyId' => 'clwj7hi7r0000vfhpfze6vjdg',
'updatedAt' => '2024-09-05T08:44:16.051Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);

$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 := "http://{{baseurl}}/api/v1/management/responses"

payload := strings.NewReader("{\n \"createdAt\": \"2024-09-05T08:44:16.051Z\",\n \"data\": {\n \"hg508afs7lgx8nlni5dtit5u\": [\n \"Hello World\"\n ]\n },\n \"finished\": false,\n \"language\": \"default\",\n \"surveyId\": \"clwj7hi7r0000vfhpfze6vjdg\",\n \"updatedAt\": \"2024-09-05T08:44:16.051Z\"\n}")

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

req.Header.Add("x-api-key", "<x-api-key>")
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("http://{{baseurl}}/api/v1/management/responses")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"createdAt\": \"2024-09-05T08:44:16.051Z\",\n \"data\": {\n \"hg508afs7lgx8nlni5dtit5u\": [\n \"Hello World\"\n ]\n },\n \"finished\": false,\n \"language\": \"default\",\n \"surveyId\": \"clwj7hi7r0000vfhpfze6vjdg\",\n \"updatedAt\": \"2024-09-05T08:44:16.051Z\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("http://{{baseurl}}/api/v1/management/responses")

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"createdAt\": \"2024-09-05T08:44:16.051Z\",\n \"data\": {\n \"hg508afs7lgx8nlni5dtit5u\": [\n \"Hello World\"\n ]\n },\n \"finished\": false,\n \"language\": \"default\",\n \"surveyId\": \"clwj7hi7r0000vfhpfze6vjdg\",\n \"updatedAt\": \"2024-09-05T08:44:16.051Z\"\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "createdAt": "2024-04-23T12:15:01.680Z",
    "data": {
      "hs8yd14l9h8u353tjmv6rzaw": "clicked",
      "hs8yd14l9h8u353tjmv6rzawqqq": "clicked",
      "tcgls0063n8ri7dtrbnepcmz": "Who? Who? Who?"
    },
    "finished": true,
    "id": "clvccml2p0009xz1zrlk1wbqb",
    "language": "en",
    "meta": {
      "action": "test action",
      "source": "Postman API",
      "url": "https://postman.com",
      "userAgent": {}
    },
    "notes": [],
    "person": {
      "attributes": {
        "Created From": "API",
        "created_from": "API"
      },
      "createdAt": "2024-04-23T07:39:22.696Z",
      "environmentId": "clurwouax000azffxt7n5unn3",
      "id": "clvc2s3ig000k494jltkqkm2u",
      "updatedAt": "2024-04-23T07:39:22.696Z",
      "userId": "THIS-IS-A-VVERY-LONG-USER-ID-FOR-TESTING"
    },
    "personAttributes": {
      "Created From": "API",
      "created_from": "API"
    },
    "singleUseId": null,
    "surveyId": "clus3omb00009oo10s53e2pa5",
    "tags": [],
    "ttc": {
      "_total": 310,
      "hs8yd14l9h8u353tjmv6rzawqqq": 120,
      "tcgls0063n8ri7dtrbnepcmz": 190
    },
    "updatedAt": "2024-04-23T12:16:39.774Z"
  }
}
{
"code": "unauthorized",
"details": {},
"message": "You are not authorized to access this resource"
}

Headers

x-api-key
string
required

Body

application/json

The body is of type object.

Response

OK

The response is of type object.