curl --request POST \
--url https://api.hakumedia.ai/v2/campaigns/standard/{campaign_id}/catalog-ad-item-bulk-create \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"ad_items": [
{
"catalog_id": 46544,
"catalog_item_identifier": "764747",
"name": "SKU 44"
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
ad_items: [{catalog_id: 46544, catalog_item_identifier: '764747', name: 'SKU 44'}]
})
};
fetch('https://api.hakumedia.ai/v2/campaigns/standard/{campaign_id}/catalog-ad-item-bulk-create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.hakumedia.ai/v2/campaigns/standard/{campaign_id}/catalog-ad-item-bulk-create"
payload = { "ad_items": [
{
"catalog_id": 46544,
"catalog_item_identifier": "764747",
"name": "SKU 44"
}
] }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hakumedia.ai/v2/campaigns/standard/{campaign_id}/catalog-ad-item-bulk-create",
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([
'ad_items' => [
[
'catalog_id' => 46544,
'catalog_item_identifier' => '764747',
'name' => 'SKU 44'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"object": "error",
"type": "ad_item_validation_error",
"http_status": 400,
"message": "One or more ad items failed validation.",
"parameters": [
{
"index": 0,
"ad_item": {
"name": "SKU 84221824",
"catalog_id": 10000,
"catalog_item_identifier": "84221824"
},
"parameters": [
{
"field": "catalog_id",
"type": "required",
"message": "The field 'catalog_id' must be defined."
}
]
}
]
}{
"object": "standard_campaign_catalog_ad_item_bulk_create",
"url": "/v2/campaigns/standard/10616/catalog-ad-item-bulk-create",
"data": {
"created": [
{
"ad_item": {
"name": "Catalog Item with ID",
"catalog_id": 123456,
"catalog_item_identifier": "123456789",
"location": null,
"tracking_pixel": "https://example.com/",
"tracking_pixels": [
{
"id": 123,
"url": "<string>"
}
],
"metadata": [],
"object": "catalog_ad_item",
"self": "/v2/ad-items/catalog-item/14456",
"id": 14456,
"created_date": "2023-01-12 15:03:22",
"last_modified": "2023-01-19 10:59:22",
"deleted": false
},
"campaign_assignment": {
"object": "campaign_assignment",
"self": "/v2/campaign-assignments/8522",
"id": 8522,
"active": true,
"advertisement": {
"id": 518890709,
"type": "catalog_ad_item"
},
"campaign": {
"id": 10616,
"type": "standard_campaign"
},
"weight": 1,
"geo_target": 0,
"platform_target": null,
"data_key_target": null,
"user_db_user_target": null,
"impressions": "0",
"clicks": "0"
}
}
],
"failed": [
{
"error_message": "Catalog item identifier '84221824' is already in use in this campaign.",
"error_type": "catalog_item_duplicate",
"group_index": 0,
"ad_item_index": 0,
"ad_item": {
"name": "SKU 84221824",
"catalog_id": 10000,
"catalog_item_identifier": "84221824"
},
"campaign_assignment": {
"advertisement": {
"id": 518890714,
"type": "catalog_ad_item"
},
"campaign": {
"id": 10616,
"type": "standard_campaign"
}
}
}
]
}
}Bulk Create Catalog Ad Items
Bulk creates catalog ad items and assigns them to a campaign. Catalog item identifiers must be unique within the campaign. You may not add the same catalog item more than once. Under the created field in the response will be a list of the ad item and campaign assignment resources which were created. The structure is generally represented as ad item -> campaign assignment -> campaign. For Product DB configurations, most of the fields won’t be used, so the most notable fields are: ad_item.id - the unique id of the catalog ad item, ad_item.catalog_id - the catalog id for the product, ad_item.catalog_item_identifier - the identifier for a particular product, campaign_assignment.id - the unique id of the campaign assignment.
curl --request POST \
--url https://api.hakumedia.ai/v2/campaigns/standard/{campaign_id}/catalog-ad-item-bulk-create \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"ad_items": [
{
"catalog_id": 46544,
"catalog_item_identifier": "764747",
"name": "SKU 44"
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
ad_items: [{catalog_id: 46544, catalog_item_identifier: '764747', name: 'SKU 44'}]
})
};
fetch('https://api.hakumedia.ai/v2/campaigns/standard/{campaign_id}/catalog-ad-item-bulk-create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.hakumedia.ai/v2/campaigns/standard/{campaign_id}/catalog-ad-item-bulk-create"
payload = { "ad_items": [
{
"catalog_id": 46544,
"catalog_item_identifier": "764747",
"name": "SKU 44"
}
] }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hakumedia.ai/v2/campaigns/standard/{campaign_id}/catalog-ad-item-bulk-create",
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([
'ad_items' => [
[
'catalog_id' => 46544,
'catalog_item_identifier' => '764747',
'name' => 'SKU 44'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"object": "error",
"type": "ad_item_validation_error",
"http_status": 400,
"message": "One or more ad items failed validation.",
"parameters": [
{
"index": 0,
"ad_item": {
"name": "SKU 84221824",
"catalog_id": 10000,
"catalog_item_identifier": "84221824"
},
"parameters": [
{
"field": "catalog_id",
"type": "required",
"message": "The field 'catalog_id' must be defined."
}
]
}
]
}{
"object": "standard_campaign_catalog_ad_item_bulk_create",
"url": "/v2/campaigns/standard/10616/catalog-ad-item-bulk-create",
"data": {
"created": [
{
"ad_item": {
"name": "Catalog Item with ID",
"catalog_id": 123456,
"catalog_item_identifier": "123456789",
"location": null,
"tracking_pixel": "https://example.com/",
"tracking_pixels": [
{
"id": 123,
"url": "<string>"
}
],
"metadata": [],
"object": "catalog_ad_item",
"self": "/v2/ad-items/catalog-item/14456",
"id": 14456,
"created_date": "2023-01-12 15:03:22",
"last_modified": "2023-01-19 10:59:22",
"deleted": false
},
"campaign_assignment": {
"object": "campaign_assignment",
"self": "/v2/campaign-assignments/8522",
"id": 8522,
"active": true,
"advertisement": {
"id": 518890709,
"type": "catalog_ad_item"
},
"campaign": {
"id": 10616,
"type": "standard_campaign"
},
"weight": 1,
"geo_target": 0,
"platform_target": null,
"data_key_target": null,
"user_db_user_target": null,
"impressions": "0",
"clicks": "0"
}
}
],
"failed": [
{
"error_message": "Catalog item identifier '84221824' is already in use in this campaign.",
"error_type": "catalog_item_duplicate",
"group_index": 0,
"ad_item_index": 0,
"ad_item": {
"name": "SKU 84221824",
"catalog_id": 10000,
"catalog_item_identifier": "84221824"
},
"campaign_assignment": {
"advertisement": {
"id": 518890714,
"type": "catalog_ad_item"
},
"campaign": {
"id": 10616,
"type": "standard_campaign"
}
}
}
]
}
}Authorizations
API key en el header Authorization: Basic TU_API_KEY. La key va tal cual, sin codificar en base64. Las credenciales se entregan al comenzar la integración.
Path Parameters
Identifier of the Standard Campaign.
Body
A list of specific-purpose catalog ad item object payloads.
Show child attributes
Show child attributes