This API determines the gender of a person by Name and returns the gender and detection probability (0 - 1). the API detects gender of names written in most used Latin, Cyrillic and Arab languages.
The API uses GET method to send request. Below you can find sample synax.
GET
https://apineo.app/genderize/?name=John
Below you can find a "valid" response sample.
GET
https://apineo.app/genderize/?name=John
{
"success": true,
"name": "John",
"gender": "male",
"probability": 1,
"execution_time_spent": 0.29395389556884766,
"search_method": "enhanced"
}
Below you can find an "invalid" response sample.
GET
https://apineo.app/genderize/?name=
{
"success": false,
"name": "",
"gender": "null",
"error": "Error. Can not determine gender.",
"execution_time_spent": 3.0994415283203125e-6
}
Below you can find an "error" response.
GET
https://apineo.app/genderize/?na
{
"success": false,
"name": "",
"gender": "null",
"error": "Error. Can not determine gender.",
"execution_time_spent": 3.0994415283203125e-6
}
Below you can find a usage sample php code using cURL.
<?php
//Validation function using cURL
function determine_gender($name){
$ch = curl_init("https://apineo.app/genderize/?name=".$name."");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch);
curl_close($ch);
$validationResult = json_decode($json, true);
if($validationResult["gender"]!="null"){
return true;
}else{
return false;
}
}
//USAGE
if(determine_gender("John")){
//do success code ...
}else{
//do error code ...
}
?>