curl --request PUT \
--url https://api.hakumedia.ai/v2/templates/native/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"name": "Product List Native Template",
"raw_html": "<div class='[%ad-color%]'><h1>[%title%]</h1><a href='[%button-link%]'>Purchase for Only [%price%]!</a></div>",
"variables": {
"add": [
{
"name": "text var 2",
"placeholder": "[%text-var-2%]",
"type": "text",
"max_length": 25,
"dropdown_values": null,
"optional": false
}
],
"remove": [
6887
]
}
}
EOFconst options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Product List Native Template',
raw_html: '<div class=\'[%ad-color%]\'><h1>[%title%]</h1><a href=\'[%button-link%]\'>Purchase for Only [%price%]!</a></div>',
variables: {
add: [
{
name: 'text var 2',
placeholder: '[%text-var-2%]',
type: 'text',
max_length: 25,
dropdown_values: null,
optional: false
}
],
remove: [6887]
}
})
};
fetch('https://api.hakumedia.ai/v2/templates/native/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.hakumedia.ai/v2/templates/native/{id}"
payload = {
"name": "Product List Native Template",
"raw_html": "<div class='[%ad-color%]'><h1>[%title%]</h1><a href='[%button-link%]'>Purchase for Only [%price%]!</a></div>",
"variables": {
"add": [
{
"name": "text var 2",
"placeholder": "[%text-var-2%]",
"type": "text",
"max_length": 25,
"dropdown_values": None,
"optional": False
}
],
"remove": [6887]
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hakumedia.ai/v2/templates/native/{id}",
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([
'name' => 'Product List Native Template',
'raw_html' => '<div class=\'[%ad-color%]\'><h1>[%title%]</h1><a href=\'[%button-link%]\'>Purchase for Only [%price%]!</a></div>',
'variables' => [
'add' => [
[
'name' => 'text var 2',
'placeholder' => '[%text-var-2%]',
'type' => 'text',
'max_length' => 25,
'dropdown_values' => null,
'optional' => false
]
],
'remove' => [
6887
]
]
]),
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;
}{
"name": "Product List Native Template",
"raw_html": "<div class='[%ad-color%]'><h1>[%title%]</h1><a href='[%button-link%]'>Purchase for Only [%price%]!</a></div>",
"variables": [
{
"id": 6885,
"name": "Title",
"placeholder": "[%title%]",
"type": "text",
"max_length": 50,
"dropdown_values": null,
"optional": true
},
{
"id": 6886,
"name": "Price",
"placeholder": "[%price%]",
"type": "number",
"max_length": null,
"dropdown_values": null,
"optional": false
},
{
"id": 6887,
"name": "Button Link",
"placeholder": "[%button-link%]",
"type": "url",
"max_length": null,
"dropdown_values": null,
"optional": false
},
{
"id": 6888,
"name": "Ad Color",
"placeholder": "[%ad-color%]",
"type": "dropdown",
"max_length": null,
"dropdown_values": "red,green,blue,orange",
"optional": true
}
],
"object": "native_template",
"self": "/v2/templates/native/1234",
"id": 1234,
"latest_version_id": 522361,
"references": [
55213,
66514,
64572
],
"outdated_references": []
}{
"http_status": 404,
"type": "resource_not_found_error",
"message": "Resource not found."
}Update a Native Template
curl --request PUT \
--url https://api.hakumedia.ai/v2/templates/native/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"name": "Product List Native Template",
"raw_html": "<div class='[%ad-color%]'><h1>[%title%]</h1><a href='[%button-link%]'>Purchase for Only [%price%]!</a></div>",
"variables": {
"add": [
{
"name": "text var 2",
"placeholder": "[%text-var-2%]",
"type": "text",
"max_length": 25,
"dropdown_values": null,
"optional": false
}
],
"remove": [
6887
]
}
}
EOFconst options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Product List Native Template',
raw_html: '<div class=\'[%ad-color%]\'><h1>[%title%]</h1><a href=\'[%button-link%]\'>Purchase for Only [%price%]!</a></div>',
variables: {
add: [
{
name: 'text var 2',
placeholder: '[%text-var-2%]',
type: 'text',
max_length: 25,
dropdown_values: null,
optional: false
}
],
remove: [6887]
}
})
};
fetch('https://api.hakumedia.ai/v2/templates/native/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.hakumedia.ai/v2/templates/native/{id}"
payload = {
"name": "Product List Native Template",
"raw_html": "<div class='[%ad-color%]'><h1>[%title%]</h1><a href='[%button-link%]'>Purchase for Only [%price%]!</a></div>",
"variables": {
"add": [
{
"name": "text var 2",
"placeholder": "[%text-var-2%]",
"type": "text",
"max_length": 25,
"dropdown_values": None,
"optional": False
}
],
"remove": [6887]
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hakumedia.ai/v2/templates/native/{id}",
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([
'name' => 'Product List Native Template',
'raw_html' => '<div class=\'[%ad-color%]\'><h1>[%title%]</h1><a href=\'[%button-link%]\'>Purchase for Only [%price%]!</a></div>',
'variables' => [
'add' => [
[
'name' => 'text var 2',
'placeholder' => '[%text-var-2%]',
'type' => 'text',
'max_length' => 25,
'dropdown_values' => null,
'optional' => false
]
],
'remove' => [
6887
]
]
]),
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;
}{
"name": "Product List Native Template",
"raw_html": "<div class='[%ad-color%]'><h1>[%title%]</h1><a href='[%button-link%]'>Purchase for Only [%price%]!</a></div>",
"variables": [
{
"id": 6885,
"name": "Title",
"placeholder": "[%title%]",
"type": "text",
"max_length": 50,
"dropdown_values": null,
"optional": true
},
{
"id": 6886,
"name": "Price",
"placeholder": "[%price%]",
"type": "number",
"max_length": null,
"dropdown_values": null,
"optional": false
},
{
"id": 6887,
"name": "Button Link",
"placeholder": "[%button-link%]",
"type": "url",
"max_length": null,
"dropdown_values": null,
"optional": false
},
{
"id": 6888,
"name": "Ad Color",
"placeholder": "[%ad-color%]",
"type": "dropdown",
"max_length": null,
"dropdown_values": "red,green,blue,orange",
"optional": true
}
],
"object": "native_template",
"self": "/v2/templates/native/1234",
"id": 1234,
"latest_version_id": 522361,
"references": [
55213,
66514,
64572
],
"outdated_references": []
}{
"http_status": 404,
"type": "resource_not_found_error",
"message": "Resource not found."
}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 resource.
Body
The name of the native template. We recommend using a naming scheme that is descriptive, relevant, and consistent.
"Product List Native Template"
The HTML that will be served as an ad. This HTML should include the variable placeholder values that will be replaced when the template is used to create a native ad.
"<div class='[%ad-color%]'><h1>[%title%]</h1><a href='[%button-link%]'>Purchase for Only [%price%]!</a></div>"
The variables to be replaced in the raw_html when the template is used to create a native ad.
Show child attributes
Show child attributes
Response
successful operation
The name of the native template. We recommend using a naming scheme that is descriptive, relevant, and consistent.
"Product List Native Template"
The HTML that will be served as an ad. This HTML should include the variable placeholder values that will be replaced when the template is used to create a native ad.
"<div class='[%ad-color%]'><h1>[%title%]</h1><a href='[%button-link%]'>Purchase for Only [%price%]!</a></div>"
The variables to be replaced in the raw_html when the template is used to create a native ad.
Show child attributes
Show child attributes
[
{
"id": 6885,
"name": "Title",
"placeholder": "[%title%]",
"type": "text",
"max_length": 50,
"dropdown_values": null,
"optional": true
},
{
"id": 6886,
"name": "Price",
"placeholder": "[%price%]",
"type": "number",
"max_length": null,
"dropdown_values": null,
"optional": false
},
{
"id": 6887,
"name": "Button Link",
"placeholder": "[%button-link%]",
"type": "url",
"max_length": null,
"dropdown_values": null,
"optional": false
},
{
"id": 6888,
"name": "Ad Color",
"placeholder": "[%ad-color%]",
"type": "dropdown",
"max_length": null,
"dropdown_values": "red,green,blue,orange",
"optional": true
}
]
A string denoting the current resource being requested or affected.
"native_template"
The relative URL of the current resource being requested or affected.
"/v2/templates/native/1234"
The current resource identifier (ID).
1234
The latest version ID.
522361
A list of IDs of the ad items that reference this template.
[55213, 66514, 64572]
A list of IDs of the ad items that reference an older version of this template.
[]