Upsert Banner Fallback
curl --request PUT \
--url https://api.topsort.com/public/v1/media-service/slots/{slot_id}/fallback \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"width": 123,
"height": 123,
"destination": {
"destinationId": "<string>"
}
}
'import requests
url = "https://api.topsort.com/public/v1/media-service/slots/{slot_id}/fallback"
payload = {
"url": "<string>",
"width": 123,
"height": 123,
"destination": { "destinationId": "<string>" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: '<string>',
width: 123,
height: 123,
destination: {destinationId: '<string>'}
})
};
fetch('https://api.topsort.com/public/v1/media-service/slots/{slot_id}/fallback', 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/media-service/slots/{slot_id}/fallback",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'url' => '<string>',
'width' => 123,
'height' => 123,
'destination' => [
'destinationId' => '<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/media-service/slots/{slot_id}/fallback"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"width\": 123,\n \"height\": 123,\n \"destination\": {\n \"destinationId\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.topsort.com/public/v1/media-service/slots/{slot_id}/fallback")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"width\": 123,\n \"height\": 123,\n \"destination\": {\n \"destinationId\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/public/v1/media-service/slots/{slot_id}/fallback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"width\": 123,\n \"height\": 123,\n \"destination\": {\n \"destinationId\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"deviceType": "desktop",
"url": "<string>",
"width": 123,
"height": 123,
"contentType": "image/jpeg",
"destination": {
"destinationType": "product",
"destinationId": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Media API
Upsert Banner Fallback
Create or update a banner fallback for a given slot.
This replaces any fallback that already exists for the given device, including one created with a different fallback type. The updated fallback is exported to the auction engine on a five minute cycle with a five minute cache, so it can take up to about 10 minutes for a shopper to see the change. A successful response does not mean the storefront has updated yet.
PUT
/
public
/
v1
/
media-service
/
slots
/
{slot_id}
/
fallback
Upsert Banner Fallback
curl --request PUT \
--url https://api.topsort.com/public/v1/media-service/slots/{slot_id}/fallback \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"width": 123,
"height": 123,
"destination": {
"destinationId": "<string>"
}
}
'import requests
url = "https://api.topsort.com/public/v1/media-service/slots/{slot_id}/fallback"
payload = {
"url": "<string>",
"width": 123,
"height": 123,
"destination": { "destinationId": "<string>" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: '<string>',
width: 123,
height: 123,
destination: {destinationId: '<string>'}
})
};
fetch('https://api.topsort.com/public/v1/media-service/slots/{slot_id}/fallback', 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/media-service/slots/{slot_id}/fallback",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'url' => '<string>',
'width' => 123,
'height' => 123,
'destination' => [
'destinationId' => '<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/media-service/slots/{slot_id}/fallback"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"width\": 123,\n \"height\": 123,\n \"destination\": {\n \"destinationId\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.topsort.com/public/v1/media-service/slots/{slot_id}/fallback")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"width\": 123,\n \"height\": 123,\n \"destination\": {\n \"destinationId\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/public/v1/media-service/slots/{slot_id}/fallback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"width\": 123,\n \"height\": 123,\n \"destination\": {\n \"destinationId\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"deviceType": "desktop",
"url": "<string>",
"width": 123,
"height": 123,
"contentType": "image/jpeg",
"destination": {
"destinationType": "product",
"destinationId": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
A valid API key generated in Topsort's UI. Use the TSE API key if calling auctions or events API, otherwise use the TSC API key.
Path Parameters
The id of the slot.
Body
application/json
Available options:
desktop, mobile Required string length:
1 - 2083Available options:
image/jpeg, image/png, image/gif, image/webp, text/html, video/mp4, video/quicktime, application/json, text/vtt Show child attributes
Show child attributes
Response
Successful Response
Available options:
desktop, mobile Required string length:
1 - 2083Available options:
image/jpeg, image/png, image/gif, image/webp, text/html, video/mp4, video/quicktime, application/json, text/vtt Show child attributes
Show child attributes
Was this page helpful?