Create a Geo Target
curl --request POST \
--url https://api.hakumedia.ai/v2/geo-targets \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Toronto Area",
"areas": [
{
"country": "CA",
"region": "Ontario",
"city": "Toronto"
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Toronto Area',
areas: [{country: 'CA', region: 'Ontario', city: 'Toronto'}]
})
};
fetch('https://api.hakumedia.ai/v2/geo-targets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.hakumedia.ai/v2/geo-targets"
payload = {
"name": "Toronto Area",
"areas": [
{
"country": "CA",
"region": "Ontario",
"city": "Toronto"
}
]
}
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/geo-targets",
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([
'name' => 'Toronto Area',
'areas' => [
[
'country' => 'CA',
'region' => 'Ontario',
'city' => 'Toronto'
]
]
]),
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": "Toronto Area",
"range": 3,
"unit": "kilometers",
"inclusive": false,
"object": "geo_target",
"id": 1796,
"self": "/v2/geo-targets/1796",
"areas": [
{
"continent": "North America",
"country": "CA",
"region": "Ontario",
"city": "Toronto",
"manually_selected": true
}
]
}Geo Targets
Create a Geo Target
POST
/
geo-targets
Create a Geo Target
curl --request POST \
--url https://api.hakumedia.ai/v2/geo-targets \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Toronto Area",
"areas": [
{
"country": "CA",
"region": "Ontario",
"city": "Toronto"
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Toronto Area',
areas: [{country: 'CA', region: 'Ontario', city: 'Toronto'}]
})
};
fetch('https://api.hakumedia.ai/v2/geo-targets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.hakumedia.ai/v2/geo-targets"
payload = {
"name": "Toronto Area",
"areas": [
{
"country": "CA",
"region": "Ontario",
"city": "Toronto"
}
]
}
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/geo-targets",
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([
'name' => 'Toronto Area',
'areas' => [
[
'country' => 'CA',
'region' => 'Ontario',
'city' => 'Toronto'
]
]
]),
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": "Toronto Area",
"range": 3,
"unit": "kilometers",
"inclusive": false,
"object": "geo_target",
"id": 1796,
"self": "/v2/geo-targets/1796",
"areas": [
{
"continent": "North America",
"country": "CA",
"region": "Ontario",
"city": "Toronto",
"manually_selected": true
}
]
}Autorizaciones
Cuerpo
application/json
Respuesta
default - application/json
successful operation