API Documentation

Face Verification API

post
https://api.iapp.co.th
/face_compare
Face Verification

Parameter in Response

Name
Type
Description
message
String
The processing status
process_time
Float
The processing time
result
String
The similarity result of verification
similarity_score
Float
The similarity score of verification

Sample Requests

CURL
Java - Unirest
NodeJS - Request
Objective C
PHP
Python
// Use default score
curl --location -g --request POST 'https://api.iapp.co.th/face_compare' \
--header 'apikey: {Your API Key}' \
--form '[email protected]"{Your Image File Path 1}"' \
--form '[email protected]"{Your Image File Path 2}"'
// Use score of each company
--form 'company="{Your Company Name}"'
// Use min_score
--form 'min_score="{Your Minimun Score}"'
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.iapp.co.th/face_compare")
.header("apikey", "{Your API Key}")
.field("{Your Image File Name 1}", new File("{Your Image File Path 1}"))
.field("{Your Image File Name 2}", new File("{Your Image File Path 2}"))
//Use default score
//.field("company", "{Your Company Name}")
//.field("min_score", "{Your Minimun Score}")
// Use score of each company
.field("company", "{Your Company Name}")
// Use min_score
.field("min_score", "{Your Minimun Score}")
.asString();
var request = require('request');
var fs = require('fs');
var options = {
'method': 'POST',
'url': 'https://api.iapp.co.th/face_compare',
'headers': {
'apikey': '{Your API Key}'
},
formData: {
'file1': {
'value': fs.createReadStream('{Your Image File Path 1}'),
'options': {
'filename': '{Your Image File Name 1}'
'contentType': null
}
},
'file2': {
'value': fs.createReadStream('{Your Image File Path 2}'),
'options': {
'filename': '{Your Image File Name 2}'
'contentType': null
}
},
// Use default score
//'company': '{Your Company Name}'
//'min_score': '{Your Minimun Score}'
// Use score of each company
'company': '{Your Company Name}'
// Use min_score score
'min_score': '{Your Minimun Score}'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.iapp.co.th/face_compare"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"apikey": @"{Your API Key}"
};
[request setAllHTTPHeaderFields:headers];
NSArray *parameters = @[
// Use default score
@{ @"name": @"file1", @"fileName": @"{Your Image File Path 1}" },
@{ @"name": @"file2", @"fileName": @"{Your Image File Path 2}" }
// Use score of each company
@{ @"name": @"file1", @"fileName": @"{Your Image File Path 1}" },
@{ @"name": @"file2", @"fileName": @"{Your Image File Path 2}" },
@{ @"name": @"company", @"value": @"{Your Company Name}" }
// Use min_score score
@{ @"name": @"min_score", @"value": @"{Your Minimun Score}" }
@{ @"name": @"file1", @"fileName": @"{Your Image File Path 1}" },
@{ @"name": @"file2", @"fileName": @"{Your Image File Path 2}" }
];
NSString *boundary = @"----WebKitFormBoundary7MA4YWxkTrZu0gW";
NSError *error;
NSMutableString *body = [NSMutableString string];
for (NSDictionary *param in parameters) {
[body appendFormat:@"--%@\r\n", boundary];
if (param[@"fileName"]) {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
[body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];
if (error) {
NSLog(@"%@", error);
}
} else {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
[body appendFormat:@"%@", param[@"value"]];
}
}
[body appendFormat:@"\r\n--%@--\r\n", boundary];
NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
dispatch_semaphore_signal(sema);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.iapp.co.th/face_compare');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'apikey' => '{Your API Key}'
));
// Use default score
$request->addUpload('file1', '{Your Image File Path 1}', '{Your Image File Name 1}', '<Content-Type Header>');
$request->addUpload('file2', '{Your Image File Path 2}', '{Your Image File Name 2}', '<Content-Type Header>');
// Use score of each company
$request->addUpload('file1', '{Your Image File Path 1}', '{Your Image File Name 1}', '<Content-Type Header>');
$request->addUpload('file2', '{Your Image File Path 2}', '{Your Image File Name 2}', '<Content-Type Header>');
$request->addPostParameter(array(
'company' => '{Your Company Name}'
));
// Use score of each company
$request->addUpload('file1', '{Your Image File Path 1}', '{Your Image File Name 1}', '<Content-Type Header>');
$request->addUpload('file2', '{Your Image File Path 2}', '{Your Image File Name 2}', '<Content-Type Header>');
$request->addPostParameter(array(
'min_score' => '{Your Minimun Score}'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
import requests
url = "https://api.iapp.co.th/face_compare"
# Use default score
payload={}
# Use score of each company
payload={'company': '{Your Company Name}'}
# Use default score
payload={'min_score': '{Your Minimun Score}'}
files=[
('file1',('{Your Image File Name 1}',open('{Your Image File Path 1}','rb'),'application/octet-stream')),
('file2',('{Your Image File Name 2}',open('{Your Image File Path 2}','rb'),'application/octet-stream'))
]
headers = {
'apikey': '{Your API Key}'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)

Face Verification Tool

get
https://api.iapp.co.th
/face_config_score
Default Score Configuration

Parameter in Response

Name
Type
Description
company
String
The company name
comparison_score
Float
The default score of comparison
detection_score
Float
The default score of detection
message
String
The Processing status

Sample Requests

CURL
Java - Unirest
NodeJS - Request
Objective C
PHP
Python
// Configure Score
curl --location -g --request GET 'https://api.iapp.co.th/face_config_score?detection={Detection Value}&comparison={Comparison Value}&company={Your Company Name}&password={Your Company Password}' \
--header 'apikey: {Your API Key}'
// Show Score
curl --location -g --request GET 'https://api.iapp.co.th/face_config_score?detection&comparison&company={Your Company Name}&password={Your Company Password}' \
--header 'apikey: {Your API Key}'
Unirest.setTimeouts(0, 0);
// Configure Score
HttpResponse<String> response = Unirest.get("https://api.iapp.co.th/face_config_score?detection={Detection Value}&comparison={Comparison Value}&company={Your Company Name}&password={Your Company Password}")
.header("apikey", "{Your API Key}")
.multiPartContent()
.asString();
// Show Score
HttpResponse<String> response = Unirest.get("https://api.iapp.co.th/face_config_score?detection&comparison&company={Your Company Name}&password={Your Company Password}")
.header("apikey", "{Your API Key}")
.multiPartContent()
.asString();
var request = require('request');
var options = {
'method': 'GET',
// Configure Score
'url': 'https://api.iapp.co.th/face_config_score?detection={Detection Value}&comparison={Comparison Value}&company={Your Company Name}&password={Your Company Password}',
// Show Score
'url': 'https://api.iapp.co.th/face_config_score?detection&comparison&company={Your Company Name}&password={Your Company Password}',
'headers': {
'apikey': '{Your API Key}'
},
formData: {
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
// Configure Score
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.iapp.co.th/face_config_score?detection={Detection Value}&comparison={Comparison Value}&company={Your Company Name}&password={Your Company Password}"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
// Show Score
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.iapp.co.th/face_config_score?detection&comparison&company={Your Company Name}&password={Your Company Password}"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"apikey": @"{Your API Key}"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
dispatch_semaphore_signal(sema);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
// Configure Score
$request->setUrl('https://api.iapp.co.th/face_config_score?detection={Detection Value}&comparison={Comparison Value}&company={Your Company Name}&password={Your Company Password}');
// Show Score
$request->setUrl('https://api.iapp.co.th/face_config_score?detection&comparison&company={Your Company Name}&password={Your Company Password}');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'apikey' => '{Your API Key}'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
import requests
# Configure Score
url = "https://api.iapp.co.th/face_config_score?detection={Detection Value}&comparison={Comparison Value}&company={Your Company Name}&password={Your Company Password}"
# Show Score
url = "https://api.iapp.co.th/face_config_score?detection&comparison&company={Your Company Name}&password={Your Company Password}"
payload={}
files={}
headers = {
'apikey': '{Your API Key}'
}
response = requests.request("GET", url, headers=headers, data=payload, files=files)
print(response.text)