Dokumentacja API
Kody błędów
{
"status":false,
"errno":94,
"errmsg":"invalid or missing key",
}
errno | errmsg | Wartość |
---|---|---|
50 | access denied | Nieautoryzowany adres IP lub referer. Sprawdź swoje uprawnienia dostępu. |
90 | invalid country code | Sprawdź obsługiwane kody krajów. ISO 3166-1 alpha-2 |
91 | name not set || email not set | Brakujący parametr nazwy lub adresu e-mail w żądaniu. |
92 | too many names || too many emails | Limit wynosi 100 dla nazw i 50 dla wiadomości e-mail w jednym żądaniu. |
93 | limit reached | Kredyt klucza API został zakończony. |
94 | invalid or missing key | Nie można znaleźć klucza API. |
99 | API key has expired | Odnów swój klucz API. |
Postman
- 1. Pobierz plik konfiguracyjny Postman (kliknij prawym przyciskiem myszy link i kliknij „Zapisz jako”). Otwórz Postman, kliknij Plik->Importuj
- 2. Kliknij folder główny o nazwie „GenderAPI.io”.
- 3. Kliknij zakładkę Autoryzacja i wklej swój klucz API. Zarejestruj się i otrzymaj darmowe 200 kredytów/dzień
Imię na płeć
Pojedyncze Imię
Podstawowe użycie żądania pojedynczego Imienia
GET /api/?name=Anna&key=<YourAPIkey> HTTP/1.1
Host: api.genderapi.io
POST /api/ HTTP/1.1
Host: api.genderapi.io
Content-Type: application/x-www-form-urlencoded
name=Anna&key=<YourAPIkey>
Wybierz swój język programowania
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
POST
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.genderapi.io/api/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => 'name=abraham&key=<YourAPIkey>',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/x-www-form-urlencoded'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
$client = new Client();
$request = new Request('GET', 'https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>');
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
POST
$client = new Client();
$headers = [
'Content-Type' => 'application/x-www-form-urlencoded'
];
$options = [
'form_params' => [
'name' => 'abraham',
'key' => '<YourAPIkey>'
]];
$request = new Request('POST', 'https://api.genderapi.io/api/', $headers);
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
POST
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.genderapi.io/api/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'name' => 'maria',
'key' => '<YourAPIkey>'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' . $response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>');
$request->setRequestMethod('GET');
$request->setOptions(array());
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
POST
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://api.genderapi.io/api/');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append(new http\QueryString(array(
'name' => 'maria',
'key' => '<YourAPIkey>')));$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
import http.client
conn = http.client.HTTPSConnection("api.genderapi.io")
payload = ''
headers = {}
conn.request("GET", "/api/?name=abraham&key=<YourAPIkey>", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
POST
import http.client
conn = http.client.HTTPSConnection("api.genderapi.io")
payload = 'name=maria&key=<YourAPIkey>'
headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}
conn.request("POST", "/api/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>"
payload = {}
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
POST
import requests
url = "https://api.genderapi.io/api/"
payload = 'name=maria&key=<YourAPIkey>'
headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>")
.method("GET", body)
.build();
Response response = client.newCall(request).execute();
POST
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "name=maria&key=<YourAPIkey>");
Request request = new Request.Builder()
.url("https://api.genderapi.io/api/")
.method("POST", body)
.addHeader("Content-Type", "application/x-www-form-urlencoded")
.build();
Response response = client.newCall(request).execute();
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>")
.asString();
POST
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.genderapi.io/api/")
.header("Content-Type", "application/x-www-form-urlencoded")
.field("name", "maria")
.field("key", "<YourAPIkey>")
.asString();
var requestOptions = {
method: 'GET',
redirect: 'follow'
};
fetch("https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
POST
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
var urlencoded = new URLSearchParams();
urlencoded.append("name", "maria");
urlencoded.append("key", "<YourAPIkey>");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow'
};
fetch("https://api.genderapi.io/api/", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var settings = {
"url": "https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>",
"method": "GET",
"timeout": 0,
};
$.ajax(settings).done(function (response) {
console.log(response);
});
POST
var settings = {
"url": "https://api.genderapi.io/api/",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
"data": {
"name": "maria",
"key": "<YourAPIkey>"
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
// WARNING: For GET requests, body is set to null by browsers.
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>");
xhr.send();
POST
// WARNING: For POST requests, body is set to null by browsers.
var data = "name=maria&key=<YourAPIkey>";
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.genderapi.io/api/");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send(data);
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
POST
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.genderapi.io/api/");
var collection = new List<KeyValuePair<string, string>>();
collection.Add(new("name", "maria"));
collection.Add(new("key", "<YourAPIkey>"));
var content = new FormUrlEncodedContent(collection);
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
var options = new RestClientOptions("https://api.genderapi.io")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/?name=abraham&key=<YourAPIkey>", Method.Get);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
POST
var options = new RestClientOptions("https://api.genderapi.io")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/", Method.Post);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("name", "maria");
request.AddParameter("key", "<YourAPIkey>");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
curl --location 'https://api.genderapi.io/api/?name=abraham&key=<Your-API-Key>'
POST
curl --location 'https://api.genderapi.io/api/' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'name=maria' \
--data-urlencode 'key=<YourAPIkey>'
var dio = Dio();
var response = await dio.request(
'https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>',
options: Options(
method: 'GET',
),
);
if (response.statusCode == 200) {
print(json.encode(response.data));
}
else {
print(response.statusMessage);
}
POST
var headers = {
'Content-Type': 'application/x-www-form-urlencoded'
};
var data = {
'name': 'maria',
'key': '<YourAPIkey>'
};
var dio = Dio();
var response = await dio.request(
'https://api.genderapi.io/api/',
options: Options(
method: 'POST',
headers: headers,
),
data: data,
);
if (response.statusCode == 200) {
print(json.encode(response.data));
}
else {
print(response.statusMessage);
}
var request = http.Request('GET', Uri.parse('https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>'));
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
POST
var headers = {
'Content-Type': 'application/x-www-form-urlencoded'
};
var request = http.Request('POST', Uri.parse('https://api.genderapi.io/api/'));
request.bodyFields = {
'name': 'maria',
'key': '<YourAPIkey>'
};
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>"
method := "GET"
client := &http.Client {}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
POST
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.genderapi.io/api/"
method := "POST"
payload := strings.NewReader("name=maria&key=<YourAPIkey>")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
val client = OkHttpClient()
val request = Request.Builder()
.url("https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>")
.build()
val response = client.newCall(request).execute()
POST
val client = OkHttpClient()
val mediaType = "application/x-www-form-urlencoded".toMediaType()
val body = "name=maria&key=<YourAPIkey>".toRequestBody(mediaType)
val request = Request.Builder()
.url("https://api.genderapi.io/api/")
.post(body)
.addHeader("Content-Type", "application/x-www-form-urlencoded")
.build()
val response = client.newCall(request).execute()
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
POST
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.genderapi.io/api/");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "name=maria&key=<YourAPIkey>";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
const axios = require('axios');
let config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>',
headers: { }
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
POST
const axios = require('axios');
const qs = require('qs');
let data = qs.stringify({
'name': 'maria',
'key': '<YourAPIkey>'
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.genderapi.io/api/',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'GET',
'hostname': 'api.genderapi.io',
'path': '/api/?name=abraham&key=<YourAPIkey>',
'headers': {},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
req.end();
POST
var https = require('follow-redirects').https;
var fs = require('fs');
var qs = require('querystring');
var options = {
'method': 'POST',
'hostname': 'api.genderapi.io',
'path': '/api/',
'headers': {
'Content-Type': 'application/x-www-form-urlencoded'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = qs.stringify({
'name': 'maria',
'key': '<YourAPIkey>'
});
req.write(postData);
req.end();
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>',
'headers': {}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
POST
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.genderapi.io/api/',
'headers': {
'Content-Type': 'application/x-www-form-urlencoded'
},
form: {
'name': 'maria',
'key': '<YourAPIkey>'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
var unirest = require('unirest');
var req = unirest('GET', 'https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>')
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
});
POST
var unirest = require('unirest');
var req = unirest('POST', 'https://api.genderapi.io/api/')
.headers({
'Content-Type': 'application/x-www-form-urlencoded'
})
.send('name=maria')
.send('key=<YourAPIkey>')
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
});
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
dispatch_semaphore_signal(sema);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
POST
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.genderapi.io/api/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Content-Type": @"application/x-www-form-urlencoded"
};
[request setAllHTTPHeaderFields:headers];
NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"name=maria" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&key=<YourAPIkey>" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
dispatch_semaphore_signal(sema);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix
let reqBody =
let uri = Uri.of_string "https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>" in
Client.call `GET uri >>= fun (_resp, body) ->
body |> Cohttp_lwt.Body.to_string >|= fun body -> body
let () =
let respBody = Lwt_main.run reqBody in
print_endline (respBody)
POST
open Lwt
open Cohttp
open Cohttp_lwt_unix
let postData = ref "name=maria&key=<YourAPIkey>";;
let reqBody =
let uri = Uri.of_string "https://api.genderapi.io/api/" in
let headers = Header.init ()
|> fun h -> Header.add h "Content-Type" "application/x-www-form-urlencoded"
in
let body = Cohttp_lwt.Body.of_string !postData in
Client.call ~headers ~body `POST uri >>= fun (_resp, body) ->
body |> Cohttp_lwt.Body.to_string >|= fun body -> body
let () =
let respBody = Lwt_main.run reqBody in
print_endline (respBody)
$response = Invoke-RestMethod 'https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
POST
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/x-www-form-urlencoded")
$body = "name=maria&key=<YourAPIkey>"
$response = Invoke-RestMethod 'https://api.genderapi.io/api/' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
library(httr)
res <- VERB("GET", url = "https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>")
cat(content(res, 'text'))
POST
library(httr)
headers = c(
'Content-Type' = 'application/x-www-form-urlencoded'
)
body = list(
'name' = 'maria',
'key' = '<YourAPIkey>'
)
res <- VERB("POST", url = "https://api.genderapi.io/api/", body = body, add_headers(headers), encode = 'form')
cat(content(res, 'text'))
library(RCurl)
res <- getURL("https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>", .opts=list(followlocation = TRUE))
cat(res)
POST
library(RCurl)
headers = c(
"Content-Type" = "application/x-www-form-urlencoded"
)
params = c(
"name" = "maria",
"key" = "<YourAPIkey>"
)
res <- postForm("https://api.genderapi.io/api/", .params = params, .opts=list(httpheader = headers, followlocation = TRUE), style = "post")
cat(res)
require "uri"
require "net/http"
url = URI("https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
POST
require "uri"
require "net/http"
url = URI("https://api.genderapi.io/api/")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/x-www-form-urlencoded"
request.body = "name=maria&key=<YourAPIkey>"
response = https.request(request)
puts response.read_body
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
.build()?;
let request = client.request(reqwest::Method::GET, "https://api.genderapi.io/api/?name=abraham&key=<YourAPIkey>");
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}
POST
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
.build()?;
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("Content-Type", "application/x-www-form-urlencoded".parse()?);
let mut params = std::collections::HashMap::new();
params.insert("name", "maria");
params.insert("key", "<YourAPIkey>");
let request = client.request(reqwest::Method::POST, "https://api.genderapi.io/api/")
.headers(headers)
.form(¶ms);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}
var request = URLRequest(url: URL(string: "https://api.genderapi.io/api/?name=Anna&key=<YourAPIkey>")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}
task.resume()
POST
let parameters = "name=abraham&key=<YourAPIkey>"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.genderapi.io/api/")!,timeoutInterval: Double.infinity)
request.addValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}
task.resume()
http --follow --timeout 3600 GET 'https://api.genderapi.io/api/?name=Anna&key=<YourAPIkey>'
POST
http --ignore-stdin --form --follow --timeout 3600 POST 'https://api.genderapi.io/api/' \
'name'='abraham' \
'key'='<YourAPIkey>' \
Content-Type:'application/x-www-form-urlencoded'
wget --no-check-certificate --quiet \
--method GET \
--timeout=0 \
--header '' \
'https://api.genderapi.io/api/?name=Anna&key=<YourAPIkey>'
POST
wget --no-check-certificate --quiet \
--method POST \
--timeout=0 \
--header 'Content-Type: application/x-www-form-urlencoded' \
--body-data 'name=abraham&key=<YourAPIkey>' \
'https://api.genderapi.io/api/'
ODPOWIEDŹ
{
"status": true,
"used_credits": 1,
"remaining_credits": 7295,
"expires": 1717069765,
"q": "anna",
"name": "anna",
"gender": "female",
"country": "US",
"total_names": 80455,
"probability": 99,
"duration": "4ms"
}
Pole | Typ danych | Wartość | Wartość |
---|---|---|---|
status | Boolean | true,false | Sprawdź kody błędów, jeśli są false |
used_credits | Integer | Any | Liczba kredytów wykorzystanych w ostatnim żądaniu |
remaining_credits | Integer | Any | Liczba kredytów pozostałych do wykorzystania w ramach pakietu |
expires | Integer | Any | Data wygaśnięcia pakietu w znaczniku czasu w sekundach |
q | String | Any | Zapytanie |
name | String | Any | Znaleziona nazwa |
gender | enum[String] | ["male","female","null"] | Wynik płci |
country | enum[String] | ["US","DE","FR","IT",...] | Najczęściej napotykany kraj |
total_names | Integer | Any | Liczba próbek |
probability | Integer | 50 - 100 | Procentowe prawdopodobieństwo wyniku |
duration | String | milliseconds "4ms" | Czas przetwarzania żądania na serwerze |
Pojedyncze imię z filtrem kraju
W jednym kraju imię może być żeńskie, podczas gdy w innym kraju może być męskie.
Dodając filtr kraju do zapytań, można uzyskać informacje o płci specyficzne dla tego kraju.
Znajdź kody krajów ISO 3166-1 alpha-2
* Jeśli nie ma wyniku z podanym filtrem kraju, podamy wynik dotyczący imienia globalnego.
GET /api/?name=Anna&country=US&key=<YourAPIkey> HTTP/1.1
Host: api.genderapi.io
POST /api/ HTTP/1.1
Host: api.genderapi.io
Content-Type: application/x-www-form-urlencoded
name=Anna&country=US&key=<YourAPIkey>
Wybierz swój język programowania
ODPOWIEDŹ
{
"status": true,
"used_credits": 1,
"remaining_credits": 7295,
"expires": 1717069765,
"q": "anna",
"name": "anna",
"gender": "female",
"country": "US",
"total_names": 80455,
"probability": 99,
"duration": "4ms"
}
Pole | Typ danych | Wartość | Wartość |
---|---|---|---|
status | Boolean | true,false | Sprawdź kody błędów, jeśli są false |
used_credits | Integer | Any | Liczba kredytów wykorzystanych w ostatnim żądaniu |
remaining_credits | Integer | Any | Liczba kredytów pozostałych do wykorzystania w ramach pakietu |
expires | Integer | Any | Data wygaśnięcia pakietu w znaczniku czasu w sekundach |
q | String | Any | Zapytanie |
name | String | Any | Znaleziona nazwa |
gender | enum[String] | ["male","female","null"] | Wynik płci |
country | enum[String] | ["US","DE","FR","IT",...] | Najczęściej napotykany kraj |
total_names | Integer | Any | Liczba próbek |
probability | Integer | 50 - 100 | Procentowe prawdopodobieństwo wyniku |
duration | String | milliseconds "4ms" | Czas przetwarzania żądania na serwerze |
Wiele Imion
Można wyszukiwać wiele imion jednocześnie. Maksymalny limit to 100.
GET /api/?name[]=Anna&name[]=james&key=<YourAPIkey> HTTP/1.1
Host: api.genderapi.io
POST /api/ HTTP/1.1
Host: api.genderapi.io
Content-Type: application/x-www-form-urlencoded
name=Anna&name=james&key=<YourAPIkey>
Wybierz swój język programowania
ODPOWIEDŹ
{
"status": true,
"used_credits": 2,
"remaining_credits": 7291,
"expires": 1717069765,
"q": "anna;james brown",
"names": [
{
"name": "james",
"q": "james brown",
"gender": "male",
"country": "US",
"total_names": 70373,
"probability": 99
},
{
"name": "anna",
"q": "anna",
"gender": "female",
"country": "US",
"total_names": 80455,
"probability": 99
}
],
"duration": "2ms"
}
Pole | Typ danych | Wartość | Wartość |
---|---|---|---|
status | Boolean | true,false | Sprawdź kody błędów, jeśli są false |
used_credits | Integer | Any | Liczba kredytów wykorzystanych w ostatnim żądaniu |
remaining_credits | Integer | Any | Liczba kredytów pozostałych do wykorzystania w ramach pakietu |
expires | Integer | Any | Data wygaśnięcia pakietu w znaczniku czasu w sekundach |
names | Array | Any | Lista wyników |
duration | String | milliseconds("4ms") | Czas przetwarzania żądania na serwerze |
names(Array) | |||
---|---|---|---|
Pole | Typ danych | Wartość | Wartość |
q | String | Any | Zapytanie |
name | String | Any | Znaleziona nazwa |
gender | enum[String] | ["male","female","null"] | Wynik płci |
country | enum[String] | ["US","DE","FR","IT",...] | Najczęściej napotykany kraj |
total_names | Integer | Any | Liczba próbek |
probability | Integer | 50 - 100 | Procentowe prawdopodobieństwo wyniku |
Wiele imion z filtrem kraju
W jednym kraju imię może być żeńskie, podczas gdy w innym kraju może być męskie.
Dodając filtr kraju do zapytań, można uzyskać informacje o płci specyficzne dla tego kraju.
Znajdź kody krajów ISO 3166-1 alpha-2
* Jeśli nie ma wyniku z podanym filtrem kraju, podamy wynik dotyczący imienia globalnego.
* Można wyszukiwać wiele imion jednocześnie. Maksymalny limit to 100.
POST /api/name/multi/country HTTP/1.1
Host: api.genderapi.io
Content-Type: application/json
{
"key":"<YourAPIkey>",
"data":[
{"name":"Andrea", "country":"DE", "id":"optional"},
{"name":"andrea", "country":"IT", "id":"optional"},
{"name":"james", "country":"US", "id":"optional"}
]
}
Wybierz swój język programowania
ODPOWIEDŹ
{
"status": true,
"used_credits": 3,
"remaining_credits": 7265,
"expires": 1717069765,
"names": [
{
"name": "andrea",
"q": "Andrea",
"gender": "female",
"country": "DE",
"total_names": 644,
"probability": 88,
"id":"optional"
},
{
"name": "andrea",
"q": "andrea",
"gender": "male",
"country": "IT",
"total_names": 13537,
"probability": 98,
"id":"optional"
},
{
"name": "james",
"q": "james",
"gender": "male",
"country": "US",
"total_names": 45274,
"probability": 100,
"id":"optional"
}
],
"duration": "5ms"
}
Pole | Typ danych | Wartość | Wartość |
---|---|---|---|
status | Boolean | true,false | Sprawdź kody błędów, jeśli są false |
used_credits | Integer | Any | Liczba kredytów wykorzystanych w ostatnim żądaniu |
remaining_credits | Integer | Any | Liczba kredytów pozostałych do wykorzystania w ramach pakietu |
expires | Integer | Any | Data wygaśnięcia pakietu w znaczniku czasu w sekundach |
names | Array | Any | Lista wyników |
duration | String | milliseconds("4ms") | Czas przetwarzania żądania na serwerze |
names(Array) | |||
---|---|---|---|
Pole | Typ danych | Wartość | Wartość |
q | String | Any | Zapytanie |
name | String | Any | Znaleziona nazwa |
gender | enum[String] | ["male","female","null"] | Wynik płci |
country | enum[String] | ["US","DE","FR","IT",...] | Najczęściej napotykany kraj |
total_names | Integer | Any | Liczba próbek |
probability | Integer | 50 - 100 | Procentowe prawdopodobieństwo wyniku |
id | Any | Any | optional |
Adres e-mail na płeć
Pojedynczy E-mail
Podstawowe użycie pojedynczego zapytania e-mail
GET /api/email/?email=annarobinson@gmail.com&key=<YourAPIkey> HTTP/1.1
Host: api.genderapi.io
POST /api/email/ HTTP/1.1
Host: api.genderapi.io
Content-Type: application/x-www-form-urlencoded
email=annarobinson@gmail.com&key=<YourAPIkey>
Wybierz swój język programowania
ODPOWIEDŹ
{
"status": true,
"used_credits": 1,
"remaining_credits": 4,
"expires": 1717046468,
"q": "annarobinson@gmail.com",
"name": "anna",
"gender": "female",
"country": "US",
"total_names": 80455,
"probability": 99,
"duration": "11ms"
}
Pole | Typ danych | Wartość | Wartość |
---|---|---|---|
status | Boolean | true,false | Sprawdź kody błędów, jeśli są false |
used_credits | Integer | Any | Liczba kredytów wykorzystanych w ostatnim żądaniu |
remaining_credits | Integer | Any | Liczba kredytów pozostałych do wykorzystania w ramach pakietu |
expires | Integer | Any | Data wygaśnięcia pakietu w znaczniku czasu w sekundach |
q | String | Any | Zapytanie |
name | String | Any | Znaleziona nazwa |
gender | enum[String] | ["male","female","null"] | Wynik płci |
country | enum[String] | ["US","DE","FR","IT",...] | Najczęściej napotykany kraj |
total_names | Integer | Any | Liczba próbek |
probability | Integer | 50 - 100 | Procentowe prawdopodobieństwo wyniku |
duration | String | milliseconds "4ms" | Czas przetwarzania żądania na serwerze |
Pojedynczy e-mail z filtrem krajów
W jednym kraju imię może być żeńskie, podczas gdy w innym kraju może być męskie.
Dodając filtr kraju do zapytań, można uzyskać informacje o płci specyficzne dla tego kraju.
Znajdź kody krajów ISO 3166-1 alpha-2
* Jeśli nie ma wyniku z podanym filtrem kraju, podamy wynik dotyczący imienia globalnego.
GET /api/email/?email=annarobinson@gmail.com&country=US&key=<YourAPIkey> HTTP/1.1
Host: api.genderapi.io
POST /api/email/ HTTP/1.1
Host: api.genderapi.io
Content-Type: application/x-www-form-urlencoded
email=annarobinson@gmail.com&country=US&key=<YourAPIkey>
Wybierz swój język programowania
ODPOWIEDŹ
{
"status": true,
"used_credits": 1,
"remaining_credits": 4,
"expires": 1717046468,
"q": "annarobinson@gmail.com",
"name": "anna",
"gender": "female",
"country": "US",
"total_names": 80455,
"probability": 99,
"duration": "11ms"
}
Pole | Typ danych | Wartość | Wartość |
---|---|---|---|
status | Boolean | true,false | Sprawdź kody błędów, jeśli są false |
used_credits | Integer | Any | Liczba kredytów wykorzystanych w ostatnim żądaniu |
remaining_credits | Integer | Any | Liczba kredytów pozostałych do wykorzystania w ramach pakietu |
expires | Integer | Any | Data wygaśnięcia pakietu w znaczniku czasu w sekundach |
q | String | Any | Zapytanie |
name | String | Any | Znaleziona nazwa |
gender | enum[String] | ["male","female","null"] | Wynik płci |
country | enum[String] | ["US","DE","FR","IT",...] | Najczęściej napotykany kraj |
total_names | Integer | Any | Liczba próbek |
probability | Integer | 50 - 100 | Procentowe prawdopodobieństwo wyniku |
duration | String | milliseconds "4ms" | Czas przetwarzania żądania na serwerze |
Wiele E-maili
Możesz zapytać o wiele e-maili jednocześnie. Maksymalny limit to 50.
GET /api/email/?email[]=annarobinson@gmail.com&email[]=jameswhite@gmail.com&key=<YourAPIkey> HTTP/1.1
Host: api.genderapi.io
POST /api/email/ HTTP/1.1
Host: api.genderapi.io
Content-Type: application/x-www-form-urlencoded
email=annarobinson@gmail.com&email=jameswhite@gmail.com&key=<YourAPIkey>
Wybierz swój język programowania
ODPOWIEDŹ
{
"status": true,
"used_credits": 2,
"remaining_credits": 7276,
"expires": 1717069765,
"q": "annarobinson@mail.com;jameswhite@mail.com",
"names": [
{
"name": "anna",
"q": "annawhite@mail.com",
"gender": "female",
"country": "US",
"total_names": 80455,
"probability": 99
},
{
"name": "james",
"q": "jamesbrown@mail.com",
"gender": "male",
"country": "US",
"total_names": 70373,
"probability": 99
}
],
"duration": "4ms"
}
Pole | Typ danych | Wartość | Wartość |
---|---|---|---|
status | Boolean | true,false | Sprawdź kody błędów, jeśli są false |
used_credits | Integer | Any | Liczba kredytów wykorzystanych w ostatnim żądaniu |
remaining_credits | Integer | Any | Liczba kredytów pozostałych do wykorzystania w ramach pakietu |
expires | Integer | Any | Data wygaśnięcia pakietu w znaczniku czasu w sekundach |
names | Array | Any | Lista wyników |
duration | String | milliseconds("4ms") | Czas przetwarzania żądania na serwerze |
names(Array) | |||
---|---|---|---|
Pole | Typ danych | Wartość | Wartość |
q | String | Any | Zapytanie |
name | String | Any | Znaleziona nazwa |
gender | enum[String] | ["male","female","null"] | Wynik płci |
country | enum[String] | ["US","DE","FR","IT",...] | Najczęściej napotykany kraj |
total_names | Integer | Any | Liczba próbek |
probability | Integer | 50 - 100 | Procentowe prawdopodobieństwo wyniku |
Wiele e-maili z filtrem kraju
W jednym kraju imię może być żeńskie, podczas gdy w innym kraju może być męskie.
Dodając filtr kraju do zapytań, można uzyskać informacje o płci specyficzne dla tego kraju.
Znajdź kody krajów ISO 3166-1 alpha-2
* Jeśli nie ma wyniku z podanym filtrem kraju, podamy wynik dotyczący imienia globalnego.
* Możesz zapytać o wiele e-maili jednocześnie. Maksymalny limit to 50.
POST /api/email/multi/country HTTP/1.1
Host: api.genderapi.io
Content-Type: application/json
{
"key":"<YourAPIkey>",
"data":[
{"email":"Andreawhite@mail.com", "country":"DE", "id":"optional"},
{"email":"andreabrown@gmail.com", "country":"IT", "id":"optional"},
{"email":"jamesblack@yandex.com", "country":"US", "id":"optional"}
]
}
Wybierz swój język programowania
ODPOWIEDŹ
{
"status": true,
"used_credits": 3,
"remaining_credits": 7282,
"expires": 1717069765,
"duration": "6ms",
"names": [
{
"name": "andrea",
"q": "Andreablack@email.com",
"gender": "female",
"country": "DE",
"total_names": 644,
"probability": 88,
"id":"optional"
},
{
"name": "andrea",
"q": "andreawhite@gmail.com",
"gender": "male",
"country": "IT",
"total_names": 13537,
"probability": 98,
"id":"optional"
},
{
"name": "james",
"q": "jamesbrown@gmail.com",
"gender": "male",
"country": "US",
"total_names": 45274,
"probability": 100,
"id":"optional"
}
]
}
Pole | Typ danych | Wartość | Wartość |
---|---|---|---|
status | Boolean | true,false | Sprawdź kody błędów, jeśli są false |
used_credits | Integer | Any | Liczba kredytów wykorzystanych w ostatnim żądaniu |
remaining_credits | Integer | Any | Liczba kredytów pozostałych do wykorzystania w ramach pakietu |
expires | Integer | Any | Data wygaśnięcia pakietu w znaczniku czasu w sekundach |
names | Array | Any | Lista wyników |
duration | String | milliseconds("4ms") | Czas przetwarzania żądania na serwerze |
names(Array) | |||
---|---|---|---|
Pole | Typ danych | Wartość | Wartość |
q | String | Any | Zapytanie |
name | String | Any | Znaleziona nazwa |
gender | enum[String] | ["male","female","null"] | Wynik płci |
country | enum[String] | ["US","DE","FR","IT",...] | Najczęściej napotykany kraj |
total_names | Integer | Any | Liczba próbek |
probability | Integer | 50 - 100 | Procentowe prawdopodobieństwo wyniku |
id | Any | Any | Optional |