NamSor API v2
GET
Activate-deactivate anonymization for a source.
{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token
QUERY PARAMS
source
anonymized
token
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token")
require "http/client"
url = "{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/anonymize/:source/:anonymized/:token HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/anonymize/:source/:anonymized/:token',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token"]
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);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token');
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/api2/json/anonymize/:source/:anonymized/:token")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/anonymize/:source/:anonymized/:token') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token
http GET {{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/anonymize/:source/:anonymized/:token")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Activate-deactivate learning from a source.
{{baseUrl}}/api2/json/learnable/:source/:learnable/:token
QUERY PARAMS
source
learnable
token
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/learnable/:source/:learnable/:token");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/learnable/:source/:learnable/:token")
require "http/client"
url = "{{baseUrl}}/api2/json/learnable/:source/:learnable/:token"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/learnable/:source/:learnable/:token"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/learnable/:source/:learnable/:token");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/learnable/:source/:learnable/:token"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/learnable/:source/:learnable/:token HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/learnable/:source/:learnable/:token")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/learnable/:source/:learnable/:token"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/learnable/:source/:learnable/:token")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/learnable/:source/:learnable/:token")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/learnable/:source/:learnable/:token');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/learnable/:source/:learnable/:token'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/learnable/:source/:learnable/:token';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/learnable/:source/:learnable/:token',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/learnable/:source/:learnable/:token")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/learnable/:source/:learnable/:token',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/learnable/:source/:learnable/:token'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/learnable/:source/:learnable/:token');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/learnable/:source/:learnable/:token'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/learnable/:source/:learnable/:token';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/learnable/:source/:learnable/:token"]
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);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/learnable/:source/:learnable/:token" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/learnable/:source/:learnable/:token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/learnable/:source/:learnable/:token');
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/learnable/:source/:learnable/:token');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/learnable/:source/:learnable/:token');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/learnable/:source/:learnable/:token' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/learnable/:source/:learnable/:token' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/api2/json/learnable/:source/:learnable/:token")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/learnable/:source/:learnable/:token"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/learnable/:source/:learnable/:token"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/learnable/:source/:learnable/:token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/learnable/:source/:learnable/:token') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/learnable/:source/:learnable/:token";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/learnable/:source/:learnable/:token
http GET {{baseUrl}}/api2/json/learnable/:source/:learnable/:token
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/api2/json/learnable/:source/:learnable/:token
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/learnable/:source/:learnable/:token")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get the current software version
{{baseUrl}}/api2/json/softwareVersion
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/softwareVersion");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/softwareVersion")
require "http/client"
url = "{{baseUrl}}/api2/json/softwareVersion"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/softwareVersion"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/softwareVersion");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/softwareVersion"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/softwareVersion HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/softwareVersion")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/softwareVersion"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/softwareVersion")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/softwareVersion")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/softwareVersion');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/api2/json/softwareVersion'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/softwareVersion';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/softwareVersion',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/softwareVersion")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/softwareVersion',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/api2/json/softwareVersion'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/softwareVersion');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/api2/json/softwareVersion'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/softwareVersion';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/softwareVersion"]
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);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/softwareVersion" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/softwareVersion",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/softwareVersion');
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/softwareVersion');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/softwareVersion');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/softwareVersion' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/softwareVersion' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/api2/json/softwareVersion")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/softwareVersion"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/softwareVersion"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/softwareVersion")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/softwareVersion') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/softwareVersion";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/softwareVersion
http GET {{baseUrl}}/api2/json/softwareVersion
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/api2/json/softwareVersion
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/softwareVersion")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List of classification services and usage cost in Units per classification (default is 1=ONE Unit). Some API endpoints (ex. Corridor) combine multiple classifiers.
{{baseUrl}}/api2/json/apiServices
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/apiServices");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/apiServices")
require "http/client"
url = "{{baseUrl}}/api2/json/apiServices"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/apiServices"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/apiServices");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/apiServices"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/apiServices HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/apiServices")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/apiServices"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/apiServices")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/apiServices")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/apiServices');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/api2/json/apiServices'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/apiServices';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/apiServices',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/apiServices")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/apiServices',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/api2/json/apiServices'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/apiServices');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/api2/json/apiServices'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/apiServices';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/apiServices"]
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);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/apiServices" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/apiServices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/apiServices');
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/apiServices');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/apiServices');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/apiServices' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/apiServices' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/api2/json/apiServices")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/apiServices"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/apiServices"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/apiServices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/apiServices') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/apiServices";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/apiServices
http GET {{baseUrl}}/api2/json/apiServices
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/api2/json/apiServices
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/apiServices")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Print basic source statistics.
{{baseUrl}}/api2/json/regions
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/regions");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/regions")
require "http/client"
url = "{{baseUrl}}/api2/json/regions"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/regions"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/regions");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/regions"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/regions HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/regions")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/regions"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/regions")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/regions")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/regions');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/api2/json/regions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/regions';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/regions',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/regions")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/regions',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/api2/json/regions'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/regions');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/api2/json/regions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/regions';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/regions"]
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);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/regions" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/regions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/regions');
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/regions');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/regions');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/regions' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/regions' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/api2/json/regions")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/regions"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/regions"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/regions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/regions') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/regions";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/regions
http GET {{baseUrl}}/api2/json/regions
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/api2/json/regions
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/regions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Print current API usage.
{{baseUrl}}/api2/json/apiUsage
HEADERS
X-API-KEY
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/apiUsage");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/apiUsage" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/apiUsage"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/apiUsage"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/apiUsage");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/apiUsage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/apiUsage HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/apiUsage")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/apiUsage"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/apiUsage")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/apiUsage")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/apiUsage');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/apiUsage',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/apiUsage';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/apiUsage',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/apiUsage")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/apiUsage',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/apiUsage',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/apiUsage');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/apiUsage',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/apiUsage';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/apiUsage"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/apiUsage" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/apiUsage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/apiUsage', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/apiUsage');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/apiUsage');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/apiUsage' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/apiUsage' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/apiUsage", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/apiUsage"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/apiUsage"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/apiUsage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/apiUsage') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/apiUsage";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/apiUsage \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/apiUsage \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/apiUsage
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/apiUsage")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Print historical API usage (in an aggregated view, by service, by day-hour-min).
{{baseUrl}}/api2/json/apiUsageHistoryAggregate
HEADERS
X-API-KEY
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/apiUsageHistoryAggregate");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/apiUsageHistoryAggregate" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/apiUsageHistoryAggregate"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/apiUsageHistoryAggregate"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/apiUsageHistoryAggregate");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/apiUsageHistoryAggregate"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/apiUsageHistoryAggregate HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/apiUsageHistoryAggregate")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/apiUsageHistoryAggregate"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/apiUsageHistoryAggregate")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/apiUsageHistoryAggregate")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/apiUsageHistoryAggregate');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/apiUsageHistoryAggregate',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/apiUsageHistoryAggregate';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/apiUsageHistoryAggregate',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/apiUsageHistoryAggregate")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/apiUsageHistoryAggregate',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/apiUsageHistoryAggregate',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/apiUsageHistoryAggregate');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/apiUsageHistoryAggregate',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/apiUsageHistoryAggregate';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/apiUsageHistoryAggregate"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/apiUsageHistoryAggregate" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/apiUsageHistoryAggregate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/apiUsageHistoryAggregate', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/apiUsageHistoryAggregate');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/apiUsageHistoryAggregate');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/apiUsageHistoryAggregate' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/apiUsageHistoryAggregate' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/apiUsageHistoryAggregate", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/apiUsageHistoryAggregate"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/apiUsageHistoryAggregate"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/apiUsageHistoryAggregate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/apiUsageHistoryAggregate') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/apiUsageHistoryAggregate";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/apiUsageHistoryAggregate \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/apiUsageHistoryAggregate \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/apiUsageHistoryAggregate
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/apiUsageHistoryAggregate")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Print historical API usage.
{{baseUrl}}/api2/json/apiUsageHistory
HEADERS
X-API-KEY
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/apiUsageHistory");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/apiUsageHistory" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/apiUsageHistory"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/apiUsageHistory"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/apiUsageHistory");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/apiUsageHistory"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/apiUsageHistory HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/apiUsageHistory")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/apiUsageHistory"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/apiUsageHistory")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/apiUsageHistory")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/apiUsageHistory');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/apiUsageHistory',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/apiUsageHistory';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/apiUsageHistory',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/apiUsageHistory")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/apiUsageHistory',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/apiUsageHistory',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/apiUsageHistory');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/apiUsageHistory',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/apiUsageHistory';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/apiUsageHistory"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/apiUsageHistory" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/apiUsageHistory",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/apiUsageHistory', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/apiUsageHistory');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/apiUsageHistory');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/apiUsageHistory' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/apiUsageHistory' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/apiUsageHistory", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/apiUsageHistory"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/apiUsageHistory"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/apiUsageHistory")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/apiUsageHistory') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/apiUsageHistory";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/apiUsageHistory \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/apiUsageHistory \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/apiUsageHistory
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/apiUsageHistory")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Print the taxonomy classes valid for the given classifier.
{{baseUrl}}/api2/json/taxonomyClasses/:classifierName
QUERY PARAMS
classifierName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/taxonomyClasses/:classifierName");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/taxonomyClasses/:classifierName")
require "http/client"
url = "{{baseUrl}}/api2/json/taxonomyClasses/:classifierName"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/taxonomyClasses/:classifierName"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/taxonomyClasses/:classifierName");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/taxonomyClasses/:classifierName"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/taxonomyClasses/:classifierName HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/taxonomyClasses/:classifierName")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/taxonomyClasses/:classifierName"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/taxonomyClasses/:classifierName")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/taxonomyClasses/:classifierName")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/taxonomyClasses/:classifierName');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/taxonomyClasses/:classifierName'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/taxonomyClasses/:classifierName';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/taxonomyClasses/:classifierName',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/taxonomyClasses/:classifierName")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/taxonomyClasses/:classifierName',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/taxonomyClasses/:classifierName'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/taxonomyClasses/:classifierName');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/taxonomyClasses/:classifierName'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/taxonomyClasses/:classifierName';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/taxonomyClasses/:classifierName"]
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);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/taxonomyClasses/:classifierName" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/taxonomyClasses/:classifierName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/taxonomyClasses/:classifierName');
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/taxonomyClasses/:classifierName');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/taxonomyClasses/:classifierName');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/taxonomyClasses/:classifierName' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/taxonomyClasses/:classifierName' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/api2/json/taxonomyClasses/:classifierName")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/taxonomyClasses/:classifierName"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/taxonomyClasses/:classifierName"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/taxonomyClasses/:classifierName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/taxonomyClasses/:classifierName') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/taxonomyClasses/:classifierName";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/taxonomyClasses/:classifierName
http GET {{baseUrl}}/api2/json/taxonomyClasses/:classifierName
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/api2/json/taxonomyClasses/:classifierName
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/taxonomyClasses/:classifierName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Prints the current status of the classifiers. A classifier name in apiStatus corresponds to a service name in apiServices.
{{baseUrl}}/api2/json/apiStatus
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/apiStatus");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/apiStatus")
require "http/client"
url = "{{baseUrl}}/api2/json/apiStatus"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/apiStatus"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/apiStatus");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/apiStatus"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/apiStatus HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/apiStatus")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/apiStatus"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/apiStatus")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/apiStatus")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/apiStatus');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/api2/json/apiStatus'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/apiStatus';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/apiStatus',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/apiStatus")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/apiStatus',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/api2/json/apiStatus'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/apiStatus');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/api2/json/apiStatus'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/apiStatus';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/apiStatus"]
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);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/apiStatus" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/apiStatus",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/apiStatus');
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/apiStatus');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/apiStatus');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/apiStatus' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/apiStatus' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/api2/json/apiStatus")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/apiStatus"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/apiStatus"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/apiStatus")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/apiStatus') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/apiStatus";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/apiStatus
http GET {{baseUrl}}/api2/json/apiStatus
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/api2/json/apiStatus
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/apiStatus")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Read API Key info.
{{baseUrl}}/api2/json/apiKeyInfo
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/apiKeyInfo");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/apiKeyInfo")
require "http/client"
url = "{{baseUrl}}/api2/json/apiKeyInfo"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/apiKeyInfo"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/apiKeyInfo");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/apiKeyInfo"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/apiKeyInfo HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/apiKeyInfo")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/apiKeyInfo"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/apiKeyInfo")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/apiKeyInfo")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/apiKeyInfo');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/api2/json/apiKeyInfo'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/apiKeyInfo';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/apiKeyInfo',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/apiKeyInfo")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/apiKeyInfo',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/api2/json/apiKeyInfo'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/apiKeyInfo');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/api2/json/apiKeyInfo'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/apiKeyInfo';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/apiKeyInfo"]
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);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/apiKeyInfo" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/apiKeyInfo",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/apiKeyInfo');
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/apiKeyInfo');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/apiKeyInfo');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/apiKeyInfo' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/apiKeyInfo' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/api2/json/apiKeyInfo")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/apiKeyInfo"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/apiKeyInfo"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/apiKeyInfo")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/apiKeyInfo') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/apiKeyInfo";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/apiKeyInfo
http GET {{baseUrl}}/api2/json/apiKeyInfo
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/api2/json/apiKeyInfo
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/apiKeyInfo")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Identify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname) ex. Wang Xiaoming.
{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:firstName ""
:gender ""
:id ""
:lastName ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/chineseNameCandidatesGenderBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 183
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
gender: '',
id: '',
lastName: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', gender: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","gender":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "gender": "",\n "id": "",\n "lastName": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/chineseNameCandidatesGenderBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', gender: '', id: '', lastName: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', gender: '', id: '', lastName: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
gender: '',
id: '',
lastName: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', gender: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","gender":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"firstName": @"", @"gender": @"", @"id": @"", @"lastName": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'gender' => '',
'id' => '',
'lastName' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'gender' => '',
'id' => '',
'lastName' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'gender' => '',
'id' => '',
'lastName' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/chineseNameCandidatesGenderBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/chineseNameCandidatesGenderBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "gender": "",\n "id": "",\n "lastName": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/chineseNameCandidatesGenderBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Identify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname), ex. Wang Xiaoming (POST)
{{baseUrl}}/api2/json/chineseNameMatchBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name1": {
"firstName": "",
"id": "",
"lastName": ""
},
"name2": {
"id": "",
"name": ""
}
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/chineseNameMatchBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/chineseNameMatchBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:id ""
:name1 {:firstName ""
:id ""
:lastName ""}
:name2 {:id ""
:name ""}}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/chineseNameMatchBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/chineseNameMatchBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/chineseNameMatchBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/chineseNameMatchBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/chineseNameMatchBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 273
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name1": {
"firstName": "",
"id": "",
"lastName": ""
},
"name2": {
"id": "",
"name": ""
}
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/chineseNameMatchBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/chineseNameMatchBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/chineseNameMatchBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/chineseNameMatchBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name1: {
firstName: '',
id: '',
lastName: ''
},
name2: {
id: '',
name: ''
}
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/chineseNameMatchBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/chineseNameMatchBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [
{
id: '',
name1: {firstName: '', id: '', lastName: ''},
name2: {id: '', name: ''}
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/chineseNameMatchBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name1":{"firstName":"","id":"","lastName":""},"name2":{"id":"","name":""}}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/chineseNameMatchBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name1": {\n "firstName": "",\n "id": "",\n "lastName": ""\n },\n "name2": {\n "id": "",\n "name": ""\n }\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/chineseNameMatchBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/chineseNameMatchBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [
{
id: '',
name1: {firstName: '', id: '', lastName: ''},
name2: {id: '', name: ''}
}
]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/chineseNameMatchBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [
{
id: '',
name1: {firstName: '', id: '', lastName: ''},
name2: {id: '', name: ''}
}
]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/chineseNameMatchBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name1: {
firstName: '',
id: '',
lastName: ''
},
name2: {
id: '',
name: ''
}
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/chineseNameMatchBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [
{
id: '',
name1: {firstName: '', id: '', lastName: ''},
name2: {id: '', name: ''}
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/chineseNameMatchBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name1":{"firstName":"","id":"","lastName":""},"name2":{"id":"","name":""}}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"id": @"", @"name1": @{ @"firstName": @"", @"id": @"", @"lastName": @"" }, @"name2": @{ @"id": @"", @"name": @"" } } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/chineseNameMatchBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/chineseNameMatchBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/chineseNameMatchBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name1' => [
'firstName' => '',
'id' => '',
'lastName' => ''
],
'name2' => [
'id' => '',
'name' => ''
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/chineseNameMatchBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name1": {
"firstName": "",
"id": "",
"lastName": ""
},
"name2": {
"id": "",
"name": ""
}
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/chineseNameMatchBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name1' => [
'firstName' => '',
'id' => '',
'lastName' => ''
],
'name2' => [
'id' => '',
'name' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name1' => [
'firstName' => '',
'id' => '',
'lastName' => ''
],
'name2' => [
'id' => '',
'name' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/chineseNameMatchBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/chineseNameMatchBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name1": {
"firstName": "",
"id": "",
"lastName": ""
},
"name2": {
"id": "",
"name": ""
}
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/chineseNameMatchBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name1": {
"firstName": "",
"id": "",
"lastName": ""
},
"name2": {
"id": "",
"name": ""
}
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/chineseNameMatchBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/chineseNameMatchBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name1": {
"firstName": "",
"id": "",
"lastName": ""
},
"name2": {
"id": "",
"name": ""
}
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/chineseNameMatchBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/chineseNameMatchBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/chineseNameMatchBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/chineseNameMatchBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"id": "",
"name1": json!({
"firstName": "",
"id": "",
"lastName": ""
}),
"name2": json!({
"id": "",
"name": ""
})
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/chineseNameMatchBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name1": {
"firstName": "",
"id": "",
"lastName": ""
},
"name2": {
"id": "",
"name": ""
}
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name1": {
"firstName": "",
"id": "",
"lastName": ""
},
"name2": {
"id": "",
"name": ""
}
}
]
}' | \
http POST {{baseUrl}}/api2/json/chineseNameMatchBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name1": {\n "firstName": "",\n "id": "",\n "lastName": ""\n },\n "name2": {\n "id": "",\n "name": ""\n }\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/chineseNameMatchBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"id": "",
"name1": [
"firstName": "",
"id": "",
"lastName": ""
],
"name2": [
"id": "",
"name": ""
]
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/chineseNameMatchBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Identify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname), ex. Wang Xiaoming
{{baseUrl}}/api2/json/chineseNameCandidatesBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/chineseNameCandidatesBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/chineseNameCandidatesBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:firstName ""
:id ""
:lastName ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/chineseNameCandidatesBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/chineseNameCandidatesBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/chineseNameCandidatesBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/chineseNameCandidatesBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/chineseNameCandidatesBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 163
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/chineseNameCandidatesBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/chineseNameCandidatesBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/chineseNameCandidatesBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/chineseNameCandidatesBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
id: '',
lastName: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/chineseNameCandidatesBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/chineseNameCandidatesBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/chineseNameCandidatesBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/chineseNameCandidatesBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/chineseNameCandidatesBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/chineseNameCandidatesBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/chineseNameCandidatesBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/chineseNameCandidatesBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
id: '',
lastName: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/chineseNameCandidatesBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/chineseNameCandidatesBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"firstName": @"", @"id": @"", @"lastName": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/chineseNameCandidatesBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/chineseNameCandidatesBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/chineseNameCandidatesBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/chineseNameCandidatesBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/chineseNameCandidatesBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/chineseNameCandidatesBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/chineseNameCandidatesBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/chineseNameCandidatesBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/chineseNameCandidatesBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/chineseNameCandidatesBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/chineseNameCandidatesBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/chineseNameCandidatesBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/chineseNameCandidatesBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/chineseNameCandidatesBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"firstName": "",
"id": "",
"lastName": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/chineseNameCandidatesBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/chineseNameCandidatesBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/chineseNameCandidatesBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"firstName": "",
"id": "",
"lastName": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/chineseNameCandidatesBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Identify Chinese name candidates, based on the romanized name ex. Wang Xiaoming - having a known gender ('male' or 'female')
{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
chineseSurnameLatin
chineseGivenNameLatin
knownGender
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/chineseNameGenderCandidates/:chineseSurnameLatin/:chineseGivenNameLatin/:knownGender")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Identify Chinese name candidates, based on the romanized name ex. Wang Xiaoming
{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
chineseSurnameLatin
chineseGivenNameLatin
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/chineseNameCandidates/:chineseSurnameLatin/:chineseGivenNameLatin")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Infer the likely first-last name structure of a name, ex. 王晓明 -- 王(surname) 晓明(given name).
{{baseUrl}}/api2/json/parseChineseNameBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/parseChineseNameBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/parseChineseNameBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:id ""
:name ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/parseChineseNameBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/parseChineseNameBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/parseChineseNameBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/parseChineseNameBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/parseChineseNameBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 136
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/parseChineseNameBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/parseChineseNameBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/parseChineseNameBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/parseChineseNameBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/parseChineseNameBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/parseChineseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/parseChineseNameBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/parseChineseNameBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/parseChineseNameBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/parseChineseNameBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/parseChineseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/parseChineseNameBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/parseChineseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/parseChineseNameBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"id": @"", @"name": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/parseChineseNameBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/parseChineseNameBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/parseChineseNameBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/parseChineseNameBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/parseChineseNameBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/parseChineseNameBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/parseChineseNameBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/parseChineseNameBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/parseChineseNameBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/parseChineseNameBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/parseChineseNameBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/parseChineseNameBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/parseChineseNameBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/parseChineseNameBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"id": "",
"name": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/parseChineseNameBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/parseChineseNameBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/parseChineseNameBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"id": "",
"name": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/parseChineseNameBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Infer the likely first-last name structure of a name, ex. 王晓明 -- 王(surname) 晓明(given name)
{{baseUrl}}/api2/json/parseChineseName/:chineseName
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
chineseName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/parseChineseName/:chineseName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/parseChineseName/:chineseName" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/parseChineseName/:chineseName"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/parseChineseName/:chineseName"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/parseChineseName/:chineseName");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/parseChineseName/:chineseName"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/parseChineseName/:chineseName HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/parseChineseName/:chineseName")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/parseChineseName/:chineseName"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/parseChineseName/:chineseName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/parseChineseName/:chineseName")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/parseChineseName/:chineseName');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/parseChineseName/:chineseName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/parseChineseName/:chineseName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/parseChineseName/:chineseName',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/parseChineseName/:chineseName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/parseChineseName/:chineseName',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/parseChineseName/:chineseName',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/parseChineseName/:chineseName');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/parseChineseName/:chineseName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/parseChineseName/:chineseName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/parseChineseName/:chineseName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/parseChineseName/:chineseName" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/parseChineseName/:chineseName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/parseChineseName/:chineseName', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/parseChineseName/:chineseName');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/parseChineseName/:chineseName');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/parseChineseName/:chineseName' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/parseChineseName/:chineseName' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/parseChineseName/:chineseName", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/parseChineseName/:chineseName"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/parseChineseName/:chineseName"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/parseChineseName/:chineseName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/parseChineseName/:chineseName') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/parseChineseName/:chineseName";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/parseChineseName/:chineseName \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/parseChineseName/:chineseName \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/parseChineseName/:chineseName
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/parseChineseName/:chineseName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Infer the likely gender of a Chinese full name ex. 王晓明
{{baseUrl}}/api2/json/genderChineseName/:chineseName
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
chineseName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/genderChineseName/:chineseName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/genderChineseName/:chineseName" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/genderChineseName/:chineseName"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/genderChineseName/:chineseName"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/genderChineseName/:chineseName");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/genderChineseName/:chineseName"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/genderChineseName/:chineseName HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/genderChineseName/:chineseName")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/genderChineseName/:chineseName"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/genderChineseName/:chineseName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/genderChineseName/:chineseName")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/genderChineseName/:chineseName');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderChineseName/:chineseName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/genderChineseName/:chineseName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/genderChineseName/:chineseName',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/genderChineseName/:chineseName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/genderChineseName/:chineseName',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderChineseName/:chineseName',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/genderChineseName/:chineseName');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderChineseName/:chineseName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/genderChineseName/:chineseName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/genderChineseName/:chineseName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/genderChineseName/:chineseName" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/genderChineseName/:chineseName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/genderChineseName/:chineseName', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/genderChineseName/:chineseName');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/genderChineseName/:chineseName');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/genderChineseName/:chineseName' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/genderChineseName/:chineseName' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/genderChineseName/:chineseName", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/genderChineseName/:chineseName"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/genderChineseName/:chineseName"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/genderChineseName/:chineseName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/genderChineseName/:chineseName') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/genderChineseName/:chineseName";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/genderChineseName/:chineseName \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/genderChineseName/:chineseName \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/genderChineseName/:chineseName
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/genderChineseName/:chineseName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Infer the likely gender of a Chinese name in LATIN (Pinyin).
{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
chineseSurnameLatin
chineseGivenNameLatin
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/genderChineseNamePinyin/:chineseSurnameLatin/:chineseGivenNameLatin")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Infer the likely gender of up to 100 Chinese names in LATIN (Pinyin).
{{baseUrl}}/api2/json/genderChineseNamePinyinBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/genderChineseNamePinyinBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/genderChineseNamePinyinBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:firstName ""
:id ""
:lastName ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/genderChineseNamePinyinBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/genderChineseNamePinyinBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/genderChineseNamePinyinBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/genderChineseNamePinyinBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/genderChineseNamePinyinBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 163
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/genderChineseNamePinyinBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/genderChineseNamePinyinBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/genderChineseNamePinyinBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/genderChineseNamePinyinBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
id: '',
lastName: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/genderChineseNamePinyinBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderChineseNamePinyinBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/genderChineseNamePinyinBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/genderChineseNamePinyinBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/genderChineseNamePinyinBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/genderChineseNamePinyinBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderChineseNamePinyinBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/genderChineseNamePinyinBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
id: '',
lastName: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderChineseNamePinyinBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/genderChineseNamePinyinBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"firstName": @"", @"id": @"", @"lastName": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/genderChineseNamePinyinBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/genderChineseNamePinyinBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/genderChineseNamePinyinBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/genderChineseNamePinyinBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/genderChineseNamePinyinBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/genderChineseNamePinyinBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/genderChineseNamePinyinBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/genderChineseNamePinyinBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/genderChineseNamePinyinBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/genderChineseNamePinyinBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/genderChineseNamePinyinBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/genderChineseNamePinyinBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/genderChineseNamePinyinBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/genderChineseNamePinyinBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"firstName": "",
"id": "",
"lastName": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/genderChineseNamePinyinBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/genderChineseNamePinyinBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/genderChineseNamePinyinBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"firstName": "",
"id": "",
"lastName": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/genderChineseNamePinyinBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Infer the likely gender of up to 100 full names ex. 王晓明
{{baseUrl}}/api2/json/genderChineseNameBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/genderChineseNameBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/genderChineseNameBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:id ""
:name ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/genderChineseNameBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/genderChineseNameBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/genderChineseNameBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/genderChineseNameBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/genderChineseNameBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 136
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/genderChineseNameBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/genderChineseNameBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/genderChineseNameBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/genderChineseNameBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/genderChineseNameBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderChineseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/genderChineseNameBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/genderChineseNameBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/genderChineseNameBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/genderChineseNameBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderChineseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/genderChineseNameBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderChineseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/genderChineseNameBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"id": @"", @"name": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/genderChineseNameBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/genderChineseNameBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/genderChineseNameBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/genderChineseNameBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/genderChineseNameBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/genderChineseNameBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/genderChineseNameBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/genderChineseNameBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/genderChineseNameBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/genderChineseNameBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/genderChineseNameBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/genderChineseNameBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/genderChineseNameBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/genderChineseNameBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"id": "",
"name": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/genderChineseNameBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/genderChineseNameBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/genderChineseNameBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"id": "",
"name": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/genderChineseNameBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Return a score for matching Chinese name ex. 王晓明 with a romanized name ex. Wang Xiaoming
{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
chineseSurnameLatin
chineseGivenNameLatin
chineseName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/chineseNameMatch/:chineseSurnameLatin/:chineseGivenNameLatin/:chineseName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Romanize a list of Chinese name to Pinyin, ex. 王晓明 -- Wang (surname) Xiaoming (given name).
{{baseUrl}}/api2/json/pinyinChineseNameBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/pinyinChineseNameBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/pinyinChineseNameBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:id ""
:name ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/pinyinChineseNameBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/pinyinChineseNameBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/pinyinChineseNameBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/pinyinChineseNameBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/pinyinChineseNameBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 136
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/pinyinChineseNameBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/pinyinChineseNameBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/pinyinChineseNameBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/pinyinChineseNameBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/pinyinChineseNameBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/pinyinChineseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/pinyinChineseNameBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/pinyinChineseNameBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/pinyinChineseNameBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/pinyinChineseNameBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/pinyinChineseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/pinyinChineseNameBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/pinyinChineseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/pinyinChineseNameBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"id": @"", @"name": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/pinyinChineseNameBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/pinyinChineseNameBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/pinyinChineseNameBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/pinyinChineseNameBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/pinyinChineseNameBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/pinyinChineseNameBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/pinyinChineseNameBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/pinyinChineseNameBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/pinyinChineseNameBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/pinyinChineseNameBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/pinyinChineseNameBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/pinyinChineseNameBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/pinyinChineseNameBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/pinyinChineseNameBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"id": "",
"name": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/pinyinChineseNameBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/pinyinChineseNameBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/pinyinChineseNameBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"id": "",
"name": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/pinyinChineseNameBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Romanize the Chinese name to Pinyin, ex. 王晓明 -- Wang (surname) Xiaoming (given name)
{{baseUrl}}/api2/json/pinyinChineseName/:chineseName
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
chineseName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/pinyinChineseName/:chineseName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/pinyinChineseName/:chineseName" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/pinyinChineseName/:chineseName"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/pinyinChineseName/:chineseName"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/pinyinChineseName/:chineseName");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/pinyinChineseName/:chineseName"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/pinyinChineseName/:chineseName HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/pinyinChineseName/:chineseName")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/pinyinChineseName/:chineseName"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/pinyinChineseName/:chineseName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/pinyinChineseName/:chineseName")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/pinyinChineseName/:chineseName');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/pinyinChineseName/:chineseName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/pinyinChineseName/:chineseName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/pinyinChineseName/:chineseName',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/pinyinChineseName/:chineseName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/pinyinChineseName/:chineseName',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/pinyinChineseName/:chineseName',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/pinyinChineseName/:chineseName');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/pinyinChineseName/:chineseName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/pinyinChineseName/:chineseName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/pinyinChineseName/:chineseName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/pinyinChineseName/:chineseName" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/pinyinChineseName/:chineseName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/pinyinChineseName/:chineseName', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/pinyinChineseName/:chineseName');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/pinyinChineseName/:chineseName');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/pinyinChineseName/:chineseName' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/pinyinChineseName/:chineseName' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/pinyinChineseName/:chineseName", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/pinyinChineseName/:chineseName"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/pinyinChineseName/:chineseName"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/pinyinChineseName/:chineseName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/pinyinChineseName/:chineseName') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/pinyinChineseName/:chineseName";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/pinyinChineseName/:chineseName \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/pinyinChineseName/:chineseName \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/pinyinChineseName/:chineseName
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/pinyinChineseName/:chineseName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Infer the likely common type of up to 100 proper nouns (personal name, brand name, place name etc.) (POST)
{{baseUrl}}/api2/json/nameTypeGeoBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"properNouns": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/nameTypeGeoBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/nameTypeGeoBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:properNouns [{:countryIso2 ""
:id ""
:name ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/nameTypeGeoBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/nameTypeGeoBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/nameTypeGeoBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/nameTypeGeoBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/nameTypeGeoBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 159
{
"facts": [
{
"id": "",
"name": ""
}
],
"properNouns": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/nameTypeGeoBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/nameTypeGeoBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/nameTypeGeoBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/nameTypeGeoBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
properNouns: [
{
countryIso2: '',
id: '',
name: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/nameTypeGeoBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/nameTypeGeoBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
properNouns: [{countryIso2: '', id: '', name: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/nameTypeGeoBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"properNouns":[{"countryIso2":"","id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/nameTypeGeoBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "properNouns": [\n {\n "countryIso2": "",\n "id": "",\n "name": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/nameTypeGeoBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/nameTypeGeoBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
properNouns: [{countryIso2: '', id: '', name: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/nameTypeGeoBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
properNouns: [{countryIso2: '', id: '', name: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/nameTypeGeoBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
properNouns: [
{
countryIso2: '',
id: '',
name: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/nameTypeGeoBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
properNouns: [{countryIso2: '', id: '', name: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/nameTypeGeoBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"properNouns":[{"countryIso2":"","id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"properNouns": @[ @{ @"countryIso2": @"", @"id": @"", @"name": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/nameTypeGeoBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/nameTypeGeoBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/nameTypeGeoBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'properNouns' => [
[
'countryIso2' => '',
'id' => '',
'name' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/nameTypeGeoBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"properNouns": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/nameTypeGeoBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'properNouns' => [
[
'countryIso2' => '',
'id' => '',
'name' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'properNouns' => [
[
'countryIso2' => '',
'id' => '',
'name' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/nameTypeGeoBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/nameTypeGeoBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"properNouns": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/nameTypeGeoBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"properNouns": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/nameTypeGeoBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/nameTypeGeoBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"properNouns": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/nameTypeGeoBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/nameTypeGeoBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/nameTypeGeoBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/nameTypeGeoBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"properNouns": (
json!({
"countryIso2": "",
"id": "",
"name": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/nameTypeGeoBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"properNouns": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"properNouns": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/nameTypeGeoBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "properNouns": [\n {\n "countryIso2": "",\n "id": "",\n "name": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/nameTypeGeoBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"properNouns": [
[
"countryIso2": "",
"id": "",
"name": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/nameTypeGeoBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Infer the likely common type of up to 100 proper nouns (personal name, brand name, place name etc.)
{{baseUrl}}/api2/json/nameTypeBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"properNouns": [
{
"id": "",
"name": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/nameTypeBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/nameTypeBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:properNouns [{:id ""
:name ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/nameTypeBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/nameTypeBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/nameTypeBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/nameTypeBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/nameTypeBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 134
{
"facts": [
{
"id": "",
"name": ""
}
],
"properNouns": [
{
"id": "",
"name": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/nameTypeBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/nameTypeBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/nameTypeBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/nameTypeBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
properNouns: [
{
id: '',
name: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/nameTypeBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/nameTypeBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], properNouns: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/nameTypeBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"properNouns":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/nameTypeBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "properNouns": [\n {\n "id": "",\n "name": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/nameTypeBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/nameTypeBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({facts: [{id: '', name: ''}], properNouns: [{id: '', name: ''}]}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/nameTypeBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {facts: [{id: '', name: ''}], properNouns: [{id: '', name: ''}]},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/nameTypeBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
properNouns: [
{
id: '',
name: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/nameTypeBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], properNouns: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/nameTypeBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"properNouns":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"properNouns": @[ @{ @"id": @"", @"name": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/nameTypeBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/nameTypeBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/nameTypeBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'properNouns' => [
[
'id' => '',
'name' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/nameTypeBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"properNouns": [
{
"id": "",
"name": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/nameTypeBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'properNouns' => [
[
'id' => '',
'name' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'properNouns' => [
[
'id' => '',
'name' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/nameTypeBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/nameTypeBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"properNouns": [
{
"id": "",
"name": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/nameTypeBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"properNouns": [
{
"id": "",
"name": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/nameTypeBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/nameTypeBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"properNouns": [
{
"id": "",
"name": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/nameTypeBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/nameTypeBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/nameTypeBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"properNouns\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/nameTypeBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"properNouns": (
json!({
"id": "",
"name": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/nameTypeBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"properNouns": [
{
"id": "",
"name": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"properNouns": [
{
"id": "",
"name": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/nameTypeBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "properNouns": [\n {\n "id": "",\n "name": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/nameTypeBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"properNouns": [
[
"id": "",
"name": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/nameTypeBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Infer the likely type of a proper noun (personal name, brand name, place name etc.) (GET)
{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
properNoun
countryIso2
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/nameTypeGeo/:properNoun/:countryIso2 HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/nameTypeGeo/:properNoun/:countryIso2',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/nameTypeGeo/:properNoun/:countryIso2", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/nameTypeGeo/:properNoun/:countryIso2') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2 \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2 \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/nameTypeGeo/:properNoun/:countryIso2")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Infer the likely type of a proper noun (personal name, brand name, place name etc.)
{{baseUrl}}/api2/json/nameType/:properNoun
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
properNoun
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/nameType/:properNoun");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/nameType/:properNoun" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/nameType/:properNoun"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/nameType/:properNoun"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/nameType/:properNoun");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/nameType/:properNoun"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/nameType/:properNoun HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/nameType/:properNoun")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/nameType/:properNoun"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/nameType/:properNoun")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/nameType/:properNoun")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/nameType/:properNoun');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/nameType/:properNoun',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/nameType/:properNoun';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/nameType/:properNoun',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/nameType/:properNoun")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/nameType/:properNoun',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/nameType/:properNoun',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/nameType/:properNoun');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/nameType/:properNoun',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/nameType/:properNoun';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/nameType/:properNoun"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/nameType/:properNoun" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/nameType/:properNoun",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/nameType/:properNoun', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/nameType/:properNoun');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/nameType/:properNoun');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/nameType/:properNoun' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/nameType/:properNoun' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/nameType/:properNoun", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/nameType/:properNoun"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/nameType/:properNoun"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/nameType/:properNoun")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/nameType/:properNoun') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/nameType/:properNoun";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/nameType/:properNoun \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/nameType/:properNoun \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/nameType/:properNoun
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/nameType/:properNoun")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
[USES 10 UNITS PER NAME] Infer the likely Indian name castegroup of a personal full name.
{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
subDivisionIso31662
personalNameFull
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/castegroupIndianFull/:subDivisionIso31662/:personalNameFull")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
[USES 10 UNITS PER NAME] Infer the likely Indian name castegroup of up to 100 personal full names.
{{baseUrl}}/api2/json/castegroupIndianFullBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/castegroupIndianFullBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/castegroupIndianFullBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:id ""
:name ""
:subdivisionIso ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/castegroupIndianFullBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/castegroupIndianFullBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/castegroupIndianFullBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/castegroupIndianFullBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/castegroupIndianFullBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 164
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/castegroupIndianFullBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/castegroupIndianFullBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/castegroupIndianFullBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/castegroupIndianFullBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: '',
subdivisionIso: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/castegroupIndianFullBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/castegroupIndianFullBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{id: '', name: '', subdivisionIso: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/castegroupIndianFullBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":"","subdivisionIso":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/castegroupIndianFullBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": "",\n "subdivisionIso": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/castegroupIndianFullBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/castegroupIndianFullBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{id: '', name: '', subdivisionIso: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/castegroupIndianFullBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{id: '', name: '', subdivisionIso: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/castegroupIndianFullBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: '',
subdivisionIso: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/castegroupIndianFullBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{id: '', name: '', subdivisionIso: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/castegroupIndianFullBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":"","subdivisionIso":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"id": @"", @"name": @"", @"subdivisionIso": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/castegroupIndianFullBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/castegroupIndianFullBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/castegroupIndianFullBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => '',
'subdivisionIso' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/castegroupIndianFullBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/castegroupIndianFullBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => '',
'subdivisionIso' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => '',
'subdivisionIso' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/castegroupIndianFullBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/castegroupIndianFullBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/castegroupIndianFullBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/castegroupIndianFullBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/castegroupIndianFullBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/castegroupIndianFullBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/castegroupIndianFullBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/castegroupIndianFullBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/castegroupIndianFullBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"id": "",
"name": "",
"subdivisionIso": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/castegroupIndianFullBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/castegroupIndianFullBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": "",\n "subdivisionIso": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/castegroupIndianFullBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"id": "",
"name": "",
"subdivisionIso": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/castegroupIndianFullBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
[USES 10 UNITS PER NAME] Infer the likely Indian state of Union territory according to ISO 3166-2-IN based on a list of up to 100 names.
{{baseUrl}}/api2/json/subclassificationIndianBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/subclassificationIndianBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/subclassificationIndianBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:countryIso2 ""
:firstName ""
:id ""
:lastName ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/subclassificationIndianBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/subclassificationIndianBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/subclassificationIndianBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/subclassificationIndianBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/subclassificationIndianBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 188
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/subclassificationIndianBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/subclassificationIndianBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/subclassificationIndianBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/subclassificationIndianBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
countryIso2: '',
firstName: '',
id: '',
lastName: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/subclassificationIndianBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/subclassificationIndianBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/subclassificationIndianBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"countryIso2":"","firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/subclassificationIndianBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "countryIso2": "",\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/subclassificationIndianBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/subclassificationIndianBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', firstName: '', id: '', lastName: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/subclassificationIndianBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', firstName: '', id: '', lastName: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/subclassificationIndianBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
countryIso2: '',
firstName: '',
id: '',
lastName: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/subclassificationIndianBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/subclassificationIndianBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"countryIso2":"","firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"countryIso2": @"", @"firstName": @"", @"id": @"", @"lastName": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/subclassificationIndianBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/subclassificationIndianBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/subclassificationIndianBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/subclassificationIndianBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/subclassificationIndianBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/subclassificationIndianBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/subclassificationIndianBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/subclassificationIndianBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/subclassificationIndianBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/subclassificationIndianBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/subclassificationIndianBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/subclassificationIndianBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/subclassificationIndianBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/subclassificationIndianBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/subclassificationIndianBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/subclassificationIndianBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "countryIso2": "",\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/subclassificationIndianBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/subclassificationIndianBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
[USES 10 UNITS PER NAME] Infer the likely Indian state of Union territory according to ISO 3166-2-IN based on the name.
{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
firstName
lastName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/subclassificationIndian/:firstName/:lastName HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/subclassificationIndian/:firstName/:lastName',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/subclassificationIndian/:firstName/:lastName", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/subclassificationIndian/:firstName/:lastName') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/subclassificationIndian/:firstName/:lastName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
[USES 10 UNITS PER NAME] Infer the likely religion of a personal Indian full name, provided the Indian state or Union territory (NB- this can be inferred using the subclassification endpoint).
{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
subDivisionIso31662
personalNameFull
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/religionIndianFull/:subDivisionIso31662/:personalNameFull")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
[USES 10 UNITS PER NAME] Infer the likely religion of up to 100 personal full Indian names, provided the subclassification at State or Union territory level (NB- can be inferred using the subclassification endpoint).
{{baseUrl}}/api2/json/religionIndianFullBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/religionIndianFullBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/religionIndianFullBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:id ""
:name ""
:subdivisionIso ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/religionIndianFullBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/religionIndianFullBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/religionIndianFullBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/religionIndianFullBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/religionIndianFullBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 164
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/religionIndianFullBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/religionIndianFullBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/religionIndianFullBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/religionIndianFullBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: '',
subdivisionIso: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/religionIndianFullBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/religionIndianFullBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{id: '', name: '', subdivisionIso: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/religionIndianFullBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":"","subdivisionIso":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/religionIndianFullBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": "",\n "subdivisionIso": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/religionIndianFullBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/religionIndianFullBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{id: '', name: '', subdivisionIso: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/religionIndianFullBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{id: '', name: '', subdivisionIso: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/religionIndianFullBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: '',
subdivisionIso: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/religionIndianFullBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{id: '', name: '', subdivisionIso: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/religionIndianFullBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":"","subdivisionIso":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"id": @"", @"name": @"", @"subdivisionIso": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/religionIndianFullBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/religionIndianFullBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/religionIndianFullBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => '',
'subdivisionIso' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/religionIndianFullBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/religionIndianFullBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => '',
'subdivisionIso' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => '',
'subdivisionIso' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/religionIndianFullBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/religionIndianFullBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/religionIndianFullBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/religionIndianFullBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/religionIndianFullBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/religionIndianFullBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/religionIndianFullBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/religionIndianFullBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/religionIndianFullBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"id": "",
"name": "",
"subdivisionIso": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/religionIndianFullBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/religionIndianFullBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": "",\n "subdivisionIso": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/religionIndianFullBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"id": "",
"name": "",
"subdivisionIso": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/religionIndianFullBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Identify japanese name candidates in KANJI, based on the romanized name (firstName = japaneseGivenName; lastName=japaneseSurname) with KNOWN gender, ex. Yamamoto Sanae
{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:firstName ""
:gender ""
:id ""
:lastName ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/japaneseNameGenderKanjiCandidatesBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 183
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
gender: '',
id: '',
lastName: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', gender: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","gender":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "gender": "",\n "id": "",\n "lastName": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/japaneseNameGenderKanjiCandidatesBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', gender: '', id: '', lastName: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', gender: '', id: '', lastName: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
gender: '',
id: '',
lastName: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', gender: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","gender":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"firstName": @"", @"gender": @"", @"id": @"", @"lastName": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'gender' => '',
'id' => '',
'lastName' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'gender' => '',
'id' => '',
'lastName' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'gender' => '',
'id' => '',
'lastName' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/japaneseNameGenderKanjiCandidatesBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/japaneseNameGenderKanjiCandidatesBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"gender\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "gender": "",\n "id": "",\n "lastName": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"firstName": "",
"gender": "",
"id": "",
"lastName": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/japaneseNameGenderKanjiCandidatesBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Identify japanese name candidates in KANJI, based on the romanized name (firstName = japaneseGivenName; lastName=japaneseSurname), ex. Yamamoto Sanae
{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:firstName ""
:id ""
:lastName ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/japaneseNameKanjiCandidatesBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 163
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
id: '',
lastName: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/japaneseNameKanjiCandidatesBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
id: '',
lastName: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"firstName": @"", @"id": @"", @"lastName": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/japaneseNameKanjiCandidatesBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/japaneseNameKanjiCandidatesBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"firstName": "",
"id": "",
"lastName": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"firstName": "",
"id": "",
"lastName": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/japaneseNameKanjiCandidatesBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Identify japanese name candidates in KANJI, based on the romanized name ex. Yamamoto Sanae - and a known gender.
{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
japaneseSurnameLatin
japaneseGivenNameLatin
knownGender
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin/:knownGender")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Identify japanese name candidates in KANJI, based on the romanized name ex. Yamamoto Sanae
{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
japaneseSurnameLatin
japaneseGivenNameLatin
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/japaneseNameKanjiCandidates/:japaneseSurnameLatin/:japaneseGivenNameLatin")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Infer the likely first-last name structure of a name, ex. 山本 早苗 or Yamamoto Sanae (POST)
{{baseUrl}}/api2/json/parseJapaneseNameBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/parseJapaneseNameBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/parseJapaneseNameBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:id ""
:name ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/parseJapaneseNameBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/parseJapaneseNameBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/parseJapaneseNameBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/parseJapaneseNameBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/parseJapaneseNameBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 136
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/parseJapaneseNameBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/parseJapaneseNameBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/parseJapaneseNameBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/parseJapaneseNameBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/parseJapaneseNameBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/parseJapaneseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/parseJapaneseNameBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/parseJapaneseNameBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/parseJapaneseNameBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/parseJapaneseNameBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/parseJapaneseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/parseJapaneseNameBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/parseJapaneseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/parseJapaneseNameBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"id": @"", @"name": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/parseJapaneseNameBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/parseJapaneseNameBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/parseJapaneseNameBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/parseJapaneseNameBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/parseJapaneseNameBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/parseJapaneseNameBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/parseJapaneseNameBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/parseJapaneseNameBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/parseJapaneseNameBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/parseJapaneseNameBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/parseJapaneseNameBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/parseJapaneseNameBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/parseJapaneseNameBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/parseJapaneseNameBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"id": "",
"name": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/parseJapaneseNameBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/parseJapaneseNameBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/parseJapaneseNameBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"id": "",
"name": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/parseJapaneseNameBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Infer the likely first-last name structure of a name, ex. 山本 早苗 or Yamamoto Sanae
{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
japaneseName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/parseJapaneseName/:japaneseName HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/parseJapaneseName/:japaneseName',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/parseJapaneseName/:japaneseName", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/parseJapaneseName/:japaneseName') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/parseJapaneseName/:japaneseName \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/parseJapaneseName/:japaneseName \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/parseJapaneseName/:japaneseName
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/parseJapaneseName/:japaneseName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Infer the likely gender of a Japanese full name ex. 王晓明
{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
japaneseName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/genderJapaneseNameFull/:japaneseName HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/genderJapaneseNameFull/:japaneseName',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/genderJapaneseNameFull/:japaneseName", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/genderJapaneseNameFull/:japaneseName') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/genderJapaneseNameFull/:japaneseName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Infer the likely gender of a Japanese name in LATIN (Pinyin).
{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
japaneseSurname
japaneseGivenName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/genderJapaneseName/:japaneseSurname/:japaneseGivenName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Infer the likely gender of up to 100 Japanese names in LATIN (Pinyin).
{{baseUrl}}/api2/json/genderJapaneseNameBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/genderJapaneseNameBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/genderJapaneseNameBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:firstName ""
:id ""
:lastName ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/genderJapaneseNameBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/genderJapaneseNameBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/genderJapaneseNameBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/genderJapaneseNameBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/genderJapaneseNameBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 163
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/genderJapaneseNameBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/genderJapaneseNameBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/genderJapaneseNameBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/genderJapaneseNameBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
id: '',
lastName: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/genderJapaneseNameBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderJapaneseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/genderJapaneseNameBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/genderJapaneseNameBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/genderJapaneseNameBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/genderJapaneseNameBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderJapaneseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/genderJapaneseNameBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
id: '',
lastName: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderJapaneseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/genderJapaneseNameBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"firstName": @"", @"id": @"", @"lastName": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/genderJapaneseNameBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/genderJapaneseNameBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/genderJapaneseNameBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/genderJapaneseNameBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/genderJapaneseNameBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/genderJapaneseNameBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/genderJapaneseNameBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/genderJapaneseNameBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/genderJapaneseNameBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/genderJapaneseNameBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/genderJapaneseNameBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/genderJapaneseNameBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/genderJapaneseNameBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/genderJapaneseNameBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"firstName": "",
"id": "",
"lastName": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/genderJapaneseNameBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/genderJapaneseNameBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/genderJapaneseNameBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"firstName": "",
"id": "",
"lastName": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/genderJapaneseNameBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Infer the likely gender of up to 100 full names
{{baseUrl}}/api2/json/genderJapaneseNameFullBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/genderJapaneseNameFullBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/genderJapaneseNameFullBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:id ""
:name ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/genderJapaneseNameFullBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/genderJapaneseNameFullBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/genderJapaneseNameFullBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/genderJapaneseNameFullBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/genderJapaneseNameFullBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 136
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/genderJapaneseNameFullBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/genderJapaneseNameFullBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/genderJapaneseNameFullBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/genderJapaneseNameFullBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/genderJapaneseNameFullBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderJapaneseNameFullBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/genderJapaneseNameFullBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/genderJapaneseNameFullBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/genderJapaneseNameFullBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/genderJapaneseNameFullBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderJapaneseNameFullBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/genderJapaneseNameFullBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderJapaneseNameFullBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/genderJapaneseNameFullBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"id": @"", @"name": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/genderJapaneseNameFullBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/genderJapaneseNameFullBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/genderJapaneseNameFullBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/genderJapaneseNameFullBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/genderJapaneseNameFullBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/genderJapaneseNameFullBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/genderJapaneseNameFullBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/genderJapaneseNameFullBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/genderJapaneseNameFullBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/genderJapaneseNameFullBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/genderJapaneseNameFullBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/genderJapaneseNameFullBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/genderJapaneseNameFullBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/genderJapaneseNameFullBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"id": "",
"name": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/genderJapaneseNameFullBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/genderJapaneseNameFullBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/genderJapaneseNameFullBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"id": "",
"name": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/genderJapaneseNameFullBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Return a score for matching Japanese name in KANJI ex. 山本 早苗 with a romanized name ex. Yamamoto Sanae
{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
japaneseSurnameLatin
japaneseGivenNameLatin
japaneseName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/japaneseNameMatch/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Return a score for matching a list of Japanese names in KANJI ex. 山本 早苗 with romanized names ex. Yamamoto Sanae
{{baseUrl}}/api2/json/japaneseNameMatchBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name1": {
"firstName": "",
"id": "",
"lastName": ""
},
"name2": {
"id": "",
"name": ""
}
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/japaneseNameMatchBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/japaneseNameMatchBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:id ""
:name1 {:firstName ""
:id ""
:lastName ""}
:name2 {:id ""
:name ""}}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/japaneseNameMatchBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/japaneseNameMatchBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/japaneseNameMatchBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/japaneseNameMatchBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/japaneseNameMatchBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 273
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name1": {
"firstName": "",
"id": "",
"lastName": ""
},
"name2": {
"id": "",
"name": ""
}
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/japaneseNameMatchBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/japaneseNameMatchBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameMatchBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/japaneseNameMatchBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name1: {
firstName: '',
id: '',
lastName: ''
},
name2: {
id: '',
name: ''
}
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/japaneseNameMatchBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/japaneseNameMatchBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [
{
id: '',
name1: {firstName: '', id: '', lastName: ''},
name2: {id: '', name: ''}
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/japaneseNameMatchBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name1":{"firstName":"","id":"","lastName":""},"name2":{"id":"","name":""}}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/japaneseNameMatchBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name1": {\n "firstName": "",\n "id": "",\n "lastName": ""\n },\n "name2": {\n "id": "",\n "name": ""\n }\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameMatchBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/japaneseNameMatchBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [
{
id: '',
name1: {firstName: '', id: '', lastName: ''},
name2: {id: '', name: ''}
}
]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/japaneseNameMatchBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [
{
id: '',
name1: {firstName: '', id: '', lastName: ''},
name2: {id: '', name: ''}
}
]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/japaneseNameMatchBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name1: {
firstName: '',
id: '',
lastName: ''
},
name2: {
id: '',
name: ''
}
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/japaneseNameMatchBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [
{
id: '',
name1: {firstName: '', id: '', lastName: ''},
name2: {id: '', name: ''}
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/japaneseNameMatchBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name1":{"firstName":"","id":"","lastName":""},"name2":{"id":"","name":""}}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"id": @"", @"name1": @{ @"firstName": @"", @"id": @"", @"lastName": @"" }, @"name2": @{ @"id": @"", @"name": @"" } } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/japaneseNameMatchBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/japaneseNameMatchBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/japaneseNameMatchBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name1' => [
'firstName' => '',
'id' => '',
'lastName' => ''
],
'name2' => [
'id' => '',
'name' => ''
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/japaneseNameMatchBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name1": {
"firstName": "",
"id": "",
"lastName": ""
},
"name2": {
"id": "",
"name": ""
}
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/japaneseNameMatchBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name1' => [
'firstName' => '',
'id' => '',
'lastName' => ''
],
'name2' => [
'id' => '',
'name' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name1' => [
'firstName' => '',
'id' => '',
'lastName' => ''
],
'name2' => [
'id' => '',
'name' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/japaneseNameMatchBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/japaneseNameMatchBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name1": {
"firstName": "",
"id": "",
"lastName": ""
},
"name2": {
"id": "",
"name": ""
}
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/japaneseNameMatchBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name1": {
"firstName": "",
"id": "",
"lastName": ""
},
"name2": {
"id": "",
"name": ""
}
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/japaneseNameMatchBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/japaneseNameMatchBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name1": {
"firstName": "",
"id": "",
"lastName": ""
},
"name2": {
"id": "",
"name": ""
}
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/japaneseNameMatchBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/japaneseNameMatchBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/japaneseNameMatchBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name1\": {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"name2\": {\n \"id\": \"\",\n \"name\": \"\"\n }\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/japaneseNameMatchBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"id": "",
"name1": json!({
"firstName": "",
"id": "",
"lastName": ""
}),
"name2": json!({
"id": "",
"name": ""
})
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/japaneseNameMatchBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name1": {
"firstName": "",
"id": "",
"lastName": ""
},
"name2": {
"id": "",
"name": ""
}
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name1": {
"firstName": "",
"id": "",
"lastName": ""
},
"name2": {
"id": "",
"name": ""
}
}
]
}' | \
http POST {{baseUrl}}/api2/json/japaneseNameMatchBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name1": {\n "firstName": "",\n "id": "",\n "lastName": ""\n },\n "name2": {\n "id": "",\n "name": ""\n }\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/japaneseNameMatchBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"id": "",
"name1": [
"firstName": "",
"id": "",
"lastName": ""
],
"name2": [
"id": "",
"name": ""
]
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/japaneseNameMatchBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Romanize japanese name, based on the name in Kanji.
{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
japaneseSurnameKanji
japaneseGivenNameKanji
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/japaneseNameLatinCandidates/:japaneseSurnameKanji/:japaneseGivenNameKanji")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Romanize japanese names, based on the name in KANJI
{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:firstName ""
:id ""
:lastName ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/japaneseNameLatinCandidatesBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 163
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
id: '',
lastName: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/japaneseNameLatinCandidatesBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
id: '',
lastName: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"firstName": @"", @"id": @"", @"lastName": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/japaneseNameLatinCandidatesBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/japaneseNameLatinCandidatesBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"firstName": "",
"id": "",
"lastName": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"firstName": "",
"id": "",
"lastName": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/japaneseNameLatinCandidatesBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
[CREDITS 1 UNIT] Feedback loop to better perform matching Japanese name in KANJI ex. 山本 早苗 with a romanized name ex. Yamamoto Sanae
{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
japaneseSurnameLatin
japaneseGivenNameLatin
japaneseName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/japaneseNameMatchFeedbackLoop/:japaneseSurnameLatin/:japaneseGivenNameLatin/:japaneseName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Infer the likely first-last name structure of a name, ex. John Smith or SMITH, John or SMITH; John. (POST)
{{baseUrl}}/api2/json/parseNameBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/parseNameBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/parseNameBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:id ""
:name ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/parseNameBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/parseNameBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/parseNameBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/parseNameBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/parseNameBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 136
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/parseNameBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/parseNameBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/parseNameBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/parseNameBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/parseNameBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/parseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/parseNameBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/parseNameBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/parseNameBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/parseNameBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/parseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/parseNameBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/parseNameBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/parseNameBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"id": @"", @"name": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/parseNameBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/parseNameBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/parseNameBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/parseNameBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/parseNameBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/parseNameBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/parseNameBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/parseNameBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/parseNameBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/parseNameBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/parseNameBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/parseNameBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/parseNameBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/parseNameBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"id": "",
"name": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/parseNameBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/parseNameBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/parseNameBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"id": "",
"name": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/parseNameBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Infer the likely first-last name structure of a name, ex. John Smith or SMITH, John or SMITH; John. For better accuracy, provide a geographic context.
{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
nameFull
countryIso2
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/parseName/:nameFull/:countryIso2 HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/parseName/:nameFull/:countryIso2',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/parseName/:nameFull/:countryIso2", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/parseName/:nameFull/:countryIso2') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2 \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2 \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/parseName/:nameFull/:countryIso2")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Infer the likely first-last name structure of a name, ex. John Smith or SMITH, John or SMITH; John. Giving a local context improves precision.
{{baseUrl}}/api2/json/parseNameGeoBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/parseNameGeoBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/parseNameGeoBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:countryIso2 ""
:id ""
:name ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/parseNameGeoBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/parseNameGeoBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/parseNameGeoBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/parseNameGeoBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/parseNameGeoBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 161
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/parseNameGeoBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/parseNameGeoBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/parseNameGeoBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/parseNameGeoBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
countryIso2: '',
id: '',
name: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/parseNameGeoBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/parseNameGeoBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', id: '', name: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/parseNameGeoBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"countryIso2":"","id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/parseNameGeoBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "countryIso2": "",\n "id": "",\n "name": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/parseNameGeoBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/parseNameGeoBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', id: '', name: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/parseNameGeoBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', id: '', name: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/parseNameGeoBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
countryIso2: '',
id: '',
name: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/parseNameGeoBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', id: '', name: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/parseNameGeoBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"countryIso2":"","id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"countryIso2": @"", @"id": @"", @"name": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/parseNameGeoBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/parseNameGeoBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/parseNameGeoBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'id' => '',
'name' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/parseNameGeoBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/parseNameGeoBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'id' => '',
'name' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'id' => '',
'name' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/parseNameGeoBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/parseNameGeoBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/parseNameGeoBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/parseNameGeoBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/parseNameGeoBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/parseNameGeoBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/parseNameGeoBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/parseNameGeoBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/parseNameGeoBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"countryIso2": "",
"id": "",
"name": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/parseNameGeoBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/parseNameGeoBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "countryIso2": "",\n "id": "",\n "name": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/parseNameGeoBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"countryIso2": "",
"id": "",
"name": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/parseNameGeoBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Infer the likely first-last name structure of a name, ex. John Smith or SMITH, John or SMITH; John.
{{baseUrl}}/api2/json/parseName/:nameFull
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
nameFull
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/parseName/:nameFull");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/parseName/:nameFull" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/parseName/:nameFull"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/parseName/:nameFull"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/parseName/:nameFull");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/parseName/:nameFull"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/parseName/:nameFull HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/parseName/:nameFull")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/parseName/:nameFull"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/parseName/:nameFull")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/parseName/:nameFull")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/parseName/:nameFull');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/parseName/:nameFull',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/parseName/:nameFull';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/parseName/:nameFull',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/parseName/:nameFull")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/parseName/:nameFull',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/parseName/:nameFull',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/parseName/:nameFull');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/parseName/:nameFull',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/parseName/:nameFull';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/parseName/:nameFull"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/parseName/:nameFull" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/parseName/:nameFull",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/parseName/:nameFull', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/parseName/:nameFull');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/parseName/:nameFull');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/parseName/:nameFull' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/parseName/:nameFull' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/parseName/:nameFull", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/parseName/:nameFull"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/parseName/:nameFull"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/parseName/:nameFull")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/parseName/:nameFull') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/parseName/:nameFull";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/parseName/:nameFull \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/parseName/:nameFull \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/parseName/:nameFull
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/parseName/:nameFull")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Infer the likely gender of a full name, ex. John H. Smith
{{baseUrl}}/api2/json/genderFull/:fullName
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
fullName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/genderFull/:fullName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/genderFull/:fullName" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/genderFull/:fullName"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/genderFull/:fullName"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/genderFull/:fullName");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/genderFull/:fullName"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/genderFull/:fullName HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/genderFull/:fullName")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/genderFull/:fullName"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/genderFull/:fullName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/genderFull/:fullName")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/genderFull/:fullName');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderFull/:fullName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/genderFull/:fullName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/genderFull/:fullName',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/genderFull/:fullName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/genderFull/:fullName',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderFull/:fullName',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/genderFull/:fullName');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderFull/:fullName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/genderFull/:fullName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/genderFull/:fullName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/genderFull/:fullName" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/genderFull/:fullName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/genderFull/:fullName', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/genderFull/:fullName');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/genderFull/:fullName');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/genderFull/:fullName' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/genderFull/:fullName' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/genderFull/:fullName", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/genderFull/:fullName"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/genderFull/:fullName"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/genderFull/:fullName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/genderFull/:fullName') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/genderFull/:fullName";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/genderFull/:fullName \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/genderFull/:fullName \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/genderFull/:fullName
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/genderFull/:fullName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Infer the likely gender of a full name, given a local context (ISO2 country code).
{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
fullName
countryIso2
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/genderFullGeo/:fullName/:countryIso2 HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/genderFullGeo/:fullName/:countryIso2',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/genderFullGeo/:fullName/:countryIso2", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/genderFullGeo/:fullName/:countryIso2') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2 \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2 \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/genderFullGeo/:fullName/:countryIso2")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Infer the likely gender of a just a fiven name, assuming default 'US' local context. Please use preferably full names and local geographic context for better accuracy.
{{baseUrl}}/api2/json/gender/:firstName
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
firstName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/gender/:firstName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/gender/:firstName" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/gender/:firstName"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/gender/:firstName"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/gender/:firstName");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/gender/:firstName"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/gender/:firstName HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/gender/:firstName")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/gender/:firstName"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/gender/:firstName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/gender/:firstName")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/gender/:firstName');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/gender/:firstName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/gender/:firstName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/gender/:firstName',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/gender/:firstName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/gender/:firstName',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/gender/:firstName',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/gender/:firstName');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/gender/:firstName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/gender/:firstName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/gender/:firstName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/gender/:firstName" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/gender/:firstName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/gender/:firstName', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/gender/:firstName');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/gender/:firstName');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/gender/:firstName' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/gender/:firstName' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/gender/:firstName", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/gender/:firstName"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/gender/:firstName"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/gender/:firstName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/gender/:firstName') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/gender/:firstName";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/gender/:firstName \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/gender/:firstName \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/gender/:firstName
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/gender/:firstName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Infer the likely gender of a name, given a local context (ISO2 country code).
{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
firstName
lastName
countryIso2
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/genderGeo/:firstName/:lastName/:countryIso2 HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/genderGeo/:firstName/:lastName/:countryIso2',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/genderGeo/:firstName/:lastName/:countryIso2", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/genderGeo/:firstName/:lastName/:countryIso2') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2 \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2 \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/genderGeo/:firstName/:lastName/:countryIso2")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Infer the likely gender of a name.
{{baseUrl}}/api2/json/gender/:firstName/:lastName
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
firstName
lastName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/gender/:firstName/:lastName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/gender/:firstName/:lastName" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/gender/:firstName/:lastName"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/gender/:firstName/:lastName"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/gender/:firstName/:lastName");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/gender/:firstName/:lastName"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/gender/:firstName/:lastName HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/gender/:firstName/:lastName")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/gender/:firstName/:lastName"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/gender/:firstName/:lastName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/gender/:firstName/:lastName")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/gender/:firstName/:lastName');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/gender/:firstName/:lastName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/gender/:firstName/:lastName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/gender/:firstName/:lastName',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/gender/:firstName/:lastName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/gender/:firstName/:lastName',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/gender/:firstName/:lastName',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/gender/:firstName/:lastName');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/gender/:firstName/:lastName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/gender/:firstName/:lastName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/gender/:firstName/:lastName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/gender/:firstName/:lastName" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/gender/:firstName/:lastName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/gender/:firstName/:lastName', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/gender/:firstName/:lastName');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/gender/:firstName/:lastName');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/gender/:firstName/:lastName' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/gender/:firstName/:lastName' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/gender/:firstName/:lastName", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/gender/:firstName/:lastName"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/gender/:firstName/:lastName"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/gender/:firstName/:lastName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/gender/:firstName/:lastName') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/gender/:firstName/:lastName";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/gender/:firstName/:lastName \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/gender/:firstName/:lastName \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/gender/:firstName/:lastName
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/gender/:firstName/:lastName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Infer the likely gender of up to 100 full names, detecting automatically the cultural context.
{{baseUrl}}/api2/json/genderFullBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/genderFullBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/genderFullBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:id ""
:name ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/genderFullBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/genderFullBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/genderFullBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/genderFullBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/genderFullBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 136
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/genderFullBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/genderFullBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/genderFullBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/genderFullBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/genderFullBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderFullBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/genderFullBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/genderFullBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/genderFullBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/genderFullBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderFullBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/genderFullBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderFullBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/genderFullBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"id": @"", @"name": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/genderFullBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/genderFullBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/genderFullBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/genderFullBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/genderFullBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/genderFullBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/genderFullBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/genderFullBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/genderFullBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/genderFullBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/genderFullBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/genderFullBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/genderFullBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/genderFullBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"id": "",
"name": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/genderFullBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/genderFullBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/genderFullBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"id": "",
"name": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/genderFullBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Infer the likely gender of up to 100 full names, with a given cultural context (country ISO2 code).
{{baseUrl}}/api2/json/genderFullGeoBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/genderFullGeoBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/genderFullGeoBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:countryIso2 ""
:id ""
:name ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/genderFullGeoBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/genderFullGeoBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/genderFullGeoBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/genderFullGeoBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/genderFullGeoBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 161
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/genderFullGeoBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/genderFullGeoBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/genderFullGeoBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/genderFullGeoBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
countryIso2: '',
id: '',
name: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/genderFullGeoBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderFullGeoBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', id: '', name: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/genderFullGeoBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"countryIso2":"","id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/genderFullGeoBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "countryIso2": "",\n "id": "",\n "name": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/genderFullGeoBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/genderFullGeoBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', id: '', name: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderFullGeoBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', id: '', name: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/genderFullGeoBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
countryIso2: '',
id: '',
name: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderFullGeoBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', id: '', name: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/genderFullGeoBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"countryIso2":"","id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"countryIso2": @"", @"id": @"", @"name": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/genderFullGeoBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/genderFullGeoBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/genderFullGeoBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'id' => '',
'name' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/genderFullGeoBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/genderFullGeoBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'id' => '',
'name' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'id' => '',
'name' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/genderFullGeoBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/genderFullGeoBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/genderFullGeoBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/genderFullGeoBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/genderFullGeoBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/genderFullGeoBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/genderFullGeoBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/genderFullGeoBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/genderFullGeoBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"countryIso2": "",
"id": "",
"name": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/genderFullGeoBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/genderFullGeoBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "countryIso2": "",\n "id": "",\n "name": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/genderFullGeoBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"countryIso2": "",
"id": "",
"name": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/genderFullGeoBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Infer the likely gender of up to 100 names, detecting automatically the cultural context.
{{baseUrl}}/api2/json/genderBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/genderBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/genderBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:firstName ""
:id ""
:lastName ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/genderBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/genderBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/genderBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/genderBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/genderBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 163
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/genderBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/genderBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/genderBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/genderBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
id: '',
lastName: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/genderBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/genderBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/genderBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/genderBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/genderBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/genderBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
id: '',
lastName: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/genderBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"firstName": @"", @"id": @"", @"lastName": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/genderBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/genderBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/genderBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/genderBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/genderBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/genderBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/genderBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/genderBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/genderBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/genderBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/genderBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/genderBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/genderBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/genderBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"firstName": "",
"id": "",
"lastName": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/genderBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/genderBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/genderBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"firstName": "",
"id": "",
"lastName": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/genderBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Infer the likely gender of up to 100 names, each given a local context (ISO2 country code).
{{baseUrl}}/api2/json/genderGeoBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/genderGeoBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/genderGeoBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:countryIso2 ""
:firstName ""
:id ""
:lastName ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/genderGeoBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/genderGeoBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/genderGeoBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/genderGeoBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/genderGeoBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 188
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/genderGeoBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/genderGeoBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/genderGeoBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/genderGeoBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
countryIso2: '',
firstName: '',
id: '',
lastName: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/genderGeoBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderGeoBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/genderGeoBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"countryIso2":"","firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/genderGeoBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "countryIso2": "",\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/genderGeoBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/genderGeoBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', firstName: '', id: '', lastName: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderGeoBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', firstName: '', id: '', lastName: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/genderGeoBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
countryIso2: '',
firstName: '',
id: '',
lastName: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/genderGeoBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/genderGeoBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"countryIso2":"","firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"countryIso2": @"", @"firstName": @"", @"id": @"", @"lastName": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/genderGeoBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/genderGeoBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/genderGeoBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/genderGeoBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/genderGeoBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/genderGeoBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/genderGeoBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/genderGeoBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/genderGeoBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/genderGeoBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/genderGeoBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/genderGeoBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/genderGeoBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/genderGeoBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/genderGeoBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/genderGeoBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "countryIso2": "",\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/genderGeoBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/genderGeoBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
[USES 10 UNITS PER NAME] Infer the likely country of origin of a personal name. Assumes names as they are in the country of origin. For US, CA, AU, NZ and other melting-pots - use 'diaspora' instead.
{{baseUrl}}/api2/json/origin/:firstName/:lastName
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
firstName
lastName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/origin/:firstName/:lastName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/origin/:firstName/:lastName" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/origin/:firstName/:lastName"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/origin/:firstName/:lastName"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/origin/:firstName/:lastName");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/origin/:firstName/:lastName"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/origin/:firstName/:lastName HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/origin/:firstName/:lastName")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/origin/:firstName/:lastName"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/origin/:firstName/:lastName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/origin/:firstName/:lastName")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/origin/:firstName/:lastName');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/origin/:firstName/:lastName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/origin/:firstName/:lastName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/origin/:firstName/:lastName',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/origin/:firstName/:lastName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/origin/:firstName/:lastName',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/origin/:firstName/:lastName',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/origin/:firstName/:lastName');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/origin/:firstName/:lastName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/origin/:firstName/:lastName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/origin/:firstName/:lastName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/origin/:firstName/:lastName" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/origin/:firstName/:lastName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/origin/:firstName/:lastName', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/origin/:firstName/:lastName');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/origin/:firstName/:lastName');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/origin/:firstName/:lastName' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/origin/:firstName/:lastName' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/origin/:firstName/:lastName", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/origin/:firstName/:lastName"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/origin/:firstName/:lastName"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/origin/:firstName/:lastName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/origin/:firstName/:lastName') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/origin/:firstName/:lastName";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/origin/:firstName/:lastName \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/origin/:firstName/:lastName \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/origin/:firstName/:lastName
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/origin/:firstName/:lastName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
[USES 10 UNITS PER NAME] Infer the likely country of origin of up to 100 names, detecting automatically the cultural context.
{{baseUrl}}/api2/json/originBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/originBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/originBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:firstName ""
:id ""
:lastName ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/originBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/originBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/originBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/originBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/originBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 163
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/originBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/originBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/originBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/originBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
id: '',
lastName: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/originBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/originBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/originBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/originBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/originBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/originBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/originBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/originBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
firstName: '',
id: '',
lastName: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/originBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/originBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"firstName": @"", @"id": @"", @"lastName": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/originBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/originBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/originBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/originBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/originBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/originBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/originBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/originBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/originBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/originBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/originBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/originBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/originBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/originBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"firstName": "",
"id": "",
"lastName": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/originBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"firstName": "",
"id": "",
"lastName": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/originBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/originBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"firstName": "",
"id": "",
"lastName": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/originBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
[USES 10 UNITS PER NAME] Infer the likely country of residence of a personal full name, or one surname. Assumes names as they are in the country of residence OR the country of origin.
{{baseUrl}}/api2/json/country/:personalNameFull
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
personalNameFull
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/country/:personalNameFull");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/country/:personalNameFull" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/country/:personalNameFull"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/country/:personalNameFull"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/country/:personalNameFull");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/country/:personalNameFull"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/country/:personalNameFull HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/country/:personalNameFull")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/country/:personalNameFull"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/country/:personalNameFull")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/country/:personalNameFull")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/country/:personalNameFull');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/country/:personalNameFull',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/country/:personalNameFull';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/country/:personalNameFull',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/country/:personalNameFull")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/country/:personalNameFull',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/country/:personalNameFull',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/country/:personalNameFull');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/country/:personalNameFull',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/country/:personalNameFull';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/country/:personalNameFull"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/country/:personalNameFull" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/country/:personalNameFull",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/country/:personalNameFull', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/country/:personalNameFull');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/country/:personalNameFull');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/country/:personalNameFull' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/country/:personalNameFull' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/country/:personalNameFull", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/country/:personalNameFull"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/country/:personalNameFull"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/country/:personalNameFull")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/country/:personalNameFull') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/country/:personalNameFull";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/country/:personalNameFull \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/country/:personalNameFull \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/country/:personalNameFull
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/country/:personalNameFull")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
[USES 10 UNITS PER NAME] Infer the likely country of residence of up to 100 personal full names, or surnames. Assumes names as they are in the country of residence OR the country of origin.
{{baseUrl}}/api2/json/countryBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/countryBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/countryBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:id ""
:name ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/countryBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/countryBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/countryBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/countryBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/countryBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 136
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/countryBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/countryBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/countryBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/countryBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/countryBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/countryBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/countryBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/countryBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/countryBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/countryBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/countryBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/countryBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
id: '',
name: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/countryBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {facts: [{id: '', name: ''}], personalNames: [{id: '', name: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/countryBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"id": @"", @"name": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/countryBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/countryBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/countryBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/countryBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/countryBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'id' => '',
'name' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/countryBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/countryBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/countryBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/countryBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/countryBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/countryBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/countryBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/countryBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/countryBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"id": "",
"name": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/countryBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"id": "",
"name": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/countryBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "id": "",\n "name": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/countryBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"id": "",
"name": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/countryBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
[USES 10 UNITS PER NAME] Infer the likely origin of a list of up to 100 names at a country subclassification level (state or regeion). Initially, this is only supported for India (ISO2 code 'IN').
{{baseUrl}}/api2/json/subclassificationBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/subclassificationBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/subclassificationBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:countryIso2 ""
:firstName ""
:id ""
:lastName ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/subclassificationBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/subclassificationBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/subclassificationBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/subclassificationBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/subclassificationBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 188
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/subclassificationBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/subclassificationBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/subclassificationBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/subclassificationBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
countryIso2: '',
firstName: '',
id: '',
lastName: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/subclassificationBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/subclassificationBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/subclassificationBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"countryIso2":"","firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/subclassificationBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "countryIso2": "",\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/subclassificationBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/subclassificationBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', firstName: '', id: '', lastName: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/subclassificationBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', firstName: '', id: '', lastName: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/subclassificationBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
countryIso2: '',
firstName: '',
id: '',
lastName: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/subclassificationBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/subclassificationBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"countryIso2":"","firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"countryIso2": @"", @"firstName": @"", @"id": @"", @"lastName": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/subclassificationBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/subclassificationBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/subclassificationBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/subclassificationBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/subclassificationBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/subclassificationBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/subclassificationBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/subclassificationBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/subclassificationBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/subclassificationBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/subclassificationBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/subclassificationBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/subclassificationBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/subclassificationBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/subclassificationBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/subclassificationBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "countryIso2": "",\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/subclassificationBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/subclassificationBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
[USES 10 UNITS PER NAME] Infer the likely origin of a name at a country subclassification level (state or regeion). Initially, this is only supported for India (ISO2 code 'IN').
{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
countryIso2
firstName
lastName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/subclassification/:countryIso2/:firstName/:lastName HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/subclassification/:countryIso2/:firstName/:lastName',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/subclassification/:countryIso2/:firstName/:lastName", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/subclassification/:countryIso2/:firstName/:lastName') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/subclassification/:countryIso2/:firstName/:lastName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
[USES 10 UNITS PER NAME] Infer the likely religion of a personal full name. NB- only for INDIA (as of current version).
{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
countryIso2
subDivisionIso31662
personalNameFull
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/religionFull/:countryIso2/:subDivisionIso31662/:personalNameFull")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
[USES 10 UNITS PER NAME] Infer the likely religion of up to 100 personal full names. NB- only for India as of currently.
{{baseUrl}}/api2/json/religionFullBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/religionFullBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/religionFullBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:countryIso2 ""
:id ""
:name ""
:subdivisionIso ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/religionFullBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/religionFullBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/religionFullBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/religionFullBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/religionFullBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 189
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/religionFullBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/religionFullBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/religionFullBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/religionFullBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
countryIso2: '',
id: '',
name: '',
subdivisionIso: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/religionFullBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/religionFullBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', id: '', name: '', subdivisionIso: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/religionFullBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"countryIso2":"","id":"","name":"","subdivisionIso":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/religionFullBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "countryIso2": "",\n "id": "",\n "name": "",\n "subdivisionIso": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/religionFullBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/religionFullBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', id: '', name: '', subdivisionIso: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/religionFullBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', id: '', name: '', subdivisionIso: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/religionFullBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
countryIso2: '',
id: '',
name: '',
subdivisionIso: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/religionFullBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', id: '', name: '', subdivisionIso: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/religionFullBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"countryIso2":"","id":"","name":"","subdivisionIso":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"countryIso2": @"", @"id": @"", @"name": @"", @"subdivisionIso": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/religionFullBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/religionFullBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/religionFullBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'id' => '',
'name' => '',
'subdivisionIso' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/religionFullBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/religionFullBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'id' => '',
'name' => '',
'subdivisionIso' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'id' => '',
'name' => '',
'subdivisionIso' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/religionFullBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/religionFullBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/religionFullBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/religionFullBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/religionFullBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/religionFullBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/religionFullBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/religionFullBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"subdivisionIso\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/religionFullBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"countryIso2": "",
"id": "",
"name": "",
"subdivisionIso": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/religionFullBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"id": "",
"name": "",
"subdivisionIso": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/religionFullBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "countryIso2": "",\n "id": "",\n "name": "",\n "subdivisionIso": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/religionFullBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"countryIso2": "",
"id": "",
"name": "",
"subdivisionIso": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/religionFullBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
[USES 20 UNITS PER NAME COUPLE] Infer several classifications for a cross border interaction between names (ex. remit, travel, intl com)
{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
countryIso2From
firstNameFrom
lastNameFrom
countryIso2To
firstNameTo
lastNameTo
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/corridor/:countryIso2From/:firstNameFrom/:lastNameFrom/:countryIso2To/:firstNameTo/:lastNameTo")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"FirstLastNameDiasporaedOut": {
"ethnicity": "Chinese",
"ethnicityAlt": "Japanese"
}
}
POST
[USES 20 UNITS PER NAME PAIR] Infer several classifications for up to 100 cross border interaction between names (ex. remit, travel, intl com)
{{baseUrl}}/api2/json/corridorBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"corridorFromTo": [
{
"firstLastNameGeoFrom": {
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
},
"firstLastNameGeoTo": {},
"id": ""
}
],
"facts": [
{
"id": "",
"name": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/corridorBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"corridorFromTo\": [\n {\n \"firstLastNameGeoFrom\": {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"firstLastNameGeoTo\": {},\n \"id\": \"\"\n }\n ],\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/corridorBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:corridorFromTo [{:firstLastNameGeoFrom {:countryIso2 ""
:firstName ""
:id ""
:lastName ""}
:firstLastNameGeoTo {}
:id ""}]
:facts [{:id ""
:name ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/corridorBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"corridorFromTo\": [\n {\n \"firstLastNameGeoFrom\": {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"firstLastNameGeoTo\": {},\n \"id\": \"\"\n }\n ],\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/corridorBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"corridorFromTo\": [\n {\n \"firstLastNameGeoFrom\": {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"firstLastNameGeoTo\": {},\n \"id\": \"\"\n }\n ],\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/corridorBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"corridorFromTo\": [\n {\n \"firstLastNameGeoFrom\": {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"firstLastNameGeoTo\": {},\n \"id\": \"\"\n }\n ],\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/corridorBatch"
payload := strings.NewReader("{\n \"corridorFromTo\": [\n {\n \"firstLastNameGeoFrom\": {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"firstLastNameGeoTo\": {},\n \"id\": \"\"\n }\n ],\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/corridorBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 285
{
"corridorFromTo": [
{
"firstLastNameGeoFrom": {
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
},
"firstLastNameGeoTo": {},
"id": ""
}
],
"facts": [
{
"id": "",
"name": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/corridorBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"corridorFromTo\": [\n {\n \"firstLastNameGeoFrom\": {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"firstLastNameGeoTo\": {},\n \"id\": \"\"\n }\n ],\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/corridorBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"corridorFromTo\": [\n {\n \"firstLastNameGeoFrom\": {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"firstLastNameGeoTo\": {},\n \"id\": \"\"\n }\n ],\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"corridorFromTo\": [\n {\n \"firstLastNameGeoFrom\": {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"firstLastNameGeoTo\": {},\n \"id\": \"\"\n }\n ],\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/corridorBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/corridorBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"corridorFromTo\": [\n {\n \"firstLastNameGeoFrom\": {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"firstLastNameGeoTo\": {},\n \"id\": \"\"\n }\n ],\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
corridorFromTo: [
{
firstLastNameGeoFrom: {
countryIso2: '',
firstName: '',
id: '',
lastName: ''
},
firstLastNameGeoTo: {},
id: ''
}
],
facts: [
{
id: '',
name: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/corridorBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/corridorBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
corridorFromTo: [
{
firstLastNameGeoFrom: {countryIso2: '', firstName: '', id: '', lastName: ''},
firstLastNameGeoTo: {},
id: ''
}
],
facts: [{id: '', name: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/corridorBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"corridorFromTo":[{"firstLastNameGeoFrom":{"countryIso2":"","firstName":"","id":"","lastName":""},"firstLastNameGeoTo":{},"id":""}],"facts":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/corridorBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "corridorFromTo": [\n {\n "firstLastNameGeoFrom": {\n "countryIso2": "",\n "firstName": "",\n "id": "",\n "lastName": ""\n },\n "firstLastNameGeoTo": {},\n "id": ""\n }\n ],\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"corridorFromTo\": [\n {\n \"firstLastNameGeoFrom\": {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"firstLastNameGeoTo\": {},\n \"id\": \"\"\n }\n ],\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/corridorBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/corridorBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
corridorFromTo: [
{
firstLastNameGeoFrom: {countryIso2: '', firstName: '', id: '', lastName: ''},
firstLastNameGeoTo: {},
id: ''
}
],
facts: [{id: '', name: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/corridorBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
corridorFromTo: [
{
firstLastNameGeoFrom: {countryIso2: '', firstName: '', id: '', lastName: ''},
firstLastNameGeoTo: {},
id: ''
}
],
facts: [{id: '', name: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/corridorBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
corridorFromTo: [
{
firstLastNameGeoFrom: {
countryIso2: '',
firstName: '',
id: '',
lastName: ''
},
firstLastNameGeoTo: {},
id: ''
}
],
facts: [
{
id: '',
name: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/corridorBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
corridorFromTo: [
{
firstLastNameGeoFrom: {countryIso2: '', firstName: '', id: '', lastName: ''},
firstLastNameGeoTo: {},
id: ''
}
],
facts: [{id: '', name: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/corridorBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"corridorFromTo":[{"firstLastNameGeoFrom":{"countryIso2":"","firstName":"","id":"","lastName":""},"firstLastNameGeoTo":{},"id":""}],"facts":[{"id":"","name":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"corridorFromTo": @[ @{ @"firstLastNameGeoFrom": @{ @"countryIso2": @"", @"firstName": @"", @"id": @"", @"lastName": @"" }, @"firstLastNameGeoTo": @{ }, @"id": @"" } ],
@"facts": @[ @{ @"id": @"", @"name": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/corridorBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/corridorBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"corridorFromTo\": [\n {\n \"firstLastNameGeoFrom\": {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"firstLastNameGeoTo\": {},\n \"id\": \"\"\n }\n ],\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/corridorBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'corridorFromTo' => [
[
'firstLastNameGeoFrom' => [
'countryIso2' => '',
'firstName' => '',
'id' => '',
'lastName' => ''
],
'firstLastNameGeoTo' => [
],
'id' => ''
]
],
'facts' => [
[
'id' => '',
'name' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/corridorBatch', [
'body' => '{
"corridorFromTo": [
{
"firstLastNameGeoFrom": {
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
},
"firstLastNameGeoTo": {},
"id": ""
}
],
"facts": [
{
"id": "",
"name": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/corridorBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'corridorFromTo' => [
[
'firstLastNameGeoFrom' => [
'countryIso2' => '',
'firstName' => '',
'id' => '',
'lastName' => ''
],
'firstLastNameGeoTo' => [
],
'id' => ''
]
],
'facts' => [
[
'id' => '',
'name' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'corridorFromTo' => [
[
'firstLastNameGeoFrom' => [
'countryIso2' => '',
'firstName' => '',
'id' => '',
'lastName' => ''
],
'firstLastNameGeoTo' => [
],
'id' => ''
]
],
'facts' => [
[
'id' => '',
'name' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/corridorBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/corridorBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"corridorFromTo": [
{
"firstLastNameGeoFrom": {
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
},
"firstLastNameGeoTo": {},
"id": ""
}
],
"facts": [
{
"id": "",
"name": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/corridorBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"corridorFromTo": [
{
"firstLastNameGeoFrom": {
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
},
"firstLastNameGeoTo": {},
"id": ""
}
],
"facts": [
{
"id": "",
"name": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"corridorFromTo\": [\n {\n \"firstLastNameGeoFrom\": {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"firstLastNameGeoTo\": {},\n \"id\": \"\"\n }\n ],\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/corridorBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/corridorBatch"
payload = {
"corridorFromTo": [
{
"firstLastNameGeoFrom": {
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
},
"firstLastNameGeoTo": {},
"id": ""
}
],
"facts": [
{
"id": "",
"name": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/corridorBatch"
payload <- "{\n \"corridorFromTo\": [\n {\n \"firstLastNameGeoFrom\": {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"firstLastNameGeoTo\": {},\n \"id\": \"\"\n }\n ],\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/corridorBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"corridorFromTo\": [\n {\n \"firstLastNameGeoFrom\": {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"firstLastNameGeoTo\": {},\n \"id\": \"\"\n }\n ],\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/corridorBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"corridorFromTo\": [\n {\n \"firstLastNameGeoFrom\": {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n },\n \"firstLastNameGeoTo\": {},\n \"id\": \"\"\n }\n ],\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/corridorBatch";
let payload = json!({
"corridorFromTo": (
json!({
"firstLastNameGeoFrom": json!({
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}),
"firstLastNameGeoTo": json!({}),
"id": ""
})
),
"facts": (
json!({
"id": "",
"name": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/corridorBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"corridorFromTo": [
{
"firstLastNameGeoFrom": {
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
},
"firstLastNameGeoTo": {},
"id": ""
}
],
"facts": [
{
"id": "",
"name": ""
}
]
}'
echo '{
"corridorFromTo": [
{
"firstLastNameGeoFrom": {
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
},
"firstLastNameGeoTo": {},
"id": ""
}
],
"facts": [
{
"id": "",
"name": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/corridorBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "corridorFromTo": [\n {\n "firstLastNameGeoFrom": {\n "countryIso2": "",\n "firstName": "",\n "id": "",\n "lastName": ""\n },\n "firstLastNameGeoTo": {},\n "id": ""\n }\n ],\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/corridorBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"corridorFromTo": [
[
"firstLastNameGeoFrom": [
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
],
"firstLastNameGeoTo": [],
"id": ""
]
],
"facts": [
[
"id": "",
"name": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/corridorBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
[USES 20 UNITS PER NAME] Infer the likely ethnicity-diaspora of a personal name, given a country of residence ISO2 code (ex. US, CA, AU, NZ etc.)
{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
countryIso2
firstName
lastName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/diaspora/:countryIso2/:firstName/:lastName HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/diaspora/:countryIso2/:firstName/:lastName',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/diaspora/:countryIso2/:firstName/:lastName", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/diaspora/:countryIso2/:firstName/:lastName') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/diaspora/:countryIso2/:firstName/:lastName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"ethnicity": "Chinese",
"ethnicityAlt": "Japanese"
}
POST
[USES 20 UNITS PER NAME] Infer the likely ethnicity-diaspora of up to 100 personal names, given a country of residence ISO2 code (ex. US, CA, AU, NZ etc.)
{{baseUrl}}/api2/json/diasporaBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/diasporaBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/diasporaBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNames [{:countryIso2 ""
:firstName ""
:id ""
:lastName ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/diasporaBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/diasporaBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/diasporaBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/diasporaBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/diasporaBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 188
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/diasporaBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/diasporaBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/diasporaBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/diasporaBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
countryIso2: '',
firstName: '',
id: '',
lastName: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/diasporaBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/diasporaBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/diasporaBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"countryIso2":"","firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/diasporaBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "countryIso2": "",\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/diasporaBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/diasporaBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', firstName: '', id: '', lastName: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/diasporaBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', firstName: '', id: '', lastName: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/diasporaBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNames: [
{
countryIso2: '',
firstName: '',
id: '',
lastName: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/diasporaBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNames: [{countryIso2: '', firstName: '', id: '', lastName: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/diasporaBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNames":[{"countryIso2":"","firstName":"","id":"","lastName":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNames": @[ @{ @"countryIso2": @"", @"firstName": @"", @"id": @"", @"lastName": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/diasporaBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/diasporaBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/diasporaBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/diasporaBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/diasporaBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNames' => [
[
'countryIso2' => '',
'firstName' => '',
'id' => '',
'lastName' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/diasporaBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/diasporaBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/diasporaBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/diasporaBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/diasporaBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/diasporaBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/diasporaBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/diasporaBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNames\": [\n {\n \"countryIso2\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/diasporaBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNames": (
json!({
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/diasporaBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNames": [
{
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/diasporaBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNames": [\n {\n "countryIso2": "",\n "firstName": "",\n "id": "",\n "lastName": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/diasporaBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNames": [
[
"countryIso2": "",
"firstName": "",
"id": "",
"lastName": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/diasporaBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
[CREDITS 1 UNIT] Feedback loop to better infer the likely phone prefix, given a personal name and formatted - unformatted phone number, with a local context (ISO2 country of residence).
{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
firstName
lastName
phoneNumber
phoneNumberE164
countryIso2
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2 HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2 \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2 \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/phoneCodeGeoFeedbackLoop/:firstName/:lastName/:phoneNumber/:phoneNumberE164/:countryIso2")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
[USES 11 UNITS PER NAME] Infer the likely country and phone prefix, given a personal name and formatted - unformatted phone number.
{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
firstName
lastName
phoneNumber
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/phoneCode/:firstName/:lastName/:phoneNumber HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/phoneCode/:firstName/:lastName/:phoneNumber',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/phoneCode/:firstName/:lastName/:phoneNumber", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/phoneCode/:firstName/:lastName/:phoneNumber') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/phoneCode/:firstName/:lastName/:phoneNumber")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
[USES 11 UNITS PER NAME] Infer the likely country and phone prefix, of up to 100 personal names, detecting automatically the local context given a name and formatted - unformatted phone number.
{{baseUrl}}/api2/json/phoneCodeBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNamesWithPhoneNumbers": [
{
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/phoneCodeBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/phoneCodeBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNamesWithPhoneNumbers [{:firstName ""
:id ""
:lastName ""
:phoneNumber ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/phoneCodeBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/phoneCodeBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/phoneCodeBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/phoneCodeBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/phoneCodeBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 204
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNamesWithPhoneNumbers": [
{
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/phoneCodeBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/phoneCodeBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/phoneCodeBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/phoneCodeBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNamesWithPhoneNumbers: [
{
firstName: '',
id: '',
lastName: '',
phoneNumber: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/phoneCodeBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/phoneCodeBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNamesWithPhoneNumbers: [{firstName: '', id: '', lastName: '', phoneNumber: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/phoneCodeBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNamesWithPhoneNumbers":[{"firstName":"","id":"","lastName":"","phoneNumber":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/phoneCodeBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNamesWithPhoneNumbers": [\n {\n "firstName": "",\n "id": "",\n "lastName": "",\n "phoneNumber": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/phoneCodeBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/phoneCodeBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNamesWithPhoneNumbers: [{firstName: '', id: '', lastName: '', phoneNumber: ''}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/phoneCodeBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNamesWithPhoneNumbers: [{firstName: '', id: '', lastName: '', phoneNumber: ''}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/phoneCodeBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNamesWithPhoneNumbers: [
{
firstName: '',
id: '',
lastName: '',
phoneNumber: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/phoneCodeBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNamesWithPhoneNumbers: [{firstName: '', id: '', lastName: '', phoneNumber: ''}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/phoneCodeBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNamesWithPhoneNumbers":[{"firstName":"","id":"","lastName":"","phoneNumber":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNamesWithPhoneNumbers": @[ @{ @"firstName": @"", @"id": @"", @"lastName": @"", @"phoneNumber": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/phoneCodeBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/phoneCodeBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/phoneCodeBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNamesWithPhoneNumbers' => [
[
'firstName' => '',
'id' => '',
'lastName' => '',
'phoneNumber' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/phoneCodeBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNamesWithPhoneNumbers": [
{
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/phoneCodeBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNamesWithPhoneNumbers' => [
[
'firstName' => '',
'id' => '',
'lastName' => '',
'phoneNumber' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNamesWithPhoneNumbers' => [
[
'firstName' => '',
'id' => '',
'lastName' => '',
'phoneNumber' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/phoneCodeBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/phoneCodeBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNamesWithPhoneNumbers": [
{
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/phoneCodeBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNamesWithPhoneNumbers": [
{
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/phoneCodeBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/phoneCodeBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNamesWithPhoneNumbers": [
{
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/phoneCodeBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/phoneCodeBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/phoneCodeBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/phoneCodeBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNamesWithPhoneNumbers": (
json!({
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/phoneCodeBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNamesWithPhoneNumbers": [
{
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNamesWithPhoneNumbers": [
{
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/phoneCodeBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNamesWithPhoneNumbers": [\n {\n "firstName": "",\n "id": "",\n "lastName": "",\n "phoneNumber": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/phoneCodeBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNamesWithPhoneNumbers": [
[
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/phoneCodeBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
[USES 11 UNITS PER NAME] Infer the likely country and phone prefix, of up to 100 personal names, with a local context (ISO2 country of residence).
{{baseUrl}}/api2/json/phoneCodeGeoBatch
HEADERS
X-API-KEY
{{apiKey}}
BODY json
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNamesWithPhoneNumbers": [
{
"countryIso2": "",
"countryIso2Alt": "",
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/phoneCodeGeoBatch");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"countryIso2\": \"\",\n \"countryIso2Alt\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/api2/json/phoneCodeGeoBatch" {:headers {:x-api-key "{{apiKey}}"}
:content-type :json
:form-params {:facts [{:id ""
:name ""}]
:personalNamesWithPhoneNumbers [{:countryIso2 ""
:countryIso2Alt ""
:firstName ""
:id ""
:lastName ""
:phoneNumber ""}]}})
require "http/client"
url = "{{baseUrl}}/api2/json/phoneCodeGeoBatch"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"countryIso2\": \"\",\n \"countryIso2Alt\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/api2/json/phoneCodeGeoBatch"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
Content = new StringContent("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"countryIso2\": \"\",\n \"countryIso2Alt\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/phoneCodeGeoBatch");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-api-key", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"countryIso2\": \"\",\n \"countryIso2Alt\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/phoneCodeGeoBatch"
payload := strings.NewReader("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"countryIso2\": \"\",\n \"countryIso2Alt\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/api2/json/phoneCodeGeoBatch HTTP/1.1
X-Api-Key: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 257
{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNamesWithPhoneNumbers": [
{
"countryIso2": "",
"countryIso2Alt": "",
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/api2/json/phoneCodeGeoBatch")
.setHeader("x-api-key", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"countryIso2\": \"\",\n \"countryIso2Alt\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/phoneCodeGeoBatch"))
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"countryIso2\": \"\",\n \"countryIso2Alt\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"countryIso2\": \"\",\n \"countryIso2Alt\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/phoneCodeGeoBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/api2/json/phoneCodeGeoBatch")
.header("x-api-key", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"countryIso2\": \"\",\n \"countryIso2Alt\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
facts: [
{
id: '',
name: ''
}
],
personalNamesWithPhoneNumbers: [
{
countryIso2: '',
countryIso2Alt: '',
firstName: '',
id: '',
lastName: '',
phoneNumber: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/api2/json/phoneCodeGeoBatch');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/phoneCodeGeoBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNamesWithPhoneNumbers: [
{
countryIso2: '',
countryIso2Alt: '',
firstName: '',
id: '',
lastName: '',
phoneNumber: ''
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/phoneCodeGeoBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNamesWithPhoneNumbers":[{"countryIso2":"","countryIso2Alt":"","firstName":"","id":"","lastName":"","phoneNumber":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/phoneCodeGeoBatch',
method: 'POST',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNamesWithPhoneNumbers": [\n {\n "countryIso2": "",\n "countryIso2Alt": "",\n "firstName": "",\n "id": "",\n "lastName": "",\n "phoneNumber": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"countryIso2\": \"\",\n \"countryIso2Alt\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/phoneCodeGeoBatch")
.post(body)
.addHeader("x-api-key", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/phoneCodeGeoBatch',
headers: {
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
facts: [{id: '', name: ''}],
personalNamesWithPhoneNumbers: [
{
countryIso2: '',
countryIso2Alt: '',
firstName: '',
id: '',
lastName: '',
phoneNumber: ''
}
]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/phoneCodeGeoBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: {
facts: [{id: '', name: ''}],
personalNamesWithPhoneNumbers: [
{
countryIso2: '',
countryIso2Alt: '',
firstName: '',
id: '',
lastName: '',
phoneNumber: ''
}
]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/api2/json/phoneCodeGeoBatch');
req.headers({
'x-api-key': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
facts: [
{
id: '',
name: ''
}
],
personalNamesWithPhoneNumbers: [
{
countryIso2: '',
countryIso2Alt: '',
firstName: '',
id: '',
lastName: '',
phoneNumber: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/api2/json/phoneCodeGeoBatch',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
data: {
facts: [{id: '', name: ''}],
personalNamesWithPhoneNumbers: [
{
countryIso2: '',
countryIso2Alt: '',
firstName: '',
id: '',
lastName: '',
phoneNumber: ''
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/phoneCodeGeoBatch';
const options = {
method: 'POST',
headers: {'x-api-key': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"facts":[{"id":"","name":""}],"personalNamesWithPhoneNumbers":[{"countryIso2":"","countryIso2Alt":"","firstName":"","id":"","lastName":"","phoneNumber":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"facts": @[ @{ @"id": @"", @"name": @"" } ],
@"personalNamesWithPhoneNumbers": @[ @{ @"countryIso2": @"", @"countryIso2Alt": @"", @"firstName": @"", @"id": @"", @"lastName": @"", @"phoneNumber": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/phoneCodeGeoBatch"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/phoneCodeGeoBatch" in
let headers = Header.add_list (Header.init ()) [
("x-api-key", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"countryIso2\": \"\",\n \"countryIso2Alt\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/phoneCodeGeoBatch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNamesWithPhoneNumbers' => [
[
'countryIso2' => '',
'countryIso2Alt' => '',
'firstName' => '',
'id' => '',
'lastName' => '',
'phoneNumber' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/api2/json/phoneCodeGeoBatch', [
'body' => '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNamesWithPhoneNumbers": [
{
"countryIso2": "",
"countryIso2Alt": "",
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/phoneCodeGeoBatch');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNamesWithPhoneNumbers' => [
[
'countryIso2' => '',
'countryIso2Alt' => '',
'firstName' => '',
'id' => '',
'lastName' => '',
'phoneNumber' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'facts' => [
[
'id' => '',
'name' => ''
]
],
'personalNamesWithPhoneNumbers' => [
[
'countryIso2' => '',
'countryIso2Alt' => '',
'firstName' => '',
'id' => '',
'lastName' => '',
'phoneNumber' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/api2/json/phoneCodeGeoBatch');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-api-key' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/phoneCodeGeoBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNamesWithPhoneNumbers": [
{
"countryIso2": "",
"countryIso2Alt": "",
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
}
]
}'
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/phoneCodeGeoBatch' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNamesWithPhoneNumbers": [
{
"countryIso2": "",
"countryIso2Alt": "",
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"countryIso2\": \"\",\n \"countryIso2Alt\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}"
headers = {
'x-api-key': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/api2/json/phoneCodeGeoBatch", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/phoneCodeGeoBatch"
payload = {
"facts": [
{
"id": "",
"name": ""
}
],
"personalNamesWithPhoneNumbers": [
{
"countryIso2": "",
"countryIso2Alt": "",
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
}
]
}
headers = {
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/phoneCodeGeoBatch"
payload <- "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"countryIso2\": \"\",\n \"countryIso2Alt\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/phoneCodeGeoBatch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"countryIso2\": \"\",\n \"countryIso2Alt\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/api2/json/phoneCodeGeoBatch') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
req.body = "{\n \"facts\": [\n {\n \"id\": \"\",\n \"name\": \"\"\n }\n ],\n \"personalNamesWithPhoneNumbers\": [\n {\n \"countryIso2\": \"\",\n \"countryIso2Alt\": \"\",\n \"firstName\": \"\",\n \"id\": \"\",\n \"lastName\": \"\",\n \"phoneNumber\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/phoneCodeGeoBatch";
let payload = json!({
"facts": (
json!({
"id": "",
"name": ""
})
),
"personalNamesWithPhoneNumbers": (
json!({
"countryIso2": "",
"countryIso2Alt": "",
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
})
)
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/api2/json/phoneCodeGeoBatch \
--header 'content-type: application/json' \
--header 'x-api-key: {{apiKey}}' \
--data '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNamesWithPhoneNumbers": [
{
"countryIso2": "",
"countryIso2Alt": "",
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
}
]
}'
echo '{
"facts": [
{
"id": "",
"name": ""
}
],
"personalNamesWithPhoneNumbers": [
{
"countryIso2": "",
"countryIso2Alt": "",
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
}
]
}' | \
http POST {{baseUrl}}/api2/json/phoneCodeGeoBatch \
content-type:application/json \
x-api-key:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-api-key: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "facts": [\n {\n "id": "",\n "name": ""\n }\n ],\n "personalNamesWithPhoneNumbers": [\n {\n "countryIso2": "",\n "countryIso2Alt": "",\n "firstName": "",\n "id": "",\n "lastName": "",\n "phoneNumber": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/api2/json/phoneCodeGeoBatch
import Foundation
let headers = [
"x-api-key": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"facts": [
[
"id": "",
"name": ""
]
],
"personalNamesWithPhoneNumbers": [
[
"countryIso2": "",
"countryIso2Alt": "",
"firstName": "",
"id": "",
"lastName": "",
"phoneNumber": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/phoneCodeGeoBatch")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
[USES 11 UNITS PER NAME] Infer the likely phone prefix, given a personal name and formatted - unformatted phone number, with a local context (ISO2 country of residence).
{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2
HEADERS
X-API-KEY
{{apiKey}}
QUERY PARAMS
firstName
lastName
phoneNumber
countryIso2
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2" {:headers {:x-api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2"
headers = HTTP::Headers{
"x-api-key" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2"),
Headers =
{
{ "x-api-key", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-api-key", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2 HTTP/1.1
X-Api-Key: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2")
.setHeader("x-api-key", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2"))
.header("x-api-key", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2")
.header("x-api-key", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2');
xhr.setRequestHeader('x-api-key', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2',
method: 'GET',
headers: {
'x-api-key': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2")
.get()
.addHeader("x-api-key", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2',
headers: {
'x-api-key': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2');
req.headers({
'x-api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2',
headers: {'x-api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2';
const options = {method: 'GET', headers: {'x-api-key': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-api-key": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2" in
let headers = Header.add (Header.init ()) "x-api-key" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2', [
'headers' => [
'x-api-key' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-api-key' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-api-key", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-api-key': "{{apiKey}}" }
conn.request("GET", "/baseUrl/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2"
headers = {"x-api-key": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2"
response <- VERB("GET", url, add_headers('x-api-key' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2') do |req|
req.headers['x-api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-api-key", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2 \
--header 'x-api-key: {{apiKey}}'
http GET {{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2 \
x-api-key:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-api-key: {{apiKey}}' \
--output-document \
- {{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2
import Foundation
let headers = ["x-api-key": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/api2/json/phoneCodeGeo/:firstName/:lastName/:phoneNumber/:countryIso2")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()