curl --request POST \
--url https://api.topsort.com/public/v1/campaign-service/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Bola-Bola Ad campaign",
"bids": [
{
"target": {
"id": "p_8983",
"type": "product"
},
"amount": "<unknown>",
"location": "Santiago",
"triggers": [],
"formatProperties": {
"bannerAssets": [
{
"dimensions": {
"width": 1920,
"height": 1080
},
"url": "<string>",
"contentType": "image/png",
"size": 123,
"assetId": "asset_01j713j64yfsvtj4bs3ccpy5ca",
"content": {},
"jsonTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"slotId": "<string>",
"adFormat": "banner",
"deviceType": "desktop"
}
}
],
"isActive": true,
"externalCampaignId": "<string>",
"isAutoTrigger": false,
"startDate": "2023-11-07T05:31:56Z",
"endDate": "9999-12-31T22:59:59.999999Z",
"targetRoas": 15.25,
"status": "approved",
"adFormat": "listing",
"budget": {
"amount": 1000,
"type": "daily"
},
"productIds": [
"<string>"
],
"mediaType": "video",
"walletId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"fallbackWalletId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"multiplierConfig": {
"isActive": true,
"multipliers": [
{
"type": "user_segment",
"segmentId": "<string>",
"multiplier": 0.5
}
]
},
"targetingFilters": {
"isActive": true,
"targetingFilters": [
{
"type": "user_segment",
"segmentId": "<string>"
}
]
},
"exclusionFilters": {
"isActive": true,
"exclusionFilters": [
{
"type": "user_segment",
"segmentId": "<string>"
}
]
}
}
'import requests
url = "https://api.topsort.com/public/v1/campaign-service/campaigns"
payload = {
"name": "Bola-Bola Ad campaign",
"bids": [
{
"target": {
"id": "p_8983",
"type": "product"
},
"amount": "<unknown>",
"location": "Santiago",
"triggers": [],
"formatProperties": {
"bannerAssets": [
{
"dimensions": {
"width": 1920,
"height": 1080
},
"url": "<string>",
"contentType": "image/png",
"size": 123,
"assetId": "asset_01j713j64yfsvtj4bs3ccpy5ca",
"content": {},
"jsonTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"slotId": "<string>",
"adFormat": "banner",
"deviceType": "desktop"
}
}
],
"isActive": True,
"externalCampaignId": "<string>",
"isAutoTrigger": False,
"startDate": "2023-11-07T05:31:56Z",
"endDate": "9999-12-31T22:59:59.999999Z",
"targetRoas": 15.25,
"status": "approved",
"adFormat": "listing",
"budget": {
"amount": 1000,
"type": "daily"
},
"productIds": ["<string>"],
"mediaType": "video",
"walletId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"fallbackWalletId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"multiplierConfig": {
"isActive": True,
"multipliers": [
{
"type": "user_segment",
"segmentId": "<string>",
"multiplier": 0.5
}
]
},
"targetingFilters": {
"isActive": True,
"targetingFilters": [
{
"type": "user_segment",
"segmentId": "<string>"
}
]
},
"exclusionFilters": {
"isActive": True,
"exclusionFilters": [
{
"type": "user_segment",
"segmentId": "<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({
name: 'Bola-Bola Ad campaign',
bids: [
{
target: {id: 'p_8983', type: 'product'},
amount: '<unknown>',
location: 'Santiago',
triggers: [],
formatProperties: {
bannerAssets: [
{
dimensions: {width: 1920, height: 1080},
url: '<string>',
contentType: 'image/png',
size: 123,
assetId: 'asset_01j713j64yfsvtj4bs3ccpy5ca',
content: {},
jsonTemplateId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
],
slotId: '<string>',
adFormat: 'banner',
deviceType: 'desktop'
}
}
],
isActive: true,
externalCampaignId: '<string>',
isAutoTrigger: false,
startDate: '2023-11-07T05:31:56Z',
endDate: '9999-12-31T22:59:59.999999Z',
targetRoas: 15.25,
status: 'approved',
adFormat: 'listing',
budget: {amount: 1000, type: 'daily'},
productIds: ['<string>'],
mediaType: 'video',
walletId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
fallbackWalletId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
multiplierConfig: {
isActive: true,
multipliers: [{type: 'user_segment', segmentId: '<string>', multiplier: 0.5}]
},
targetingFilters: {
isActive: true,
targetingFilters: [{type: 'user_segment', segmentId: '<string>'}]
},
exclusionFilters: {
isActive: true,
exclusionFilters: [{type: 'user_segment', segmentId: '<string>'}]
}
})
};
fetch('https://api.topsort.com/public/v1/campaign-service/campaigns', 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",
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([
'name' => 'Bola-Bola Ad campaign',
'bids' => [
[
'target' => [
'id' => 'p_8983',
'type' => 'product'
],
'amount' => '<unknown>',
'location' => 'Santiago',
'triggers' => [
],
'formatProperties' => [
'bannerAssets' => [
[
'dimensions' => [
'width' => 1920,
'height' => 1080
],
'url' => '<string>',
'contentType' => 'image/png',
'size' => 123,
'assetId' => 'asset_01j713j64yfsvtj4bs3ccpy5ca',
'content' => [
],
'jsonTemplateId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
],
'slotId' => '<string>',
'adFormat' => 'banner',
'deviceType' => 'desktop'
]
]
],
'isActive' => true,
'externalCampaignId' => '<string>',
'isAutoTrigger' => false,
'startDate' => '2023-11-07T05:31:56Z',
'endDate' => '9999-12-31T22:59:59.999999Z',
'targetRoas' => 15.25,
'status' => 'approved',
'adFormat' => 'listing',
'budget' => [
'amount' => 1000,
'type' => 'daily'
],
'productIds' => [
'<string>'
],
'mediaType' => 'video',
'walletId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'fallbackWalletId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'multiplierConfig' => [
'isActive' => true,
'multipliers' => [
[
'type' => 'user_segment',
'segmentId' => '<string>',
'multiplier' => 0.5
]
]
],
'targetingFilters' => [
'isActive' => true,
'targetingFilters' => [
[
'type' => 'user_segment',
'segmentId' => '<string>'
]
]
],
'exclusionFilters' => [
'isActive' => true,
'exclusionFilters' => [
[
'type' => 'user_segment',
'segmentId' => '<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/campaign-service/campaigns"
payload := strings.NewReader("{\n \"name\": \"Bola-Bola Ad campaign\",\n \"bids\": [\n {\n \"target\": {\n \"id\": \"p_8983\",\n \"type\": \"product\"\n },\n \"amount\": \"<unknown>\",\n \"location\": \"Santiago\",\n \"triggers\": [],\n \"formatProperties\": {\n \"bannerAssets\": [\n {\n \"dimensions\": {\n \"width\": 1920,\n \"height\": 1080\n },\n \"url\": \"<string>\",\n \"contentType\": \"image/png\",\n \"size\": 123,\n \"assetId\": \"asset_01j713j64yfsvtj4bs3ccpy5ca\",\n \"content\": {},\n \"jsonTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"slotId\": \"<string>\",\n \"adFormat\": \"banner\",\n \"deviceType\": \"desktop\"\n }\n }\n ],\n \"isActive\": true,\n \"externalCampaignId\": \"<string>\",\n \"isAutoTrigger\": false,\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"9999-12-31T22:59:59.999999Z\",\n \"targetRoas\": 15.25,\n \"status\": \"approved\",\n \"adFormat\": \"listing\",\n \"budget\": {\n \"amount\": 1000,\n \"type\": \"daily\"\n },\n \"productIds\": [\n \"<string>\"\n ],\n \"mediaType\": \"video\",\n \"walletId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"fallbackWalletId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"multiplierConfig\": {\n \"isActive\": true,\n \"multipliers\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\",\n \"multiplier\": 0.5\n }\n ]\n },\n \"targetingFilters\": {\n \"isActive\": true,\n \"targetingFilters\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\"\n }\n ]\n },\n \"exclusionFilters\": {\n \"isActive\": true,\n \"exclusionFilters\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\"\n }\n ]\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/campaign-service/campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Bola-Bola Ad campaign\",\n \"bids\": [\n {\n \"target\": {\n \"id\": \"p_8983\",\n \"type\": \"product\"\n },\n \"amount\": \"<unknown>\",\n \"location\": \"Santiago\",\n \"triggers\": [],\n \"formatProperties\": {\n \"bannerAssets\": [\n {\n \"dimensions\": {\n \"width\": 1920,\n \"height\": 1080\n },\n \"url\": \"<string>\",\n \"contentType\": \"image/png\",\n \"size\": 123,\n \"assetId\": \"asset_01j713j64yfsvtj4bs3ccpy5ca\",\n \"content\": {},\n \"jsonTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"slotId\": \"<string>\",\n \"adFormat\": \"banner\",\n \"deviceType\": \"desktop\"\n }\n }\n ],\n \"isActive\": true,\n \"externalCampaignId\": \"<string>\",\n \"isAutoTrigger\": false,\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"9999-12-31T22:59:59.999999Z\",\n \"targetRoas\": 15.25,\n \"status\": \"approved\",\n \"adFormat\": \"listing\",\n \"budget\": {\n \"amount\": 1000,\n \"type\": \"daily\"\n },\n \"productIds\": [\n \"<string>\"\n ],\n \"mediaType\": \"video\",\n \"walletId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"fallbackWalletId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"multiplierConfig\": {\n \"isActive\": true,\n \"multipliers\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\",\n \"multiplier\": 0.5\n }\n ]\n },\n \"targetingFilters\": {\n \"isActive\": true,\n \"targetingFilters\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\"\n }\n ]\n },\n \"exclusionFilters\": {\n \"isActive\": true,\n \"exclusionFilters\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/public/v1/campaign-service/campaigns")
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 \"name\": \"Bola-Bola Ad campaign\",\n \"bids\": [\n {\n \"target\": {\n \"id\": \"p_8983\",\n \"type\": \"product\"\n },\n \"amount\": \"<unknown>\",\n \"location\": \"Santiago\",\n \"triggers\": [],\n \"formatProperties\": {\n \"bannerAssets\": [\n {\n \"dimensions\": {\n \"width\": 1920,\n \"height\": 1080\n },\n \"url\": \"<string>\",\n \"contentType\": \"image/png\",\n \"size\": 123,\n \"assetId\": \"asset_01j713j64yfsvtj4bs3ccpy5ca\",\n \"content\": {},\n \"jsonTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"slotId\": \"<string>\",\n \"adFormat\": \"banner\",\n \"deviceType\": \"desktop\"\n }\n }\n ],\n \"isActive\": true,\n \"externalCampaignId\": \"<string>\",\n \"isAutoTrigger\": false,\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"9999-12-31T22:59:59.999999Z\",\n \"targetRoas\": 15.25,\n \"status\": \"approved\",\n \"adFormat\": \"listing\",\n \"budget\": {\n \"amount\": 1000,\n \"type\": \"daily\"\n },\n \"productIds\": [\n \"<string>\"\n ],\n \"mediaType\": \"video\",\n \"walletId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"fallbackWalletId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"multiplierConfig\": {\n \"isActive\": true,\n \"multipliers\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\",\n \"multiplier\": 0.5\n }\n ]\n },\n \"targetingFilters\": {\n \"isActive\": true,\n \"targetingFilters\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\"\n }\n ]\n },\n \"exclusionFilters\": {\n \"isActive\": true,\n \"exclusionFilters\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"campaignId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"marketplaceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Bola-Bola Ad campaign",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"isActive": true,
"isSmart": true,
"campaignType": "manual",
"status": "approved",
"createdAt": "2023-11-07T05:31:56Z",
"chargeType": "CPM",
"externalVendorId": "<string>",
"adFormat": "listing",
"isAutoTrigger": true,
"vendorId": "<string>",
"walletId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bidCount": 123,
"budget": {
"amount": 1000,
"amountRemaining": 123,
"amountCarryover": 123,
"amountUsed": 123,
"type": "daily"
},
"statusUpdatedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"campaignBehaviorData": "<string>",
"campaignBehaviorDataByDay": "<string>",
"exclusivityPrice": 123,
"targetRoas": 123,
"externalCampaignId": "<string>",
"autobiddingObjective": "impressions",
"mediaType": "video",
"fallbackWalletId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"multiplierConfig": {
"isActive": true,
"multipliers": [
{
"type": "user_segment",
"segmentId": "<string>",
"multiplier": 0.5
}
]
},
"targetingFilters": {
"isActive": true,
"targetingFilters": [
{
"type": "user_segment",
"segmentId": "<string>"
}
]
},
"exclusionFilters": {
"isActive": true,
"exclusionFilters": [
{
"type": "user_segment",
"segmentId": "<string>"
}
]
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Create Campaign
Creates a campaign with its associated budget and bids.
Supports all campaign types except exclusive campaigns.
curl --request POST \
--url https://api.topsort.com/public/v1/campaign-service/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Bola-Bola Ad campaign",
"bids": [
{
"target": {
"id": "p_8983",
"type": "product"
},
"amount": "<unknown>",
"location": "Santiago",
"triggers": [],
"formatProperties": {
"bannerAssets": [
{
"dimensions": {
"width": 1920,
"height": 1080
},
"url": "<string>",
"contentType": "image/png",
"size": 123,
"assetId": "asset_01j713j64yfsvtj4bs3ccpy5ca",
"content": {},
"jsonTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"slotId": "<string>",
"adFormat": "banner",
"deviceType": "desktop"
}
}
],
"isActive": true,
"externalCampaignId": "<string>",
"isAutoTrigger": false,
"startDate": "2023-11-07T05:31:56Z",
"endDate": "9999-12-31T22:59:59.999999Z",
"targetRoas": 15.25,
"status": "approved",
"adFormat": "listing",
"budget": {
"amount": 1000,
"type": "daily"
},
"productIds": [
"<string>"
],
"mediaType": "video",
"walletId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"fallbackWalletId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"multiplierConfig": {
"isActive": true,
"multipliers": [
{
"type": "user_segment",
"segmentId": "<string>",
"multiplier": 0.5
}
]
},
"targetingFilters": {
"isActive": true,
"targetingFilters": [
{
"type": "user_segment",
"segmentId": "<string>"
}
]
},
"exclusionFilters": {
"isActive": true,
"exclusionFilters": [
{
"type": "user_segment",
"segmentId": "<string>"
}
]
}
}
'import requests
url = "https://api.topsort.com/public/v1/campaign-service/campaigns"
payload = {
"name": "Bola-Bola Ad campaign",
"bids": [
{
"target": {
"id": "p_8983",
"type": "product"
},
"amount": "<unknown>",
"location": "Santiago",
"triggers": [],
"formatProperties": {
"bannerAssets": [
{
"dimensions": {
"width": 1920,
"height": 1080
},
"url": "<string>",
"contentType": "image/png",
"size": 123,
"assetId": "asset_01j713j64yfsvtj4bs3ccpy5ca",
"content": {},
"jsonTemplateId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"slotId": "<string>",
"adFormat": "banner",
"deviceType": "desktop"
}
}
],
"isActive": True,
"externalCampaignId": "<string>",
"isAutoTrigger": False,
"startDate": "2023-11-07T05:31:56Z",
"endDate": "9999-12-31T22:59:59.999999Z",
"targetRoas": 15.25,
"status": "approved",
"adFormat": "listing",
"budget": {
"amount": 1000,
"type": "daily"
},
"productIds": ["<string>"],
"mediaType": "video",
"walletId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"fallbackWalletId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"multiplierConfig": {
"isActive": True,
"multipliers": [
{
"type": "user_segment",
"segmentId": "<string>",
"multiplier": 0.5
}
]
},
"targetingFilters": {
"isActive": True,
"targetingFilters": [
{
"type": "user_segment",
"segmentId": "<string>"
}
]
},
"exclusionFilters": {
"isActive": True,
"exclusionFilters": [
{
"type": "user_segment",
"segmentId": "<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({
name: 'Bola-Bola Ad campaign',
bids: [
{
target: {id: 'p_8983', type: 'product'},
amount: '<unknown>',
location: 'Santiago',
triggers: [],
formatProperties: {
bannerAssets: [
{
dimensions: {width: 1920, height: 1080},
url: '<string>',
contentType: 'image/png',
size: 123,
assetId: 'asset_01j713j64yfsvtj4bs3ccpy5ca',
content: {},
jsonTemplateId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
],
slotId: '<string>',
adFormat: 'banner',
deviceType: 'desktop'
}
}
],
isActive: true,
externalCampaignId: '<string>',
isAutoTrigger: false,
startDate: '2023-11-07T05:31:56Z',
endDate: '9999-12-31T22:59:59.999999Z',
targetRoas: 15.25,
status: 'approved',
adFormat: 'listing',
budget: {amount: 1000, type: 'daily'},
productIds: ['<string>'],
mediaType: 'video',
walletId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
fallbackWalletId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
multiplierConfig: {
isActive: true,
multipliers: [{type: 'user_segment', segmentId: '<string>', multiplier: 0.5}]
},
targetingFilters: {
isActive: true,
targetingFilters: [{type: 'user_segment', segmentId: '<string>'}]
},
exclusionFilters: {
isActive: true,
exclusionFilters: [{type: 'user_segment', segmentId: '<string>'}]
}
})
};
fetch('https://api.topsort.com/public/v1/campaign-service/campaigns', 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",
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([
'name' => 'Bola-Bola Ad campaign',
'bids' => [
[
'target' => [
'id' => 'p_8983',
'type' => 'product'
],
'amount' => '<unknown>',
'location' => 'Santiago',
'triggers' => [
],
'formatProperties' => [
'bannerAssets' => [
[
'dimensions' => [
'width' => 1920,
'height' => 1080
],
'url' => '<string>',
'contentType' => 'image/png',
'size' => 123,
'assetId' => 'asset_01j713j64yfsvtj4bs3ccpy5ca',
'content' => [
],
'jsonTemplateId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
],
'slotId' => '<string>',
'adFormat' => 'banner',
'deviceType' => 'desktop'
]
]
],
'isActive' => true,
'externalCampaignId' => '<string>',
'isAutoTrigger' => false,
'startDate' => '2023-11-07T05:31:56Z',
'endDate' => '9999-12-31T22:59:59.999999Z',
'targetRoas' => 15.25,
'status' => 'approved',
'adFormat' => 'listing',
'budget' => [
'amount' => 1000,
'type' => 'daily'
],
'productIds' => [
'<string>'
],
'mediaType' => 'video',
'walletId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'fallbackWalletId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'multiplierConfig' => [
'isActive' => true,
'multipliers' => [
[
'type' => 'user_segment',
'segmentId' => '<string>',
'multiplier' => 0.5
]
]
],
'targetingFilters' => [
'isActive' => true,
'targetingFilters' => [
[
'type' => 'user_segment',
'segmentId' => '<string>'
]
]
],
'exclusionFilters' => [
'isActive' => true,
'exclusionFilters' => [
[
'type' => 'user_segment',
'segmentId' => '<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/campaign-service/campaigns"
payload := strings.NewReader("{\n \"name\": \"Bola-Bola Ad campaign\",\n \"bids\": [\n {\n \"target\": {\n \"id\": \"p_8983\",\n \"type\": \"product\"\n },\n \"amount\": \"<unknown>\",\n \"location\": \"Santiago\",\n \"triggers\": [],\n \"formatProperties\": {\n \"bannerAssets\": [\n {\n \"dimensions\": {\n \"width\": 1920,\n \"height\": 1080\n },\n \"url\": \"<string>\",\n \"contentType\": \"image/png\",\n \"size\": 123,\n \"assetId\": \"asset_01j713j64yfsvtj4bs3ccpy5ca\",\n \"content\": {},\n \"jsonTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"slotId\": \"<string>\",\n \"adFormat\": \"banner\",\n \"deviceType\": \"desktop\"\n }\n }\n ],\n \"isActive\": true,\n \"externalCampaignId\": \"<string>\",\n \"isAutoTrigger\": false,\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"9999-12-31T22:59:59.999999Z\",\n \"targetRoas\": 15.25,\n \"status\": \"approved\",\n \"adFormat\": \"listing\",\n \"budget\": {\n \"amount\": 1000,\n \"type\": \"daily\"\n },\n \"productIds\": [\n \"<string>\"\n ],\n \"mediaType\": \"video\",\n \"walletId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"fallbackWalletId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"multiplierConfig\": {\n \"isActive\": true,\n \"multipliers\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\",\n \"multiplier\": 0.5\n }\n ]\n },\n \"targetingFilters\": {\n \"isActive\": true,\n \"targetingFilters\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\"\n }\n ]\n },\n \"exclusionFilters\": {\n \"isActive\": true,\n \"exclusionFilters\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\"\n }\n ]\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/campaign-service/campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Bola-Bola Ad campaign\",\n \"bids\": [\n {\n \"target\": {\n \"id\": \"p_8983\",\n \"type\": \"product\"\n },\n \"amount\": \"<unknown>\",\n \"location\": \"Santiago\",\n \"triggers\": [],\n \"formatProperties\": {\n \"bannerAssets\": [\n {\n \"dimensions\": {\n \"width\": 1920,\n \"height\": 1080\n },\n \"url\": \"<string>\",\n \"contentType\": \"image/png\",\n \"size\": 123,\n \"assetId\": \"asset_01j713j64yfsvtj4bs3ccpy5ca\",\n \"content\": {},\n \"jsonTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"slotId\": \"<string>\",\n \"adFormat\": \"banner\",\n \"deviceType\": \"desktop\"\n }\n }\n ],\n \"isActive\": true,\n \"externalCampaignId\": \"<string>\",\n \"isAutoTrigger\": false,\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"9999-12-31T22:59:59.999999Z\",\n \"targetRoas\": 15.25,\n \"status\": \"approved\",\n \"adFormat\": \"listing\",\n \"budget\": {\n \"amount\": 1000,\n \"type\": \"daily\"\n },\n \"productIds\": [\n \"<string>\"\n ],\n \"mediaType\": \"video\",\n \"walletId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"fallbackWalletId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"multiplierConfig\": {\n \"isActive\": true,\n \"multipliers\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\",\n \"multiplier\": 0.5\n }\n ]\n },\n \"targetingFilters\": {\n \"isActive\": true,\n \"targetingFilters\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\"\n }\n ]\n },\n \"exclusionFilters\": {\n \"isActive\": true,\n \"exclusionFilters\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/public/v1/campaign-service/campaigns")
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 \"name\": \"Bola-Bola Ad campaign\",\n \"bids\": [\n {\n \"target\": {\n \"id\": \"p_8983\",\n \"type\": \"product\"\n },\n \"amount\": \"<unknown>\",\n \"location\": \"Santiago\",\n \"triggers\": [],\n \"formatProperties\": {\n \"bannerAssets\": [\n {\n \"dimensions\": {\n \"width\": 1920,\n \"height\": 1080\n },\n \"url\": \"<string>\",\n \"contentType\": \"image/png\",\n \"size\": 123,\n \"assetId\": \"asset_01j713j64yfsvtj4bs3ccpy5ca\",\n \"content\": {},\n \"jsonTemplateId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"slotId\": \"<string>\",\n \"adFormat\": \"banner\",\n \"deviceType\": \"desktop\"\n }\n }\n ],\n \"isActive\": true,\n \"externalCampaignId\": \"<string>\",\n \"isAutoTrigger\": false,\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"9999-12-31T22:59:59.999999Z\",\n \"targetRoas\": 15.25,\n \"status\": \"approved\",\n \"adFormat\": \"listing\",\n \"budget\": {\n \"amount\": 1000,\n \"type\": \"daily\"\n },\n \"productIds\": [\n \"<string>\"\n ],\n \"mediaType\": \"video\",\n \"walletId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"fallbackWalletId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"multiplierConfig\": {\n \"isActive\": true,\n \"multipliers\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\",\n \"multiplier\": 0.5\n }\n ]\n },\n \"targetingFilters\": {\n \"isActive\": true,\n \"targetingFilters\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\"\n }\n ]\n },\n \"exclusionFilters\": {\n \"isActive\": true,\n \"exclusionFilters\": [\n {\n \"type\": \"user_segment\",\n \"segmentId\": \"<string>\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"campaignId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"marketplaceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Bola-Bola Ad campaign",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"isActive": true,
"isSmart": true,
"campaignType": "manual",
"status": "approved",
"createdAt": "2023-11-07T05:31:56Z",
"chargeType": "CPM",
"externalVendorId": "<string>",
"adFormat": "listing",
"isAutoTrigger": true,
"vendorId": "<string>",
"walletId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bidCount": 123,
"budget": {
"amount": 1000,
"amountRemaining": 123,
"amountCarryover": 123,
"amountUsed": 123,
"type": "daily"
},
"statusUpdatedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"campaignBehaviorData": "<string>",
"campaignBehaviorDataByDay": "<string>",
"exclusivityPrice": 123,
"targetRoas": 123,
"externalCampaignId": "<string>",
"autobiddingObjective": "impressions",
"mediaType": "video",
"fallbackWalletId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"multiplierConfig": {
"isActive": true,
"multipliers": [
{
"type": "user_segment",
"segmentId": "<string>",
"multiplier": 0.5
}
]
},
"targetingFilters": {
"isActive": true,
"targetingFilters": [
{
"type": "user_segment",
"segmentId": "<string>"
}
]
},
"exclusionFilters": {
"isActive": true,
"exclusionFilters": [
{
"type": "user_segment",
"segmentId": "<string>"
}
]
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Autorizaciones
Cuerpo
The request body of campaign creation.
Date when to start the campaign, specified in RFC 3339, if not set that campaign will start immediately after the campaign creation. Must include the Timezone definition.If the start date is in the past, it will be set to the current date.
Date when to stop the campaign, specified in RFC 3339, if not set the campaign will never stop. This date must be greater than the start date and must be in the future. Must include the Timezone definition.
How campaigns are going to be charged, by click, by per mille impressions, or by action. ListingAd campaigns are charged per click by default. BannerAd campaigns are charged per mille impressions by default.CPA is only allowed for listing campaigns. CPA is supported for manual and autobidding campaigns with any budget type.
CPM, CPC, CPA Target ROAS preset (aggressive, moderate, conservative). When set, the numeric target ROAS is resolved from marketplace bidcalc configuration. When only target_roas is provided without this field, preference is stored as custom.
aggressive, conservative, moderate, custom Respuesta
Successful Response
The campaign model.
¿Esta página le ayudó?