Request cURL JavaScript Python Java PHP C#
curl -X POST 'https://bemap.benomad.com/bgis/service/geocoding/1.0' \
-u 'YOUR_ACCOUNT:YOUR_API_KEY' \
--fail-with-body \
-H 'Content-Type: application/json' \
-d '{
"address": {
"country": "France",
"city": "Paris",
"street": "Rue de Rivoli",
"streetNumber": "164"
},
"maximumResults": 2
}'const response = await fetch('https://bemap.benomad.com/bgis/service/geocoding/1.0', {
method: 'POST',
headers: {
Authorization: 'Basic ' + btoa('YOUR_ACCOUNT:YOUR_API_KEY'),
'Content-Type': 'application/json',
},
body: JSON.stringify({
"address": {
"country": "France",
"city": "Paris",
"street": "Rue de Rivoli",
"streetNumber": "164"
},
"maximumResults": 2
}),
redirect: 'manual', // a missing credential answers 302: never follow it
});
if (response.type === 'opaqueredirect' || (response.status >= 300 && response.status < 400)) throw new Error('BeMap redirected to its login page: no credentials reached it');
if (!response.ok) throw new Error(`BeMap answered ${response.status}: ${await response.text()}`);
const data = await response.json();import requests
response = requests.post(
"https://bemap.benomad.com/bgis/service/geocoding/1.0",
auth=("YOUR_ACCOUNT", "YOUR_API_KEY"),
json={
"address": {
"country": "France",
"city": "Paris",
"street": "Rue de Rivoli",
"streetNumber": "164",
},
"maximumResults": 2,
},
allow_redirects=False, # a missing credential answers 302: never follow it
)
if response.is_redirect:
raise RuntimeError("BeMap redirected to its login page: no credentials reached it")
if response.status_code != 200:
raise RuntimeError(f"BeMap answered {response.status_code}: {response.text}")
data = response.json()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
String auth = Base64.getEncoder().encodeToString("YOUR_ACCOUNT:YOUR_API_KEY".getBytes(StandardCharsets.UTF_8));
String body = """
{
"address": {
"country": "France",
"city": "Paris",
"street": "Rue de Rivoli",
"streetNumber": "164"
},
"maximumResults": 2
}
""";
HttpRequest request = HttpRequest.newBuilder(URI.create("https://bemap.benomad.com/bgis/service/geocoding/1.0"))
.header("Authorization", "Basic " + auth)
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
// HttpClient never follows redirects by default: a 302 means a missing credential.
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() / 100 == 3) throw new IllegalStateException("BeMap redirected to its login page: no credentials reached it");
if (response.statusCode() != 200) throw new IllegalStateException("BeMap answered " + response.statusCode() + ": " + response.body());
String json = response.body();<?php
$body = <<<'JSON'
{
"address": {
"country": "France",
"city": "Paris",
"street": "Rue de Rivoli",
"streetNumber": "164"
},
"maximumResults": 2
}
JSON;
$ch = curl_init('https://bemap.benomad.com/bgis/service/geocoding/1.0');
curl_setopt_array($ch, [
CURLOPT_USERPWD => 'YOUR_ACCOUNT:YOUR_API_KEY',
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => $body,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => false, // a missing credential answers 302: never follow it
]);
$response = curl_exec($ch);
if ($response === false) throw new RuntimeException(curl_error($ch));
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 300 && $status < 400) throw new RuntimeException('BeMap redirected to its login page: no credentials reached it');
if ($status !== 200) throw new RuntimeException("BeMap answered $status: $response");
$data = json_decode($response, true);using System.Net;
using System.Net.Http.Headers;
using System.Text;
// AllowAutoRedirect = false: a missing credential answers 302, never follow it.
var client = new HttpClient(new HttpClientHandler { AllowAutoRedirect = false });
var token = Convert.ToBase64String(Encoding.UTF8.GetBytes("YOUR_ACCOUNT:YOUR_API_KEY"));
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", token);
var body = """
{
"address": {
"country": "France",
"city": "Paris",
"street": "Rue de Rivoli",
"streetNumber": "164"
},
"maximumResults": 2
}
""";
var response = await client.SendAsync(new HttpRequestMessage(HttpMethod.Post, "https://bemap.benomad.com/bgis/service/geocoding/1.0")
{
Content = new StringContent(body, Encoding.UTF8, "application/json"),
});
if ((int)response.StatusCode / 100 == 3) throw new HttpRequestException("BeMap redirected to its login page: no credentials reached it");
if (response.StatusCode != HttpStatusCode.OK) throw new HttpRequestException($"BeMap answered {(int)response.StatusCode}: {await response.Content.ReadAsStringAsync()}");
var json = await response.Content.ReadAsStringAsync(); Build with AI
Help me integrate BeMap Geocoding: An address, structured or free text, turned into coordinates: one at a time, as you type, or in batch.
Its operations, each with its reference:
- POST https://bemap.benomad.com/bgis/service/geocoding/1.0 (Geocoding): https://benomad.com/dev/doc/bemap-api/api/search/geocoding.md
- POST https://bemap.benomad.com/bgis/service/geocoding/1.0/natural (Natural geocoding): https://benomad.com/dev/doc/bemap-api/api/search/geocoding-natural.md
- POST https://bemap.benomad.com/bgis/service/geocoding/autocomplete/1.0 (Auto-complete): https://benomad.com/dev/doc/bemap-api/api/search/geocoding-autocomplete.md
- POST https://bemap.benomad.com/bgis/service/geocodingBatch/1.0 (Geocoding for batch job): https://benomad.com/dev/doc/bemap-api/api/search/geocodingbatch.md
Authenticate with HTTP Basic (the BeMap account as the user name, the API key as the password) and do not follow redirects. BeMap ignores an unknown field name without an error: use only the fields the references list, and read what each value means there. Copy prompt Open in Claude Open in ChatGPT With the BeMap MCP server , your assistant also checks each request against the specification before sending it.