Passer au contenu principal
PATCH
/
public
/
v1
/
campaign-service
/
campaigns
/
sponsored-brand
/
{campaign-id}
Update a sponsored brand campaign.
curl --request PATCH \
  --url https://api.topsort.com/public/v1/campaign-service/campaigns/sponsored-brand/{campaign-id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Bola-Bola Ad campaign",
  "isActive": true,
  "schedule": [
    {
      "startDate": "2023-11-07T05:31:56Z",
      "endDate": "2023-11-07T05:31:56Z"
    }
  ],
  "sponsoredBrandRejectionReason": {
    "declineReason": "<string>",
    "reasonDetails": "<string>"
  },
  "targetRoas": 15.25,
  "bidType": "autobidding",
  "budget": {
    "amount": "<unknown>"
  },
  "isAutoTrigger": true
}
'
import requests

url = "https://api.topsort.com/public/v1/campaign-service/campaigns/sponsored-brand/{campaign-id}"

payload = {
"name": "Bola-Bola Ad campaign",
"isActive": True,
"schedule": [
{
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z"
}
],
"sponsoredBrandRejectionReason": {
"declineReason": "<string>",
"reasonDetails": "<string>"
},
"targetRoas": 15.25,
"bidType": "autobidding",
"budget": { "amount": "<unknown>" },
"isAutoTrigger": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Bola-Bola Ad campaign',
isActive: true,
schedule: [{startDate: '2023-11-07T05:31:56Z', endDate: '2023-11-07T05:31:56Z'}],
sponsoredBrandRejectionReason: {declineReason: '<string>', reasonDetails: '<string>'},
targetRoas: 15.25,
bidType: 'autobidding',
budget: {amount: '<unknown>'},
isAutoTrigger: true
})
};

fetch('https://api.topsort.com/public/v1/campaign-service/campaigns/sponsored-brand/{campaign-id}', 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/campaign-service/campaigns/sponsored-brand/{campaign-id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Bola-Bola Ad campaign',
'isActive' => true,
'schedule' => [
[
'startDate' => '2023-11-07T05:31:56Z',
'endDate' => '2023-11-07T05:31:56Z'
]
],
'sponsoredBrandRejectionReason' => [
'declineReason' => '<string>',
'reasonDetails' => '<string>'
],
'targetRoas' => 15.25,
'bidType' => 'autobidding',
'budget' => [
'amount' => '<unknown>'
],
'isAutoTrigger' => true
]),
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/campaign-service/campaigns/sponsored-brand/{campaign-id}"

payload := strings.NewReader("{\n \"name\": \"Bola-Bola Ad campaign\",\n \"isActive\": true,\n \"schedule\": [\n {\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"sponsoredBrandRejectionReason\": {\n \"declineReason\": \"<string>\",\n \"reasonDetails\": \"<string>\"\n },\n \"targetRoas\": 15.25,\n \"bidType\": \"autobidding\",\n \"budget\": {\n \"amount\": \"<unknown>\"\n },\n \"isAutoTrigger\": true\n}")

