API Nom - Suggestion de noms de famille
Utilisez cet endpoint pour suggérer des noms de famille basés sur la saisie de l'utilisateur.
Documentation Nom associée - Pour une présentation du service, voir API Nom — Introduction →
Pour la suggestion de prénoms, voir API Nom — Suggestion de prénoms →
Pour la suggestion de prénoms, voir API Nom — Suggestion de prénoms →
/LASTNAMESUGGEST/
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}/LASTNAMESUGGEST/?Lastname={NAME}&NBResponse={NUM}&Licence={LICENCE_CODE}&Format={FORMAT}
Exemples de code
Suggestion de nom de famille
curl "https://{SERVER_ADDRESS}/LASTNAMESUGGEST/?Lastname=Dup&NBResponse=10&Format=0&Licence={LICENCE_CODE}"
fetch("https://{SERVER_ADDRESS}/LASTNAMESUGGEST/?" + new URLSearchParams({
Lastname: "Dup",
NBResponse: "10",
Format: "0",
Licence: "{LICENCE_CODE}"
}))
.then(r => r.json())
.then(data => console.log(data));
import requests
response = requests.get(
"https://{SERVER_ADDRESS}/LASTNAMESUGGEST/",
params={
"Lastname": "Dup",
"NBResponse": "10",
"Format": "0",
"Licence": "{LICENCE_CODE}",
},
)
print(response.json())
<?php
$params = http_build_query([
'Lastname' => 'Dup',
'NBResponse' => '10',
'Format' => '0',
'Licence' => '{LICENCE_CODE}',
]);
$ch = curl_init("https://{SERVER_ADDRESS}/LASTNAMESUGGEST/?{$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}/LASTNAMESUGGEST/', {
params: {
Lastname: 'Dup',
NBResponse: '10',
Format: '0',
Licence: '{LICENCE_CODE}'
}
})
.then(response => console.log(response.data));
HttpClient client = HttpClient.newHttpClient();
String url = "https://{SERVER_ADDRESS}/LASTNAMESUGGEST/"
+ "?Lastname=Dup&NBResponse=10&Format=0&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}/LASTNAMESUGGEST/" +
"?Lastname=Dup&NBResponse=10&Format=0&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}/LASTNAMESUGGEST/" +
"?Lastname=Dup&NBResponse=10&Format=0&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}/LASTNAMESUGGEST/
Envoyez tous les paramètres dans le corps de la requête en utilisant Content-Type: application/x-www-form-urlencoded. L'adresse du serveur reste dans l'URL.
Exemples de code
Suggestion de nom de famille
curl -X POST "https://{SERVER_ADDRESS}/LASTNAMESUGGEST/" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "Licence={LICENCE_CODE}" \
-d "Lastname=Dup" \
-d "NBResponse=10" \
-d "Format=0"
fetch("https://{SERVER_ADDRESS}/LASTNAMESUGGEST/", {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: new URLSearchParams({
Licence: "{LICENCE_CODE}",
Lastname: "Dup",
NBResponse: "10",
Format: "0"
})
})
.then(r => r.json())
.then(data => console.log(data));
import requests
response = requests.post(
"https://{SERVER_ADDRESS}/LASTNAMESUGGEST/",
data={
"Licence": "{LICENCE_CODE}",
"Lastname": "Dup",
"NBResponse": "10",
"Format": "0",
},
)
print(response.json())
<?php
$ch = curl_init("https://{SERVER_ADDRESS}/LASTNAMESUGGEST/");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
'Licence' => '{LICENCE_CODE}',
'Lastname' => 'Dup',
'NBResponse' => '10',
'Format' => '0',
]));
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}/LASTNAMESUGGEST/', qs.stringify({
Licence: '{LICENCE_CODE}',
Lastname: 'Dup',
NBResponse: '10',
Format: '0'
}))
.then(response => console.log(response.data));
HttpClient client = HttpClient.newHttpClient();
String form = "Licence={LICENCE_CODE}&Lastname=Dup&NBResponse=10&Format=0";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://{SERVER_ADDRESS}/LASTNAMESUGGEST/"))
.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> {
["Licence"] = "{LICENCE_CODE}",
["Lastname"] = "Dup",
["NBResponse"] = "10",
["Format"] = "0"
};
var response = await client.PostAsync(
"https://{SERVER_ADDRESS}/LASTNAMESUGGEST/",
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("Licence", "{LICENCE_CODE}")
form.Set("Lastname", "Dup")
form.Set("NBResponse", "10")
form.Set("Format", "0")
resp, err := http.PostForm("https://{SERVER_ADDRESS}/LASTNAMESUGGEST/", 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 attribué à votre compte. | Obligatoire |
| Lastname | Partie du nom de famille déjà saisie par l'utilisateur. | Obligatoire |
| NBResponse | Nombre maximal de suggestions à retourner. Par défaut : 10. |
Optionnel |
| Format | Format de sortie souhaité. Par défaut : 0. |
Optionnel |
Valeurs de format
| Format | Description |
|---|---|
0 |
Nom de famille en majuscules sans accents. |
1 |
Première lettre en majuscule sans accents. |
2 |
Nom de famille en minuscules sans accents. |
3 |
Nom de famille en majuscules avec accents. |
4 |
Première lettre en majuscule avec accents. |
5 |
Nom de famille en minuscules avec accents. |
Réponse
La réponse JSON est un dictionnaire contenant la clé suggest. Sa valeur est un tableau d'éléments suggérés. Chaque élément est un tableau de deux chaînes : la première valeur est toujours I, et la seconde valeur est le nom de famille suggéré.
| Clé | Valeurs possibles | Description | Type |
|---|---|---|---|
| suggest[X][0] | I |
Toujours I (inconnu) — les noms de famille n'ont pas de distinction de genre. |
STRING(1) |
| suggest[X][1] | — | Nom de famille suggéré. | STRING(255) |
Exemple de réponse
{
"suggest": [
["I", "DUPONT"],
["I", "DUPOUY"],
["I", "DUPORT"]
]
}
Erreurs
| Type d'erreur | Exemple de requête | Corps de la réponse |
|---|---|---|
Paramètre Licence manquant, vide ou incorrect |
https://{SERVER_ADDRESS}/LASTNAMESUGGEST/?Lastname=Dup&NBResponse=10 |
{} |
Paramètre Lastname manquant ou vide |
https://{SERVER_ADDRESS}/LASTNAMESUGGEST/?NBResponse=10&Licence={LICENCE_CODE} |
{"suggest": []} |
| Erreur de frappe dans le paramètre | https://{SERVER_ADDRESS}/LASTNAMESUGGEST/?Lasname=Dup&NBResponse=10&Licence={LICENCE_CODE} |
{"suggest": []} |
Tester l'API
Cliquez sur le bouton ci-dessous pour tester cet endpoint en direct dans votre navigateur.
Ouvrir la console
Voir aussi
Associé à