API Nom — Suggestion de prénoms

Support DQE
Support DQE
  • Mise à jour
API Nom - Suggestion de prénoms

Utilisez cet endpoint pour suggérer des prénoms 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 noms de famille, voir API Nom — Suggestion de noms de famille →

/FIRSTNAMESUGGEST/

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}/FIRSTNAMESUGGEST/?Firstname={FIRST_NAME}&Gender={GENDER}&NBResponse={NUM}&Licence={LICENCE_CODE}&Country={COUNTRY_CODE}&Format={FORMAT}&Verifname=Y

Exemples de code

Suggestion de prénom

curl "https://{SERVER_ADDRESS}/FIRSTNAMESUGGEST/?Firstname=Ali&Gender=F&NBResponse=10&Country=FRA&Format=0&Licence={LICENCE_CODE}"
fetch("https://{SERVER_ADDRESS}/FIRSTNAMESUGGEST/?" + new URLSearchParams({ Firstname: "Ali", Gender: "F", NBResponse: "10", Country: "FRA", Format: "0", Licence: "{LICENCE_CODE}" })) .then(r => r.json()) .then(data => console.log(data));
import requests response = requests.get( "https://{SERVER_ADDRESS}/FIRSTNAMESUGGEST/", params={ "Firstname": "Ali", "Gender": "F", "NBResponse": "10", "Country": "FRA", "Format": "0", "Licence": "{LICENCE_CODE}", }, ) print(response.json())
<?php $params = http_build_query([ 'Firstname' => 'Ali', 'Gender' => 'F', 'NBResponse' => '10', 'Country' => 'FRA', 'Format' => '0', 'Licence' => '{LICENCE_CODE}', ]); $ch = curl_init("https://{SERVER_ADDRESS}/FIRSTNAMESUGGEST/?{$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}/FIRSTNAMESUGGEST/', { params: { Firstname: 'Ali', Gender: 'F', NBResponse: '10', Country: 'FRA', Format: '0', Licence: '{LICENCE_CODE}' } }) .then(response => console.log(response.data));
HttpClient client = HttpClient.newHttpClient(); String url = "https://{SERVER_ADDRESS}/FIRSTNAMESUGGEST/" + "?Firstname=Ali&Gender=F&NBResponse=10&Country=FRA&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}/FIRSTNAMESUGGEST/" + "?Firstname=Ali&Gender=F&NBResponse=10&Country=FRA&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}/FIRSTNAMESUGGEST/" + "?Firstname=Ali&Gender=F&NBResponse=10&Country=FRA&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}/FIRSTNAMESUGGEST/

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 prénom

curl -X POST "https://{SERVER_ADDRESS}/FIRSTNAMESUGGEST/" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "Licence={LICENCE_CODE}" \ -d "Firstname=Ali" \ -d "Gender=F" \ -d "NBResponse=10" \ -d "Country=FRA" \ -d "Format=0"
fetch("https://{SERVER_ADDRESS}/FIRSTNAMESUGGEST/", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: new URLSearchParams({ Licence: "{LICENCE_CODE}", Firstname: "Ali", Gender: "F", NBResponse: "10", Country: "FRA", Format: "0" }) }) .then(r => r.json()) .then(data => console.log(data));
import requests response = requests.post( "https://{SERVER_ADDRESS}/FIRSTNAMESUGGEST/", data={ "Licence": "{LICENCE_CODE}", "Firstname": "Ali", "Gender": "F", "NBResponse": "10", "Country": "FRA", "Format": "0", }, ) print(response.json())
<?php $ch = curl_init("https://{SERVER_ADDRESS}/FIRSTNAMESUGGEST/"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([ 'Licence' => '{LICENCE_CODE}', 'Firstname' => 'Ali', 'Gender' => 'F', 'NBResponse' => '10', 'Country' => 'FRA', '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}/FIRSTNAMESUGGEST/', qs.stringify({ Licence: '{LICENCE_CODE}', Firstname: 'Ali', Gender: 'F', NBResponse: '10', Country: 'FRA', Format: '0' })) .then(response => console.log(response.data));
HttpClient client = HttpClient.newHttpClient(); String form = "Licence={LICENCE_CODE}&Firstname=Ali&Gender=F&NBResponse=10&Country=FRA&Format=0"; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://{SERVER_ADDRESS}/FIRSTNAMESUGGEST/")) .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}", ["Firstname"] = "Ali", ["Gender"] = "F", ["NBResponse"] = "10", ["Country"] = "FRA", ["Format"] = "0" }; var response = await client.PostAsync( "https://{SERVER_ADDRESS}/FIRSTNAMESUGGEST/", 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("Firstname", "Ali") form.Set("Gender", "F") form.Set("NBResponse", "10") form.Set("Country", "FRA") form.Set("Format", "0") resp, err := http.PostForm("https://{SERVER_ADDRESS}/FIRSTNAMESUGGEST/", 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
Firstname Partie du prénom déjà saisie par l'utilisateur. Obligatoire
Gender M, F, ou I. Optionnel
NBResponse Nombre maximal de suggestions à retourner. Par défaut : 10. Optionnel
Country Code pays ISO à 3 lettres utilisé pour prioriser les suggestions. Optionnel
Format Format de sortie souhaité. Par défaut : 0. Optionnel
Verifname Vérifie si le prénom existe sans autocomplétion (transmettre Y). Optionnel

Valeurs de format

Format Description
0 Prénom en majuscules sans accents.
1 Première lettre en majuscule sans accents.
2 Prénom en minuscules sans accents.
3 Prénom en majuscules avec accents.
4 Première lettre en majuscule avec accents.
5 Prénom 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 le genre du prénom (M, F, ou I), et la seconde valeur est le prénom suggéré.

Clé Valeurs possibles Description Type
suggest[X][0] F, M, I Genre du prénom suggéré — F : féminin, M : masculin, I : inconnu. STRING(1)
suggest[X][1] — Prénom suggéré. STRING(255)

Exemple de réponse

{
  "suggest": [
    ["F", "ALICE"],
    ["F", "ALICE-ANNE"],
    ["F", "ALICE-MARIE"]
  ]
}

Erreurs

Type d'erreur Exemple de requête Corps de la réponse
Paramètre Licence manquant, vide ou incorrect https://{SERVER_ADDRESS}/FIRSTNAMESUGGEST/?Firstname=Ali&Gender=F&NBResponse=10
{}
Paramètre Firstname manquant ou vide https://{SERVER_ADDRESS}/FIRSTNAMESUGGEST/?Gender=F&NBResponse=10&Licence={LICENCE_CODE}
{"suggest": []}
Erreur de frappe dans le paramètre https://{SERVER_ADDRESS}/FIRSTNAMESUGGEST/?Firtname=Ali&Gender=F&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é à

Cet article vous a-t-il été utile ?

Utilisateurs qui ont trouvé cela utile : 0 sur 0