curl -X POST "https://geodata.api.leadinglogic.ai/v1/batch" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"locations": ["SW1A1AA", "M11AD"],
"categories": ["demographics"]
}'
const response = await fetch(
"https://geodata.api.leadinglogic.ai/v1/batch",
{
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
locations: ["SW1A1AA", "M11AD"],
categories: ["demographics"],
}),
}
);
const data = await response.json();
console.log("Results:", data.results);
import requests
response = requests.post(
"https://geodata.api.leadinglogic.ai/v1/batch",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"locations": ["SW1A1AA", "M11AD"],
"categories": ["demographics"],
},
)
data = response.json()
for result in data["results"]:
print(result["location"], result["demographics"]["population"]["total"])
require "net/http"
require "json"
uri = URI("https://geodata.api.leadinglogic.ai/v1/batch")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer YOUR_API_KEY"
request["Content-Type"] = "application/json"
request.body = {
locations: ["SW1A1AA", "M11AD"],
categories: ["demographics"]
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
data = JSON.parse(response.body)
data["results"].each { |r| puts r["location"] }
$ch = curl_init("https://geodata.api.leadinglogic.ai/v1/batch");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer YOUR_API_KEY",
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"locations" => ["SW1A1AA", "M11AD"],
"categories" => ["demographics"],
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
foreach ($data["results"] as $result) {
echo $result["location"] . "\n";
}
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");
var payload = new {
locations = new[] { "SW1A1AA", "M11AD" },
categories = new[] { "demographics" }
};
var content = new StringContent(
JsonSerializer.Serialize(payload),
Encoding.UTF8, "application/json"
);
var response = await client.PostAsync("https://geodata.api.leadinglogic.ai/v1/batch", content);
var json = await response.Content.ReadAsStringAsync();
var data = JsonDocument.Parse(json);
Console.WriteLine(data.RootElement.GetProperty("results"));
body := bytes.NewBufferString(`{
"locations": ["SW1A1AA", "M11AD"],
"categories": ["demographics"]
}`)
req, _ := http.NewRequest("POST", "https://geodata.api.leadinglogic.ai/v1/batch", body)
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println("Results:", result["results"])