curl --request POST \
--url https://api.hakumedia.ai/v2/creatives/image/{id}/replace-file \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form file=@/path/to/image.pngconst form = new FormData();
form.append('file', '@/path/to/image.png');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://api.hakumedia.ai/v2/creatives/image/{id}/replace-file', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.hakumedia.ai/v2/creatives/image/{id}/replace-file"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n@/path/to/image.png\r\n-----011000010111000001101001--"
headers = {"Authorization": "<api-key>"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hakumedia.ai/v2/creatives/image/{id}/replace-file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n@/path/to/image.png\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"description": "",
"group": 87,
"name": "Demo Creative",
"file_size": 329438,
"uploaded_time": "2019-04-21 13:22:59",
"height": 400,
"width": 650,
"object": "image_creative",
"id": 115260,
"self": "/v2/creatives/image/115260",
"file_name": "creative.png",
"mime_type": "image/png"
}Replace the File on an Image Creative
curl --request POST \
--url https://api.hakumedia.ai/v2/creatives/image/{id}/replace-file \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form file=@/path/to/image.pngconst form = new FormData();
form.append('file', '@/path/to/image.png');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://api.hakumedia.ai/v2/creatives/image/{id}/replace-file', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.hakumedia.ai/v2/creatives/image/{id}/replace-file"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n@/path/to/image.png\r\n-----011000010111000001101001--"
headers = {"Authorization": "<api-key>"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hakumedia.ai/v2/creatives/image/{id}/replace-file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n@/path/to/image.png\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"description": "",
"group": 87,
"name": "Demo Creative",
"file_size": 329438,
"uploaded_time": "2019-04-21 13:22:59",
"height": 400,
"width": 650,
"object": "image_creative",
"id": 115260,
"self": "/v2/creatives/image/115260",
"file_name": "creative.png",
"mime_type": "image/png"
}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
The absolute or relative path to the image (JPEG, PNG, or GIF) file.
"@/path/to/image.png"
Response
successful operation
A short description of the creative.
""
The media group identifier (ID).
87
A descriptive name of the creative.
"Demo Creative"
The size of the uploaded image file.
329438
The date and time when the file was uploaded.
"2019-04-21 13:22:59"
The height of the creative.
400
The width of the creative.
650
A string denoting the current resource being requested or affected.
"image_creative"
The current resource identifier (ID).
115260
The relative URL of the current resource being requested or affected.
"/v2/creatives/image/115260"
The name of the uploaded file.
"creative.png"