Comment on page
API Documentation

post
https://api.iapp.co.th/book-bank-ocr/file
/
Bank Book OCR
CURL
Python
Java - Unirest
C#
NodeJS - Request
Objective C
PHP
curl --location --request POST 'https://api.iapp.co.th/book-bank-ocr/file'
--header 'apikey: --- Your API Key ---'
--form 'file=@"/your/path/to/image.jpg"'
import requests
url = "https://api.iapp.co.th/book-bank-ocr/file"
payload={}
files=[ ('file',('image.jpg',open('/your/path/to/image.jpg','rb'),'image/jpeg')) ]
headers = { 'apikey': '--- Your API Key ---' }
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.iapp.co.th/book-bank-ocr/file")
.header("apikey", "--- Your API Key ---")
.field("file", new File("/your/path/to/image.jpg"))
.asString();
var client = new RestClient("https://api.iapp.co.th/book-bank-ocr/file");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("apikey", "--- Your API Key ---");
request.AddFile("file", "/your/path/to/image.jpg");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = require('request');
var fs = require('fs');
var options = {
'method': 'POST',
'url': 'https://api.iapp.co.th/book-bank-ocr/file',
'headers': {
'apikey': '--- Your API Key ---'
},
formData: {
'file': {
'value': fs.createReadStream('/your/path/to/image.jpg'),
'options': {
'filename': 'image.jpg',
'contentType': null
}
}
}
};
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/book-bank-ocr/file"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"apikey": @"--- Your API Key ---"
};
[request setAllHTTPHeaderFields:headers];
NSArray *parameters = @[
@{ @"name": @"file", @"fileName": @"/your/path/to/image.jpg" }
];
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/book-bank-ocr/file');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'apikey' => '--- Your API Key ---'
));
$request->addUpload('file', '/your/path/to/image.jpg', 'image.jpg', '<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();
Fields | Description |
Bank Name | Name of the bank |
Account Number | Account number on the bank book |
Account Name | Account name on the bank book |
Bank Branch | Name of the bank branch |
Fields | Type | Description |
Message | string | OCR successful / unsuccessful |
Status | int | API code |
Bank Name | string | Name of the bank |
Account Number | string | Account number on the bank book |
Account Name | string | Account name on the bank book |
Bank Branch | string | Name of the bank branch |
Reason Codes | string | Reason for detection failures |
Confidence Score | float | Average confidence of the OCR |
Inference | float | Time taken to process bank book |
Last modified 1yr ago