Create a placement.
curl --request POST \
--url https://api.topsort.com/public/v1/placement-service/placements \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"externalPlacementId": "<string>",
"name": "<string>",
"jsonTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"logo": {
"min": 1,
"max": 1
},
"title": {
"minLength": 127,
"maxLength": 127
},
"previewTemplate": {
"html": "<string>",
"css": "<string>"
}
}
'import requests
url = "https://api.topsort.com/public/v1/placement-service/placements"
payload = {
"externalPlacementId": "<string>",
"name": "<string>",
"jsonTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"logo": {
"min": 1,
"max": 1
},
"title": {
"minLength": 127,
"maxLength": 127
},
"previewTemplate": {
"html": "<string>",
"css": "<string>"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
externalPlacementId: '<string>',
name: '<string>',
jsonTemplateId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
logo: {min: 1, max: 1},
title: {minLength: 127, maxLength: 127},
previewTemplate: {html: '<string>', css: '<string>'}
})
};
fetch('https://api.topsort.com/public/v1/placement-service/placements', 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://api.topsort.com/public/v1/placement-service/placements",
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([
'externalPlacementId' => '<string>',
'name' => '<string>',
'jsonTemplateId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'logo' => [
'min' => 1,
'max' => 1
],
'title' => [
'minLength' => 127,
'maxLength' => 127
],
'previewTemplate' => [
'html' => '<string>',
'css' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.topsort.com/public/v1/placement-service/placements"
payload := strings.NewReader("{\n \"externalPlacementId\": \"<string>\",\n \"name\": \"<string>\",\n \"jsonTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"logo\": {\n \"min\": 1,\n \"max\": 1\n },\n \"title\": {\n \"minLength\": 127,\n \"maxLength\": 127\n },\n \"previewTemplate\": {\n \"html\": \"<string>\",\n \"css\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.topsort.com/public/v1/placement-service/placements")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"externalPlacementId\": \"<string>\",\n \"name\": \"<string>\",\n \"jsonTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"logo\": {\n \"min\": 1,\n \"max\": 1\n },\n \"title\": {\n \"minLength\": 127,\n \"maxLength\": 127\n },\n \"previewTemplate\": {\n \"html\": \"<string>\",\n \"css\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/public/v1/placement-service/placements")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"externalPlacementId\": \"<string>\",\n \"name\": \"<string>\",\n \"jsonTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"logo\": {\n \"min\": 1,\n \"max\": 1\n },\n \"title\": {\n \"minLength\": 127,\n \"maxLength\": 127\n },\n \"previewTemplate\": {\n \"html\": \"<string>\",\n \"css\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"placementId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"externalPlacementId": "<string>",
"name": "<string>",
"products": {
"min": 100,
"max": 100,
"assets": {
"min": 1,
"max": 1
}
},
"previewTemplate": {
"html": "<string>",
"css": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"logo": {
"min": 1,
"max": 1
},
"title": {
"minLength": 127,
"maxLength": 127
},
"jsonTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"jsonTemplate": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"marketplaceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"jsonSchema": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"adFormat": "banner",
"isArchived": false,
"previewScreenshot": "<string>",
"previewUrl": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Placement API
Create a placement.
Create a V2 placement for the marketplace. The external placement identifier matches slotId on public sponsored-brand campaigns.
POST
/
public
/
v1
/
placement-service
/
placements
Create a placement.
curl --request POST \
--url https://api.topsort.com/public/v1/placement-service/placements \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"externalPlacementId": "<string>",
"name": "<string>",
"jsonTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"logo": {
"min": 1,
"max": 1
},
"title": {
"minLength": 127,
"maxLength": 127
},
"previewTemplate": {
"html": "<string>",
"css": "<string>"
}
}
'import requests
url = "https://api.topsort.com/public/v1/placement-service/placements"
payload = {
"externalPlacementId": "<string>",
"name": "<string>",
"jsonTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"logo": {
"min": 1,
"max": 1
},
"title": {
"minLength": 127,
"maxLength": 127
},
"previewTemplate": {
"html": "<string>",
"css": "<string>"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
externalPlacementId: '<string>',
name: '<string>',
jsonTemplateId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
logo: {min: 1, max: 1},
title: {minLength: 127, maxLength: 127},
previewTemplate: {html: '<string>', css: '<string>'}
})
};
fetch('https://api.topsort.com/public/v1/placement-service/placements', 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://api.topsort.com/public/v1/placement-service/placements",
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([
'externalPlacementId' => '<string>',
'name' => '<string>',
'jsonTemplateId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'logo' => [
'min' => 1,
'max' => 1
],
'title' => [
'minLength' => 127,
'maxLength' => 127
],
'previewTemplate' => [
'html' => '<string>',
'css' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.topsort.com/public/v1/placement-service/placements"
payload := strings.NewReader("{\n \"externalPlacementId\": \"<string>\",\n \"name\": \"<string>\",\n \"jsonTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"logo\": {\n \"min\": 1,\n \"max\": 1\n },\n \"title\": {\n \"minLength\": 127,\n \"maxLength\": 127\n },\n \"previewTemplate\": {\n \"html\": \"<string>\",\n \"css\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.topsort.com/public/v1/placement-service/placements")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"externalPlacementId\": \"<string>\",\n \"name\": \"<string>\",\n \"jsonTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"logo\": {\n \"min\": 1,\n \"max\": 1\n },\n \"title\": {\n \"minLength\": 127,\n \"maxLength\": 127\n },\n \"previewTemplate\": {\n \"html\": \"<string>\",\n \"css\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/public/v1/placement-service/placements")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"externalPlacementId\": \"<string>\",\n \"name\": \"<string>\",\n \"jsonTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"logo\": {\n \"min\": 1,\n \"max\": 1\n },\n \"title\": {\n \"minLength\": 127,\n \"maxLength\": 127\n },\n \"previewTemplate\": {\n \"html\": \"<string>\",\n \"css\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"placementId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"externalPlacementId": "<string>",
"name": "<string>",
"products": {
"min": 100,
"max": 100,
"assets": {
"min": 1,
"max": 1
}
},
"previewTemplate": {
"html": "<string>",
"css": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"logo": {
"min": 1,
"max": 1
},
"title": {
"minLength": 127,
"maxLength": 127
},
"jsonTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"jsonTemplate": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"marketplaceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"jsonSchema": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"adFormat": "banner",
"isArchived": false,
"previewScreenshot": "<string>",
"previewUrl": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Autorisierungen
Body
application/json
Placement configuration to create.
Antwort
Successful Response
War diese Seite hilfreich?