API CityDate - BirthLocality
L'endpoint BirthLocality recherche les localités françaises correspondant à un terme de recherche à une date donnée.
Documentation CityDate associée - L'endpoint
API - Description - CityDate - CPFRA →
CityDate introduction →
BirthLocality recherche des localités par nom ou par code INSEE. Vous cherchez plutôt une vérification de validité de date de naissance sur une ville connue ?API - Description - CityDate - CPFRA →
CityDate introduction →
BirthLocality
Requête
GET et POST sont toutes deux prises en charge.
{SERVER_ADDRESS} et {LICENCE_CODE} sont fournis par DQE à la création du compte. Contactez votre chargé de compte DQE pour obtenir ces identifiants.
GEThttps://{SERVER_ADDRESS}/BirthLocality/?BirthDate={DATE}&Search={LOOKUP}&Licence={LICENCE_CODE}&NbMax={NB_MAX}
Exemples de code
Recherche par nom de localité
curl "https://{SERVER_ADDRESS}/BirthLocality/?BirthDate=1980-05-15&Search=PARIS&Licence={LICENCE_CODE}"
fetch("https://{SERVER_ADDRESS}/BirthLocality/?" + new URLSearchParams({
BirthDate: "1980-05-15",
Search: "PARIS",
Licence: "{LICENCE_CODE}"
}))
.then(r => r.json())
.then(data => console.log(data));
import requests
response = requests.get(
"https://{SERVER_ADDRESS}/BirthLocality/",
params={
"BirthDate": "1980-05-15",
"Search": "PARIS",
"Licence": "{LICENCE_CODE}",
},
)
print(response.json())
<?php
$params = http_build_query([
'BirthDate' => '1980-05-15',
'Search' => 'PARIS',
'Licence' => '{LICENCE_CODE}',
]);
$ch = curl_init("https://{SERVER_ADDRESS}/BirthLocality/?{$params}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
const axios = require('axios');
axios.get('https://{SERVER_ADDRESS}/BirthLocality/', {
params: {
BirthDate: '1980-05-15',
Search: 'PARIS',
Licence: '{LICENCE_CODE}'
}
})
.then(response => console.log(response.data));
HttpClient client = HttpClient.newHttpClient();
String url = "https://{SERVER_ADDRESS}/BirthLocality/"
+ "?BirthDate=1980-05-15&Search=PARIS&Licence={LICENCE_CODE}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
using var client = new HttpClient();
var url = "https://{SERVER_ADDRESS}/BirthLocality/" +
"?BirthDate=1980-05-15&Search=PARIS&Licence={LICENCE_CODE}";
var response = await client.GetAsync(url);
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://{SERVER_ADDRESS}/BirthLocality/" +
"?BirthDate=1980-05-15&Search=PARIS&Licence={LICENCE_CODE}"
resp, err := http.Get(url)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
POSThttps://{SERVER_ADDRESS}/BirthLocality/
Ajoutez les paramètres suivants dans le corps de la requête au format x-www-form-urlencoded. L'adresse du serveur reste dans l'URL.
Exemples de code
Recherche par nom de localité
curl -X POST "https://{SERVER_ADDRESS}/BirthLocality/" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "BirthDate=1980-05-15" \
-d "Search=PARIS" \
-d "Licence={LICENCE_CODE}"
fetch("https://{SERVER_ADDRESS}/BirthLocality/", {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: new URLSearchParams({
BirthDate: "1980-05-15",
Search: "PARIS",
Licence: "{LICENCE_CODE}"
})
})
.then(r => r.json())
.then(data => console.log(data));
import requests
response = requests.post(
"https://{SERVER_ADDRESS}/BirthLocality/",
data={
"BirthDate": "1980-05-15",
"Search": "PARIS",
"Licence": "{LICENCE_CODE}",
},
)
print(response.json())
<?php
$ch = curl_init("https://{SERVER_ADDRESS}/BirthLocality/");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
'BirthDate' => '1980-05-15',
'Search' => 'PARIS',
'Licence' => '{LICENCE_CODE}',
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
const axios = require('axios');
const qs = require('querystring');
axios.post('https://{SERVER_ADDRESS}/BirthLocality/', qs.stringify({
BirthDate: '1980-05-15',
Search: 'PARIS',
Licence: '{LICENCE_CODE}'
}))
.then(response => console.log(response.data));
HttpClient client = HttpClient.newHttpClient();
String form = "BirthDate=1980-05-15&Search=PARIS&Licence={LICENCE_CODE}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://{SERVER_ADDRESS}/BirthLocality/"))
.header("Content-Type", "application/x-www-form-urlencoded")
.POST(HttpRequest.BodyPublishers.ofString(form))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
using var client = new HttpClient();
var form = new Dictionary<string, string> {
["BirthDate"] = "1980-05-15",
["Search"] = "PARIS",
["Licence"] = "{LICENCE_CODE}"
};
var response = await client.PostAsync(
"https://{SERVER_ADDRESS}/BirthLocality/",
new FormUrlEncodedContent(form));
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
form := url.Values{}
form.Set("BirthDate", "1980-05-15")
form.Set("Search", "PARIS")
form.Set("Licence", "{LICENCE_CODE}")
resp, err := http.PostForm("https://{SERVER_ADDRESS}/BirthLocality/", form)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
Paramètres
| Paramètre | Description | Obl / Opt |
|---|---|---|
| Licence | Code de licence associé à votre compte. | Obligatoire |
| BirthDate | Date au format YYYY-MM-DD. |
Obligatoire |
| Search | Champ de recherche utilisant le libellé de la localité ou le code INSEE. | Obligatoire |
| NbMax | Nombre maximum de résultats renvoyés par l'API. |
Optionnel Par défaut : 20
|
Réponse
| Clé | Description | Type |
|---|---|---|
| Found | Nombre total de résultats trouvés. | INTEGER |
| Results | Liste des localités renvoyées. | ARRAY |
| Results.City | Nom de la localité. | STRING(50) |
| Results.CountyCode | Code du département. | STRING(2) |
| Results.CountyLabel | Libellé du département. | STRING(50) |
| Results.CountryCode | Code pays ou DROM. | STRING(2) |
| Results.CountryLabel | Libellé du pays ou DROM. | STRING(50) |
| Results.CodeInsee | Code INSEE de la localité. | STRING(5) |
| Results.ValidityStartDate | Date de début de validité du code INSEE. | DATE (YYYY-MM-DD) |
| Results.ValidityEndDate | Date de fin de validité du code INSEE. Vide si le code est toujours valide. | DATE (YYYY-MM-DD) / NULL |
Codes pays / DROM - FR = France, GP = Guadeloupe, MQ = Martinique, GF = Guyane, RE = La Réunion, YT = Mayotte, PM = Saint-Pierre-et-Miquelon, BL = Saint-Barthélemy, MF = Saint-Martin, PF = Polynésie française, NC = Nouvelle-Calédonie, WF = Wallis-et-Futuna, TF = Terres australes et antarctiques françaises
Exemple de réponse
Résultats de recherche
{
"Found": 3,
"Results": [
{"City": "AAST", "CountyCode": "64", "CountyLabel": "PYRENEES-ATLANTIQUES", "CountryCode": "FR", "CountryLabel": "FRANCE", "CodeInsee": "64001", "ValidityStartDate": "1943-01-01", "ValidityEndDate": ""},
{"City": "ABAINVILLE", "CountyCode": "55", "CountyLabel": "MEUSE", "CountryCode": "FR", "CountryLabel": "FRANCE", "CodeInsee": "55001", "ValidityStartDate": "1943-01-01", "ValidityEndDate": ""}
]
}
Erreurs
| HTTP | Description |
|---|---|
| 400 | Requête invalide ou paramètre obligatoire manquant — par exemple un BirthDate, Search, ou Licence manquant. |
Tester l'API
Cliquez sur le bouton ci-dessous pour tester cet endpoint en direct dans votre navigateur.
Ouvrir la console
Voir aussi
Associé à