Name API — Validación de apellido

Support DQE
Support DQE
  • Actualización
Name API - Sugerir apellidos

Utilice este endpoint para sugerir apellidos basados en la entrada del usuario.

Documentación relacionada de Name - Para una visión general del servicio, consulte Name API — Introducción →
Para sugerencias de nombres de pila, consulte Name API — Validación de nombre de pila →

/LASTNAMESUGGEST/

Solicitud

Se admiten tanto GET como POST.

{SERVER_ADDRESS} y {LICENCE_CODE} son proporcionados por DQE al crear la cuenta. Póngase en contacto con su gestor de cuenta de DQE para obtenerlos.
GEThttps://{SERVER_ADDRESS}/LASTNAMESUGGEST/?Lastname={NAME}&NBResponse={NUM}&Licence={LICENCE_CODE}&Format={FORMAT}

Ejemplos de código

Sugerencia de apellido

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/

Envíe todos los parámetros en el cuerpo de la solicitud usando Content-Type: application/x-www-form-urlencoded. La dirección del servidor permanece en la URL.

Ejemplos de código

Sugerencia de apellido

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)) }

Parámetros

Parámetro Descripción Obl. / Opc.
Licence Código de licencia asignado a su cuenta. Obligatorio
Lastname Parte del apellido ya introducido por el usuario. Obligatorio
NBResponse Número máximo de sugerencias a devolver. Predeterminado: 10. Opcional
Format Formato de salida deseado. Predeterminado: 0. Opcional

Valores de Format

Format Descripción
0 Apellido en mayúsculas sin acentos.
1 Primera letra en mayúscula sin acentos.
2 Apellido en minúsculas sin acentos.
3 Apellido en mayúsculas con acentos.
4 Primera letra en mayúscula con acentos.
5 Apellido en minúsculas con acentos.

Respuesta

La respuesta JSON es un diccionario que contiene la clave suggest. Su valor es un array de elementos sugeridos. Cada elemento es un array de dos cadenas: el primer valor es siempre I, y el segundo valor es el apellido sugerido.

Clave Valores posibles Descripción Tipo
suggest[X][0] I Siempre I (desconocido) — los apellidos no tienen distinción de género. STRING(1)
suggest[X][1] — Apellido sugerido. STRING(255)

Ejemplo de respuesta

{
  "suggest": [
    ["I", "DUPONT"],
    ["I", "DUPOUY"],
    ["I", "DUPORT"]
  ]
}

Errores

Tipo de error Ejemplo de solicitud Cuerpo de la respuesta
Parámetro Licence faltante, vacío o incorrecto https://{SERVER_ADDRESS}/LASTNAMESUGGEST/?Lastname=Dup&NBResponse=10
{}
Parámetro Lastname faltante o vacío https://{SERVER_ADDRESS}/LASTNAMESUGGEST/?NBResponse=10&Licence={LICENCE_CODE}
{"suggest": []}
Error tipográfico en el parámetro https://{SERVER_ADDRESS}/LASTNAMESUGGEST/?Lasname=Dup&NBResponse=10&Licence={LICENCE_CODE}
{"suggest": []}

Probar la API

Haga clic en el botón de abajo para probar este endpoint en vivo desde su navegador.

Abrir consola

Véase también

Relacionada con

¿Fue útil este artículo?

Usuarios a los que les pareció útil: 0 de 0