Genderize API

Last updated: September 14th, 2018

OVERVIEW

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.

REQUEST & RESPONSE

The API uses GET method to send request. Below you can find sample synax.

Request Method:

GET https://apineo.app/genderize/?name=John

Response "VALID"

Below you can find a "valid" response sample.

Sample Request:

GET https://apineo.app/genderize/?name=John

Result:
{
    "success": true,
    "name": "John",
    "gender": "male",
    "probability": 1,
    "execution_time_spent": 0.29395389556884766,
    "search_method": "enhanced"
}

Response "INVALID"

Below you can find an "invalid" response sample.

Sample Bad Request:

GET https://apineo.app/genderize/?name=

Result:
{
    "success": false,
    "name": "",
    "gender": "null",
    "error": "Error. Can not determine gender.",
    "execution_time_spent": 3.0994415283203125e-6
}

Response "ERROR"

Below you can find an "error" response.

Sample Bad Request:

GET https://apineo.app/genderize/?na

Result:
{
    "success": false,
    "name": "",
    "gender": "null",
    "error": "Error. Can not determine gender.",
    "execution_time_spent": 3.0994415283203125e-6
}

SAMPLE CODES

Below you can find a usage sample php code using cURL.

PHP Code Example
<?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 ...
}
?>