Links

API Documentation

Face Detection API

post
https://api.iapp.co.th
/face_detect_single
Face Detection For Single Face

Parameter in Response

Name
Type
Description
bbox
Dictionary
Face bounding boxes of personal
xmax
Float
Maximum value in the x-axis
xmin
Float
Minimum value in the x-axis
ymax
Float
Maximum value in the y-axis
ymin
Float
Minimum value in the y-axis
detection_score
String
Detection score of face in image.
face
Base64
Face image in base64 format
message
String
The processing status
process_time
Float
The processing time

Sample Requests

CURL
Java - Unirest
NodeJS - Request
Objective C
PHP
Python
//Use default score
curl --location --request POST 'https://api.iapp.co.th/face_detect_single' \
--header 'apikey: {Your API Key}' \
--form 'file=@"{Your Image File Path}"'
//Use score of each company
curl --location --request POST 'https://api.iapp.co.th/face_detect_single' \
--header 'apikey: {Your API Key}' \
--form 'file=@"{Your Image File Path}"'
--form 'company="{Your Company Name}"'
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.iapp.co.th/face_detect_single")
.header("apikey", "{Your API Key}")
.field("file", new File("{Your Image File Path}"))
// Use score of each company
.field("company", "{Your Company Name}")
// Use default score
//.field("company", "{Your Company Name}")
.asString();
var request = require('request');
var fs = require('fs');
var options = {
'method': 'POST',
'url': 'https://api.iapp.co.th/face_detect_single',
'headers': {
'apikey': '{Your API Key}'
},
formData: {
'file': {
'value': fs.createReadStream('{Your Image File Path}'),
'options': {
'filename': '{Your Image File Name}'
'contentType': null
}
},
// Use score of each company
'company': '{Your Company Name}'
// Use default score
//'company': '{Your Company Name}'
}
};
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_detect_single"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"apikey": @"{Your API Key}"
};
[request setAllHTTPHeaderFields:headers];
NSArray *parameters = @[
@{ @"name": @"file", @"fileName": @"{Your Image File Path}" },
// Use score of each company
@{ @"name": @"company", @"value": @"{Your Company Name}" }
// Use default score
// @{ @"name": @"company", @"value": @"{Your Company Name}" }
];
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_detect_single');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'apikey' => '{Your API Key}'
));
// Use score of each company
$request->addPostParameter(array(
'company' => '{Your Company Name}'
));
// Use default score
//$request->addPostParameter(array(
// 'company' => '{Your Company Name}'
//));
$request->addUpload('file', '{Your Image File Path}', '{Your Image File Name}', '<Content-Type Header>');
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_detect_single"
# Use score of each company
payload={'company': '{Your Company Name}'}
# Use default score
payload={}
files=[
('file',('{Your Image File Name}',open('{Your Image File Path}','rb'),'image/jpeg'))
]
headers = {
'apikey': '{Your API Key}'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
post
https://api.iapp.co.th
/face_detect_multi
Face Detection For Multiple Face

Parameter in Response

Name
Type
Description
message
String
The processing status
process_time
Float
The processing time
result
Array
The data in dictionary for each personal
bbox
Dictionary
Face bounding boxes of personal
xmax
Float
Maximum value in the x-axis
xmin
Float
Minimum value in the x-axis
ymax
Float
Maximum value in the y-axis
ymin
Float
Minimum value in the y-axis
detection_score
String
Detection score of face in image.
face
Base64
Face image in base64 format
Sample Requests
CURL
Java - Unirest
NodeJS - Request
Objective C
PHP
Python
//Use default score
curl --location --request POST 'https://api.iapp.co.th/face_detect_multi' \
--header 'apikey: {Your API Key}' \
--form 'file=@"{Your Image File Path}"'
//Use score of each company
curl --location --request POST 'https://api.iapp.co.th/face_detect_multi' \
--header 'apikey: {Your API Key}' \
--form 'file=@"{Your Image File Path}"'
--form 'company="{Your Company Name}"'
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.iapp.co.th/face_detect_multi")
.header("apikey", "{Your API Key}")
.field("file", new File("{Your Image File Path}"))
// Use score of each company
.field("company", "{Your Company Name}")
// Use default score
//.field("company", "{Your Company Name}")
.asString();
var request = require('request');
var fs = require('fs');
var options = {
'method': 'POST',
'url': 'https://api.iapp.co.th/face_detect_multi',
'headers': {
'apikey': '{Your API Key}'
},
formData: {
'file': {
'value': fs.createReadStream('{Your Image File Path}'),
'options': {
'filename': '{Your Image File Name}'
'contentType': null
}
}
// Use score of each company
,
'company': '{Your Company Name}'
// Use default score
//'company': '{Your Company Name}'
}
};
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_detect_multi"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"apikey": @"{Your API Key}"
};
[request setAllHTTPHeaderFields:headers];
NSArray *parameters = @[
@{ @"name": @"file", @"fileName": @"{Your Image File Path}" },
// Use score of each company
@{ @"name": @"company", @"value": @"{Your Company Name}" }
// Use default score
// @{ @"name": @"company", @"value": @"{Your Company Name}" }
];
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_detect_multi');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'apikey' => '{Your API Key}'
));
// Use score of each company
$request->addPostParameter(array(
'company' => '{Your Company Name}'
));
// Use default score
//$request->addPostParameter(array(
// 'company' => '{Your Company Name}'
//));
$request->addUpload('file', '{Your Image File Path}', '{Your Image File Name}', '<Content-Type Header>');
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_detect_multi"
# Use score of each company
payload={'company': '{Your Company Name}'}
# Use default score
payload={}
files=[
('file',('{Your Image File Name}',open('{Your Image File Path}','rb'),'image/jpeg'))
]
headers = {
'apikey': '{Your API Key}'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)

Face Detection Tool

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

Parameter in Response

Name
Type
Description
company
String
The company name
detection_score
Float
The default score of face 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}&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&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}&company={Your Company Name}&password={Your Company Password}")
.header("apikey", "{Your API Key}")
.multiPartContent()
.asString();
// Configure Score
HttpResponse<String> response = Unirest.get("https://api.iapp.co.th/face_config_score?detection&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}&company={Your Company Name}&password={Your Company Password}',
// Configure Score
'url': 'https://api.iapp.co.th/face_config_score?detection&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}&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&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}&company={Your Company Name}&password={Your Company Password}');
// Show Score
$request->setUrl('https://api.iapp.co.th/face_config_score?detection&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}&company={Your Company Name}&password={Your Company Password}"
# Show Score
url = "https://api.iapp.co.th/face_config_score?detection&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)