curl --request PUT \
--url https://api.hakumedia.ai/v2/geo-targets/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Toronto Area",
"range": 3,
"unit": "kilometers",
"inclusive": false,
"areas": [
{
"country": "CA",
"region": "Ontario",
"city": "Toronto"
}
]
}
'const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Toronto Area',
range: 3,
unit: 'kilometers',
inclusive: false,
areas: [{country: 'CA', region: 'Ontario', city: 'Toronto'}]
})
};
fetch('https://api.hakumedia.ai/v2/geo-targets/{id}', 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/{id}"
payload = {
"name": "Toronto Area",
"range": 3,
"unit": "kilometers",
"inclusive": False,
"areas": [
{
"country": "CA",
"region": "Ontario",
"city": "Toronto"
}
]
}
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/geo-targets/{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' => 'Toronto Area',
'range' => 3,
'unit' => 'kilometers',
'inclusive' => false,
'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
}
]
}Update a Geo Target
curl --request PUT \
--url https://api.hakumedia.ai/v2/geo-targets/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Toronto Area",
"range": 3,
"unit": "kilometers",
"inclusive": false,
"areas": [
{
"country": "CA",
"region": "Ontario",
"city": "Toronto"
}
]
}
'const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Toronto Area',
range: 3,
unit: 'kilometers',
inclusive: false,
areas: [{country: 'CA', region: 'Ontario', city: 'Toronto'}]
})
};
fetch('https://api.hakumedia.ai/v2/geo-targets/{id}', 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/{id}"
payload = {
"name": "Toronto Area",
"range": 3,
"unit": "kilometers",
"inclusive": False,
"areas": [
{
"country": "CA",
"region": "Ontario",
"city": "Toronto"
}
]
}
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/geo-targets/{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' => 'Toronto Area',
'range' => 3,
'unit' => 'kilometers',
'inclusive' => false,
'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
}
]
}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 geo target you want to update.
Body
The name of the geographic target. Can be whatever the user wants to name the geo target for easier reference.
"Toronto Area"
The additional distance around the selected locations to include in the target. This only applies when targeting a city.
3
The unit of distance for the range field. Accepted units are "miles" and "kilometers". This only applies when targeting a city.
"kilometers"
Whether it is an inclusion or an exclusion target. Set to true if inclusion, and false if exclusion.
false
A list of areas to include in the geo target. Each area object represents some location on a map.
Show child attributes
Show child attributes
[
{
"country": "CA",
"region": "Ontario",
"city": "Toronto"
}
]
Response
successful operation
The name of the geographic target. Can be whatever the user wants to name the geo target for easier reference.
"Toronto Area"
The additional distance around the selected locations to include in the target. This only applies when targeting a city.
3
The unit of distance for the range field. Accepted units are "miles" and "kilometers". This only applies when targeting a city.
"kilometers"
Whether it is an inclusion or an exclusion target. Set to true if inclusion, and false if exclusion.
false
A string denoting the current resource being requested or affected.
"geo_target"
The current resource identifier (ID).
1796
The relative URL of the current resource being requested or affected.
"/v2/geo-targets/1796"
A list of areas to include in the geo target. Each area object represents some location on a map.
Show child attributes
Show child attributes