req, _ := http.NewRequest("PATCH", 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.patch("https://api.topsort.com/public/v1/campaign-service/campaigns/sponsored-brand/{campaign-id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Bola-Bola Ad campaign\",\n \"isActive\": true,\n \"schedule\": [\n {\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"sponsoredBrandRejectionReason\": {\n \"declineReason\": \"<string>\",\n \"reasonDetails\": \"<string>\"\n },\n \"targetRoas\": 15.25,\n \"bidType\": \"autobidding\",\n \"budget\": {\n \"amount\": \"<unknown>\"\n },\n \"isAutoTrigger\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.topsort.com/public/v1/campaign-service/campaigns/sponsored-brand/{campaign-id}")

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Bola-Bola Ad campaign\",\n \"isActive\": true,\n \"schedule\": [\n {\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"sponsoredBrandRejectionReason\": {\n \"declineReason\": \"<string>\",\n \"reasonDetails\": \"<string>\"\n },\n \"targetRoas\": 15.25,\n \"bidType\": \"autobidding\",\n \"budget\": {\n \"amount\": \"<unknown>\"\n },\n \"isAutoTrigger\": true\n}"

response = http.request(request)
puts response.read_body
{
  "campaignId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "marketplaceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "vendorId": "<string>",
  "name": "<string>",
  "isActive": true,
  "isAutoTrigger": true,
  "slotId": "<string>",
  "schedule": [
    {
      "startDate": "2023-11-07T05:31:56Z",
      "endDate": "2023-11-07T05:31:56Z"
    }
  ],
  "content": {},
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "isAgency": true,
  "budget": {
    "amount": 123,
    "amountRemaining": 123,
    "amountCarryover": 123,
    "amountUsed": 123
  },
  "externalCampaignId": "<string>",
  "walletId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "targetRoas": 15.25
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Autorisations

Authorization
string
header
requis

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.

Paramètres de chemin

campaign-id
string<uuid>
requis

The ID of the campaign.

Paramètres de requête

vendor_id
string
requis

The ID of the vendor.

Minimum string length: 1

Corps

application/json

Request body for updating a public sponsored brand campaign.

name
string | null

The name of the campaign.

Minimum string length: 1
Exemple:

"Bola-Bola Ad campaign"

isActive
boolean | null

Whether the campaign should be activated.

schedule
Schedule · object[] | null

The schedule for the campaign.

Maximum array length: 1
status
enum<string> | null

The approval status of the sponsored brand campaign.

Options disponibles:
approved,
pending,
rejected
sponsoredBrandRejectionReason
PublicSponsoredBrandRejectionReason · object | null

The reason for rejecting the sponsored brand campaign.

targetRoas
number | null

Indicates the vendor's target return on ad spend.

Plage requise: 0.5 <= x <= 30
bidType
enum<string> | null

The bidding type of the campaign. It can only be set to autobidding.

Options disponibles:
autobidding
targetRoasPreference
enum<string> | null

Target ROAS preference label.

Options disponibles:
aggressive,
conservative,
moderate,
custom
budget
BudgetUpdate · object | null

The assigned budget for the campaign.

chargeType
enum<string> | null

How campaigns are charged.

Options disponibles:
CPM,
CPC,
CPA
isAutoTrigger
boolean | null

Whether the campaign is auto-triggered.

autobiddingObjective
enum<string> | null

The objective of the campaign.

Options disponibles:
impressions,
clicks,
conversions,
revenue

Réponse

Successful Response

A regular sponsored brand campaign returned by the public API.

campaignId
string<uuid>
requis

The ID of the campaign.

marketplaceId
string<uuid>
requis

The ID of the marketplace.

vendorId
string
requis

The external vendor ID.

name
string
requis

The name of the campaign.

Minimum string length: 1
Exemple:

"Bola-Bola Ad campaign"

isActive
boolean
requis

Whether the campaign is active.

status
enum<string>
requis

The approval status of the sponsored brand campaign.

Options disponibles:
approved,
pending,
rejected
isAutoTrigger
boolean
requis

Whether the campaign is auto-triggered.

slotId
string
requis

The external slot ID where the sponsored brand campaign is shown.

schedule
Schedule · object[]
requis

The schedule for the campaign.

Required array length: 1 element
content
Content · object
requis

Dynamic content validated against the slot's JSON template.

createdAt
string<date-time>
requis

When this campaign was created.

updatedAt
string<date-time>
requis

When this campaign was last updated.

bidType
enum<string>
requis

The bidding type of the campaign.

Options disponibles:
manual,
autobidding
isAgency
boolean
requis

Whether this campaign is promoted by an agency.

chargeType
enum<string>
requis

How campaigns are charged.

Options disponibles:
CPM,
CPC,
CPA
budget
Budget · object
requis

The assigned budget for the campaign.

externalCampaignId
string | null

The external ID of the campaign in the marketplace.

walletId
string<uuid> | null

The uuid of the wallet used with this campaign.

targetRoas
number | null

Indicates the vendor's target return on ad spend.

Plage requise: 0.5 <= x <= 30
targetRoasPreference
enum<string> | null

Target ROAS preference label.

Options disponibles:
aggressive,
conservative,
moderate,
custom
autobiddingObjective
enum<string> | null

The objective of the campaign.

Options disponibles:
impressions,
clicks,
conversions,
revenue