Create Display
curl --request POST \
--url https://{baseurl}/api/v1/client/{workspaceId}/displays \
--header 'Content-Type: application/json' \
--data '
{
"creativeId": "{{creativeId}} (optional)",
"surveyId": "{{surveyId}}",
"userId": "{{userId}} (optional)"
}
'import requests
url = "https://{baseurl}/api/v1/client/{workspaceId}/displays"
payload = {
"creativeId": "{{creativeId}} (optional)",
"surveyId": "{{surveyId}}",
"userId": "{{userId}} (optional)"
}
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({
creativeId: '{{creativeId}} (optional)',
surveyId: '{{surveyId}}',
userId: '{{userId}} (optional)'
})
};
fetch('https://{baseurl}/api/v1/client/{workspaceId}/displays', 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}/displays",
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([
'creativeId' => '{{creativeId}} (optional)',
'surveyId' => '{{surveyId}}',
'userId' => '{{userId}} (optional)'
]),
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}/displays"
payload := strings.NewReader("{\n \"creativeId\": \"{{creativeId}} (optional)\",\n \"surveyId\": \"{{surveyId}}\",\n \"userId\": \"{{userId}} (optional)\"\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}/displays")
.header("Content-Type", "application/json")
.body("{\n \"creativeId\": \"{{creativeId}} (optional)\",\n \"surveyId\": \"{{surveyId}}\",\n \"userId\": \"{{userId}} (optional)\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{baseurl}/api/v1/client/{workspaceId}/displays")
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 \"creativeId\": \"{{creativeId}} (optional)\",\n \"surveyId\": \"{{surveyId}}\",\n \"userId\": \"{{userId}} (optional)\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "clvc1z8200006494jgnds7ort"
}
}{
"code": "internal_server_error",
"details": {},
"message": "\nInvalid `prisma.display.create()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. No 'Survey' record(s) (needed to inline the relation on 'Display' record(s)) was found for a nested connect on one-to-many relation 'DisplayToSurvey'."
}Client API - Display
Create Display
Create a new display for a valid survey ID. If a userId is passed, the display is linked to the user. If a creativeId is passed, the display records the creative that opened the survey, but only when that creative is in the workspace and opens this survey; otherwise it is ignored. Note - Environments are deprecated. Use Workspace/workspaceId terminology.
POST
/
api
/
v1
/
client
/
{workspaceId}
/
displays
Create Display
curl --request POST \
--url https://{baseurl}/api/v1/client/{workspaceId}/displays \
--header 'Content-Type: application/json' \
--data '
{
"creativeId": "{{creativeId}} (optional)",
"surveyId": "{{surveyId}}",
"userId": "{{userId}} (optional)"
}
'import requests
url = "https://{baseurl}/api/v1/client/{workspaceId}/displays"
payload = {
"creativeId": "{{creativeId}} (optional)",
"surveyId": "{{surveyId}}",
"userId": "{{userId}} (optional)"
}
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({
creativeId: '{{creativeId}} (optional)',
surveyId: '{{surveyId}}',
userId: '{{userId}} (optional)'
})
};
fetch('https://{baseurl}/api/v1/client/{workspaceId}/displays', 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}/displays",
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([
'creativeId' => '{{creativeId}} (optional)',
'surveyId' => '{{surveyId}}',
'userId' => '{{userId}} (optional)'
]),
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}/displays"
payload := strings.NewReader("{\n \"creativeId\": \"{{creativeId}} (optional)\",\n \"surveyId\": \"{{surveyId}}\",\n \"userId\": \"{{userId}} (optional)\"\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}/displays")
.header("Content-Type", "application/json")
.body("{\n \"creativeId\": \"{{creativeId}} (optional)\",\n \"surveyId\": \"{{surveyId}}\",\n \"userId\": \"{{userId}} (optional)\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{baseurl}/api/v1/client/{workspaceId}/displays")
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 \"creativeId\": \"{{creativeId}} (optional)\",\n \"surveyId\": \"{{surveyId}}\",\n \"userId\": \"{{userId}} (optional)\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "clvc1z8200006494jgnds7ort"
}
}{
"code": "internal_server_error",
"details": {},
"message": "\nInvalid `prisma.display.create()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. No 'Survey' record(s) (needed to inline the relation on 'Display' record(s)) was found for a nested connect on one-to-many relation 'DisplayToSurvey'."
}Was this page helpful?