curl --request POST \
--url https://api.hakumedia.ai/v2/campaign-assignments \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"advertisement": {
"id": 92213512,
"type": "image_ad_item"
},
"campaign": {
"id": 442135,
"type": "standard_campaign"
}
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
advertisement: {id: 92213512, type: 'image_ad_item'},
campaign: {id: 442135, type: 'standard_campaign'}
})
};
fetch('https://api.hakumedia.ai/v2/campaign-assignments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.hakumedia.ai/v2/campaign-assignments"
payload = {
"advertisement": {
"id": 92213512,
"type": "image_ad_item"
},
"campaign": {
"id": 442135,
"type": "standard_campaign"
}
}
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/campaign-assignments",
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([
'advertisement' => [
'id' => 92213512,
'type' => 'image_ad_item'
],
'campaign' => [
'id' => 442135,
'type' => 'standard_campaign'
]
]),
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;
}{
"active": false,
"advertisement": {
"id": 92213512,
"type": "image_ad_item"
},
"campaign": {
"id": 442135,
"type": "standard_campaign"
},
"weight": 1,
"geo_target": 1234,
"platform_target": 10500,
"keywords": "example, keyword, list",
"keywords_match_method": "preferred",
"data_key_target": 10000,
"list_target": 12345,
"schedule": 10002,
"status": "active",
"object": "campaign_assignment",
"id": 8247,
"self": "/v2/campaign-assignments/8247"
}Create a Campaign Assignment
curl --request POST \
--url https://api.hakumedia.ai/v2/campaign-assignments \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"advertisement": {
"id": 92213512,
"type": "image_ad_item"
},
"campaign": {
"id": 442135,
"type": "standard_campaign"
}
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
advertisement: {id: 92213512, type: 'image_ad_item'},
campaign: {id: 442135, type: 'standard_campaign'}
})
};
fetch('https://api.hakumedia.ai/v2/campaign-assignments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.hakumedia.ai/v2/campaign-assignments"
payload = {
"advertisement": {
"id": 92213512,
"type": "image_ad_item"
},
"campaign": {
"id": 442135,
"type": "standard_campaign"
}
}
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/campaign-assignments",
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([
'advertisement' => [
'id' => 92213512,
'type' => 'image_ad_item'
],
'campaign' => [
'id' => 442135,
'type' => 'standard_campaign'
]
]),
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;
}{
"active": false,
"advertisement": {
"id": 92213512,
"type": "image_ad_item"
},
"campaign": {
"id": 442135,
"type": "standard_campaign"
},
"weight": 1,
"geo_target": 1234,
"platform_target": 10500,
"keywords": "example, keyword, list",
"keywords_match_method": "preferred",
"data_key_target": 10000,
"list_target": 12345,
"schedule": 10002,
"status": "active",
"object": "campaign_assignment",
"id": 8247,
"self": "/v2/campaign-assignments/8247"
}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.
Body
An object containing the ad item ID and type (image, custom HTML, rich media, or native).
NOTE: Subscribers on the Standard tier and below must have the Enhanced Ads add-on to create rich media ads and native ads.
Show child attributes
Show child attributes
An object containing the standard campaign identifier and type.
Show child attributes
Show child attributes
Whether or not the ad item is active in the campaign. If set to "false", the ad item will not be served, but the campaign will be active.
false
A number used to compute the probability of serving a particular ad. Defaults to 1.
1
The Geo Target identifier (ID).
NOTE: Can be set only if the campaign's targeting_source was set to "AD_ITEM". Otherwise, targeting can be configured only in Placements. In addition, geographic targeting is part of the Complete Targeting add-on. If you don't have the add-on, you must set this field's value to null.
1234
The Platform Target identifier (ID) if you intend to restrict delivery of your ads to a certain device or a platform. Defaults to null, which means platform targeting is not in effect.
NOTE: Can be set only if the campaign's targeting_source was set to "AD_ITEM". Otherwise, targeting can be configured only in Placements. In addition, your subscription must have the Targeting add-on to use this feature.
10500
Specify words separated by commas to determine if this ad should be served if a match is found on the page. You can use an asterisk ("*") to represent a wildcard in a keyword.
For example, "paint*" would match paint, painter, painting, paints, and all other variations.
You can also stop the ad from being served in presence of a specific word by prepending a negative sign (-) to the word. For example, "-paint" would stop the ad from being delivered if the word "paint" is found on the page.
NOTE: Can be set only if the campaign's targeting_source was set to "AD_ITEM". Otherwise, targeting can be configured only in Placements.
"example, keyword, list"
Defines the level of keyword targeting. Has three possible values: "required", "preferred" or "filtered".
Set this to "required" to serve the ad only if a keyword match is found. Set this to "preferred" to increase the serving priority of an ad whenever a match is found. Set this to "filtered" to require a keyword match for the ad to be served without affecting the serving priority.
NOTE: Can be set only if the campaign's targeting_source was set to "AD_ITEM". Otherwise, targeting can be configured only in Placements.
"preferred"
The Data Key Target identifier (ID).
NOTE: Can be set only if the campaign's targeting_source was set to "AD_ITEM". Otherwise, targeting can be configured only in Placements. In addition, only Enterprise subscribers have access to the Data Keys feature. If you don't have that feature enabled, you must set this field's value to null or 0.
10000
The List Target identifier (ID) if you want your ads to be delivered based on the inclusion or exclusion of specific values in their respective lists. Defaults to null which means list targeting is not in effect. NOTE: For campaigns, this can be set only if the campaign's targeting_source was set to "CAMPAIGN". Otherwise, targeting can be configured only in Campaign Assignments. In addition, you need to have List Targeting enabled in your account to use this feature. If you don't have that feature enabled, you must set this field's value to null.
12345
The identifier (ID) of the schedule that will be applied to the ad item.
NOTE: Can be set only if the campaign's scheduling_source was set to "AD_ITEM". Otherwise, scheduling can be configured only in Placements.
10002
Response
successful operation
Whether or not the ad item is active in the campaign. If set to "false", the ad item will not be served, but the campaign will be active.
false
An object containing the ad item ID and type (image, custom HTML, rich media, or native).
NOTE: Subscribers on the Standard tier and below must have the Enhanced Ads add-on to create rich media ads and native ads.
Show child attributes
Show child attributes
An object containing the standard campaign identifier and type.
Show child attributes
Show child attributes
A number used to compute the probability of serving a particular ad. Defaults to 1.
1
The Geo Target identifier (ID).
NOTE: Can be set only if the campaign's targeting_source was set to "AD_ITEM". Otherwise, targeting can be configured only in Placements. In addition, geographic targeting is part of the Complete Targeting add-on. If you don't have the add-on, you must set this field's value to null.
1234
The Platform Target identifier (ID) if you intend to restrict delivery of your ads to a certain device or a platform. Defaults to null, which means platform targeting is not in effect.
NOTE: Can be set only if the campaign's targeting_source was set to "AD_ITEM". Otherwise, targeting can be configured only in Placements. In addition, your subscription must have the Targeting add-on to use this feature.
10500
Specify words separated by commas to determine if this ad should be served if a match is found on the page. You can use an asterisk ("*") to represent a wildcard in a keyword.
For example, "paint*" would match paint, painter, painting, paints, and all other variations.
You can also stop the ad from being served in presence of a specific word by prepending a negative sign (-) to the word. For example, "-paint" would stop the ad from being delivered if the word "paint" is found on the page.
NOTE: Can be set only if the campaign's targeting_source was set to "AD_ITEM". Otherwise, targeting can be configured only in Placements.
"example, keyword, list"
Defines the level of keyword targeting. Has three possible values: "required", "preferred" or "filtered".
Set this to "required" to serve the ad only if a keyword match is found. Set this to "preferred" to increase the serving priority of an ad whenever a match is found. Set this to "filtered" to require a keyword match for the ad to be served without affecting the serving priority.
NOTE: Can be set only if the campaign's targeting_source was set to "AD_ITEM". Otherwise, targeting can be configured only in Placements.
"preferred"
The Data Key Target identifier (ID).
NOTE: Can be set only if the campaign's targeting_source was set to "AD_ITEM". Otherwise, targeting can be configured only in Placements. In addition, only Enterprise subscribers have access to the Data Keys feature. If you don't have that feature enabled, you must set this field's value to null or 0.
10000
The List Target identifier (ID) if you want your ads to be delivered based on the inclusion or exclusion of specific values in their respective lists. Defaults to null which means list targeting is not in effect. NOTE: For campaigns, this can be set only if the campaign's targeting_source was set to "CAMPAIGN". Otherwise, targeting can be configured only in Campaign Assignments. In addition, you need to have List Targeting enabled in your account to use this feature. If you don't have that feature enabled, you must set this field's value to null.
12345
The identifier (ID) of the schedule that will be applied to the ad item.
NOTE: Can be set only if the campaign's scheduling_source was set to "AD_ITEM". Otherwise, scheduling can be configured only in Placements.
10002
The status of the campaign assignment. If no schedule is set, the possible statuses are "active" and "paused". If a schedule is set, this status will consider the active state of the campaign assignment and the status of the schedule to determine the overall status of the campaign assignment. All possible statuses are: "active", "paused", "queued", "expired", and "quota_reached".
"active"
A string denoting the current resource being requested or affected.
"campaign_assignment"
The current resource identifier (ID).
8247
The relative URL of the current resource being requested or affected.
"/v2/campaign-assignments/8247"