Documentation of Face API
Login
If you already have an account, use login to get access to the dashboard by entering the email address & password that you had used while registering/signup.
Forgot Password
In case you forgot the password, please click on Forgot Password to get a password reset link to your registered email.
Don’t have an account? Create One
In case you are here for the first time, please click on Create One to go to the signup page and register your account.
Sign-up
If you are here for the first time or wants to register a new account, please enter few of your details such as Your name, Email address, Select your country & enter you mobile number
First apply the name, then e-mail I’d, and phone no. and create the password. Then click on Sign-up and you will navigate to the next page.
Add New App
On click Add New App the page that shown above will be open. Now give the name of your own app in "Give a name to your app.
You can select your skin requirement as shown in above picture like, Wrinkles, Skin tone and skin health.
Create App & Get API Token
Create App & Get API Token provide us a feature to create an app on our name.
Calculate Per API Call Cost
Calculate Per API Call Cost use to find out the cost of per feature. Like if we select wrinkle then it will gives us the cost to find wrinkle on our face.
My APIs
On click of my APIs option we will get Test API and our app.
Test API
On click of Test API, Test Face AI API page will be open. With the help of that we can upload our picture to find out the result of the feature.
Create New API Group.
Create New API Group is use to create the new app with new features or again same features.
Face AI Analysis output.
Here we get the output of the picture the features that we selected in our app.
API Calling
Replace the followings :
URL = https://www.artifutech-face-ai.lm.r.appspot.com
TOKEN = YOUR TOKEN ID (Generated after sign up. See My profile section)
APP_ID = YOUR APP NUMBER. FOR EG., IF YOU WANT TO CALL THIS API WITH THE 1ST APP YOU CREATED THEN ITs APP_ID WILL BE REPLACE WITH APP0, IF YOU WANT TO CALL THE API WITH 2ND APP YOU CREATED THEN IT WILL BE APP1 & SO ON.
C# - RestSharp
var client = new RestClient("http://URL/?v=1.0&t=TOKEN&a=App_ID");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddFile("image", "/path/to/file");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
cURL
curl --location --request POST 'http://URL/?v=1.0&t=TOKEN&a=App_ID' \
--form ‘image=@"/path/to/file"'
Dart - http
var request = http.MultipartRequest('POST', Uri.parse('http://URL/?v=1.0&t=TOKEN&a=App_ID'));
request.files.add(await http.MultipartFile.fromPath('image', '/path/to/file'));
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
Go - Native
package main
import (
"fmt"
"bytes"
"mime/multipart"
"os"
"path/filepath"
"io"
"net/http"
"io/ioutil"
)
func main() {
url := "http://URL/?v=1.0&t=TOKEN&a=App_ID"
method := "POST"
payload := &bytes.Buffer{}
writer := multipart.NewWriter(payload)
file, errFile1 := os.Open("/path/to/file")
defer file.Close()
part1,
errFile1 := writer.CreateFormFile("image",filepath.Base("/path/to/file"))
_, errFile1 = io.Copy(part1, file)
if errFile1 != nil {
fmt.Println(errFile1)
return
}
err := writer.Close()
if err != nil {
fmt.Println(err)
return
}
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Set("Content-Type", writer.FormDataContentType())
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
HTTP
POST /?v=1.0&t=TOKEN&a=App_ID HTTP/1.1
Host: URL
Content-Length: 187
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="image"; filename="file"
Content-Type: <Content-Type header here>
(data)
----WebKitFormBoundary7MA4YWxkTrZu0gW
Java - OkHttp
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("image","file",
RequestBody.create(MediaType.parse("application/octet-stream"),
new File("/path/to/file")))
.build();
Request request = new Request.Builder()
.url("http://URL/?v=1.0&t=TOKEN&a=App_ID")
.method("POST", body)
.build();
Response response = client.newCall(request).execute();
Java - Unirest
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("http://URL/?v=1.0&t=TOKEN&a=App_ID")
.field("file", new File("/path/to/file"))
.asString();
JavaScript - Fetch
var formdata = new FormData();
formdata.append("image", fileInput.files[0], "file");
var requestOptions = {
method: 'POST',
body: formdata,
redirect: 'follow'
};
fetch("http://URL/?v=1.0&t=TOKEN&a=App_ID", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
JavaScript - jQuery
var form = new FormData();
form.append("image", fileInput.files[0], "file");
var settings = {
"url": "http://URL/?v=1.0&t=TOKEN&a=App_ID",
"method": "POST",
"timeout": 0,
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
JavaScript - XHR
// WARNING: For POST requests, body is set to null by browsers.
var data = new FormData();
data.append("image", fileInput.files[0], "file");
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "http://URL/?v=1.0&t=TOKEN&a=App_ID");
xhr.send(data);
C - libcurl
// WARNING: For POST requests, body is set to null by browsers.
var data = new FormData();
data.append("image", fileInput.files[0], "file");
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "http://URL/?v=1.0&t=TOKEN&a=App_ID");
xhr.send(data);
NodeJs - Axios
var axios = require('axios');
var FormData = require('form-data');
var fs = require('fs');
var data = new FormData();
data.append('image', fs.createReadStream('/path/to/file'));
var config = {
method: 'post',
url: 'http://URL/?v=1.0&t=TOKEN&a=App_ID',
headers: {
...data.getHeaders()
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
NodeJs - Native
var axios = require('axios');
var FormData = require('form-data');
var fs = require('fs');
var data = new FormData();
data.append('image', fs.createReadStream('/path/to/file'));
var config = {
method: 'post',
url: 'http://URL/?v=1.0&t=TOKEN&a=App_ID',
headers: {
...data.getHeaders()
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
var request = require('request');
var fs = require('fs');
var options = {
'method': 'POST',
'url': 'http://URL/?v=1.0&t=TOKEN&a=App_ID',
'headers': {
},
formData: {
'image': {
'value': fs.createReadStream('/path/to/file'),
'options': {
'filename': 'filename'
'contentType': null
}
}
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
NodeJs - Request
var request = require('request');
var fs = require('fs');
var options = {
'method': 'POST',
'url': 'http://URL/?v=1.0&t=TOKEN&a=App_ID',
'headers': {
},
formData: {
'image': {
'value': fs.createReadStream('/path/to/file'),
'options': {
'filename': 'filename'
'contentType': null
}
}
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
NodeJs - Unirest
var unirest = require('unirest');
var req = unirest('POST', 'http://URL/?v=1.0&t=TOKEN&a=App_ID')
.attach('file', '/path/to/file')
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
});
Object-C - NSURLSessior
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://URL/?v=1.0&t=TOKEN&a=App_ID"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSArray *parameters = @[
@{ @"name": @"image", @"fileName": @"/path/to/file" }
];
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);
OCaml - Cohttp
open Lwt
open Cohttp
open Cohttp_lwt_unix
let parameters = [|
[| ("name", "image"); ("fileName", "/path/to/file") |]
|];;
let boundary = "----WebKitFormBoundary7MA4YWxkTrZu0gW";;
let postData = ref "";;
for x = 0 to Array.length parameters - 1 do
let (_, paramName) = parameters.(x).(0) in
let (paramType, _) = parameters.(x).(1) in
let accum = "--" ^ boundary ^ "\r\n" ^ "Content-Disposition: form-data; name=\"" ^ paramName ^ "\"" in
if paramType = "value" then (
let (_, paramValue) = parameters.(x).(1) in
postData := if Array.length parameters.(x) == 3 then (
let (_, contentType) = parameters.(x).(2) in
!postData ^ accum ^ "\r\n" ^ "Content-Type: " ^ contentType ^ "\r\n\r\n" ^ paramValue ^ "\r\n"
) else (
!postData ^ accum ^ "\r\n\r\n" ^ paramValue ^ "\r\n"
);
)
else if paramType = "fileName" then (
let (_, filepath) = parameters.(x).(1) in
postData := !postData ^ accum ^ "; filename=\""^ filepath ^"\"\r\n";
let ch = open_in filepath in
let fileContent = really_input_string ch (in_channel_length ch) in
close_in ch;
postData := !postData ^ "Content-Type: {content-type header}\r\n\r\n"^ fileContent ^"\r\n";
)
done;;
postData := !postData ^ "--" ^ boundary ^ "--"
let reqBody =
let uri = Uri.of_string "http://URL/?v=1.0&t=TOKEN&a=App_ID" in
let headers = Header.init ()
|> fun h -> Header.add h "content-type" "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
in
let body = Cohttp_lwt.Body.of_string !postData in
Client.call ~headers ~body `POST uri >>= fun (_resp, body) ->
body |> Cohttp_lwt.Body.to_string >|= fun body -> body
let () =
let respBody = Lwt_main.run reqBody in
print_endline (respBody)
PHP - cURL
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'http://URL/?v=1.0&t=TOKEN&a=App_ID',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('image'=> new CURLFILE('/path/to/file')),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
PHP - Guzzle
<?php
$client = new Client();
$options = [
'multipart' => [
[
'name' => 'image',
'contents' => Utils::tryFopen('/path/to/file', 'r'),
'filename' => '/path/to/file',
'headers' => [
'Content-Type' => '<Content-type header>'
]
]
]];
$request = new Request('POST', 'http://URL/?v=1.0&t=TOKEN&a=App_ID');
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
PHP - HTTP_Request2
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('http://URL/?v=1.0&t=TOKEN&a=App_ID');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->addUpload('image', '/path/to/file', 'file', '<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();
}
PHP - pecl_http
<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('http://URL/?v=1.0&t=TOKEN&a=App_ID');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->addForm(array(
), array(
array('name' => 'image', 'type' => '<Content-type header>', 'file' => '/path/to/file', 'data' => null)
));
$request->setBody($body);
$request->setOptions(array());
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
PowerShell - RestMethod
$multipartContent = [System.Net.Http.MultipartFormDataContent]::new()
$multipartFile = '/path/to/file'
$FileStream = [System.IO.FileStream]::new($multipartFile, [System.IO.FileMode]::Open)
$fileHeader = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new("form-data")
$fileHeader.Name = "image"
$fileHeader.FileName = "file"
$fileContent = [System.Net.Http.StreamContent]::new($FileStream)
$fileContent.Headers.ContentDisposition = $fileHeader
$multipartContent.Add($fileContent)
$body = $multipartContent
$response = Invoke-RestMethod 'http://URL/?v=1.0&t=TOKEN&a=App_ID' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
Python - http.client
import http.client
import mimetypes
from codecs import encode
conn = http.client.HTTPSConnection("URL")
dataList = []
boundary = 'wL36Yn8afVp8Ag7AmP8qZ0SA4n1v9T'
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=image; filename={0}'.format('file')))
fileType = mimetypes.guess_type('/path/to/file')[0] or 'application/octet-stream'
dataList.append(encode('Content-Type: {}'.format(fileType)))
dataList.append(encode(''))
with open('/path/to/file', 'rb') as f:
dataList.append(f.read())
dataList.append(encode('--'+boundary+'--'))
dataList.append(encode(''))
body = b'\r\n'.join(dataList)
payload = body
headers = {
'Content-type': 'multipart/form-data; boundary={}'.format(boundary)
}
conn.request("POST", "/?v=1.0&t=TOKEN&a=App_ID", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode(“utf-8"))
Python - Requests
import requests
url = "http://URL/?v=1.0&t=TOKEN&a=App_ID"
payload={}
files=[
('image',('file',open('/path/to/file','rb'),'application/octet-stream'))
]
headers = {}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
R - httr
library(httr)
body = list(
'image' = upload_file('/path/to/file')
)
res <- VERB("POST", url = "http://URL/?v=1.0&t=TOKEN&a=App_ID", body = body, encode = 'multipart')
cat(content(res, ‘text'))
R - RCurl
library(RCurl)
file0 = fileUpload(
filename = path.expand('/path/to/file'))
res <- postForm("http://URL/?v=1.0&t=TOKEN&a=App_ID", file = file0, .opts=list(followlocation = TRUE), style = "httppost")
cat(res)
Ruby - Net::HTTP
require "uri"
require "net/http"
url = URI("http://URL/?v=1.0&t=TOKEN&a=App_ID")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
form_data = [['image', File.open('undefined')]]
request.set_form form_data, 'multipart/form-data'
response = http.request(request)
puts response.read_body
Shell - Httpie
http --ignore-stdin --form --follow --timeout 3600 POST 'http://URL/?v=1.0&t=TOKEN&a=App_ID' \
‘image'@/path/to/file
Shell - wget
# wget doesn't support file upload via form data, use curl -F \
wget --no-check-certificate --quiet \
--method POST \
--timeout=0 \
--header '' \
--body-data '' \
‘http://URL/?v=1.0&t=TOKEN&a=App_ID'
Swift - URLSession
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
var semaphore = DispatchSemaphore (value: 0)
let parameters = [
[
"key": "image",
"src": "/path/to/file",
"type": "file"
]] as [[String : Any]]
let boundary = "Boundary-\(UUID().uuidString)"
var body = ""
var error: Error? = nil
for param in parameters {
if param["disabled"] == nil {
let paramName = param["key"]!
body += "--\(boundary)\r\n"
body += "Content-Disposition:form-data; name=\"\(paramName)\""
if param["contentType"] != nil {
body += "\r\nContent-Type: \(param["contentType"] as! String)"
}
let paramType = param["type"] as! String
if paramType == "text" {
let paramValue = param["value"] as! String
body += "\r\n\r\n\(paramValue)\r\n"
} else {
let paramSrc = param["src"] as! String
let fileData = try NSData(contentsOfFile:paramSrc, options:[]) as Data
let fileContent = String(data: fileData, encoding: .utf8)!
body += "; filename=\"\(paramSrc)\"\r\n"
+ "Content-Type: \"content-type header\"\r\n\r\n\(fileContent)\r\n"
}
}
}
body += "--\(boundary)--\r\n";
let postData = body.data(using: .utf8)
var request = URLRequest(url: URL(string: "http://URL/?v=1.0&t=TOKEN&a=App_ID")!,timeoutInterval: Double.infinity)
request.addValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
semaphore.signal()
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()