Convert Native Ad Item to Image
curl --request POST \
--url https://api.hakumedia.ai/v2/ad-items/native/{id}/to-image \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"media_group": 87,
"size": "300x250"
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({media_group: 87, size: '300x250'})
};
fetch('https://api.hakumedia.ai/v2/ad-items/native/{id}/to-image', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.hakumedia.ai/v2/ad-items/native/{id}/to-image"
payload = {
"media_group": 87,
"size": "300x250"
}
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/ad-items/native/{id}/to-image",
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([
'media_group' => 87,
'size' => '300x250'
]),
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;
}{
"data": {
"status": "success",
"task": 456,
"task_url": "/v2/scheduled-tasks/native-ad-to-image/456"
}
}Ad Items · Native
Convert Native Ad Item to Image
Schedules a task to convert a native ad item into an image creative. The generated image will be stored in the specified media group. Use the returned task URL to check the status of the conversion. Note: This endpoint requires the Native Ad to Image feature to be enabled.
POST
/
ad-items
/
native
/
{id}
/
to-image
Convert Native Ad Item to Image
curl --request POST \
--url https://api.hakumedia.ai/v2/ad-items/native/{id}/to-image \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"media_group": 87,
"size": "300x250"
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({media_group: 87, size: '300x250'})
};
fetch('https://api.hakumedia.ai/v2/ad-items/native/{id}/to-image', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.hakumedia.ai/v2/ad-items/native/{id}/to-image"
payload = {
"media_group": 87,
"size": "300x250"
}
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/ad-items/native/{id}/to-image",
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([
'media_group' => 87,
'size' => '300x250'
]),
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;
}{
"data": {
"status": "success",
"task": 456,
"task_url": "/v2/scheduled-tasks/native-ad-to-image/456"
}
}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 native ad item to convert.
Body
application/json
The identifier (ID) of the media group to store the generated image in.
Example:
87
The dimensions for the generated image in the format {width}x{height}.
Example:
"300x250"
An optional name for the generated image. Maximum 255 characters.
Example:
"Homepage Banner"
Response
default - application/json
successful operation
Show child attributes
Show child attributes