This API validates names of people in "FirstName LastName" format.
The API uses GET method to send request. Below you can find sample synax.
GET
https://apineo.app/name-validation?name=Firstname Lastname
Below you can find a "valid" response sample.
GET
https://apineo.app/name-validation?name=John Doe
{
"success": true,
"result": "valid",
"name": "YOUR NAME",
"execution_time_spent": 0.0001060962677002
}
Below you can find an "invalid" response sample.
GET
https://apineo.app/name-validation?name=John
{
"success": true,
"result": "invalid",
"name": "YOUR",
"info": "Only valid names are allowed.",
"valid_syntax_example": "https://apineo.app/name-validation/?name=Ion Vasilevschi",
"execution_time_spent": 4.6014785766602e-5
}
Below you can find an "error" response.
GET
https://apineo.app/name-validation?nam
{
"success": false,
"error": "Error. You must provide a name.",
"valid_syntax_example": "https://apineo.app/name-validation/?name=Ion Vasilevschi",
"execution_time_spent": 0.00013113021850586
}
Below you can find a usage sample php code using cURL.
<?php
//Validation function using cURL
function validate_name($name){
$ch = curl_init("https://apineo.app/name-validation/?name=".urlencode($name)."");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch);
curl_close($ch);
$validationResult = json_decode($json, true);
if($validationResult["result"]=="valid"){
return true;
}else{
return false;
}
}
//USAGE
if(validate_name("Firstname Lastname")){
//do success code ...
}else{
//do error code ...
}
?>