200: OK OCR Successful 400: Bad Request OCR Unsuccessful
General
Copy {
"account_name" : "ā¸ā¸˛ā¸ ā¸ā¸¸ā¸ā¸ĸā¸ąā¸ āšā¸Ĩāšā¸ā¸" ,
"account_number" : "1234567890" ,
"bank_branch" : "0752 ā¸ā¸˛ā¸ā¸¸ā¸ā¸ā¸Ą" ,
"bank_name" : "āšā¸ā¸ĸā¸ā¸˛ā¸ā¸´ā¸ā¸ĸāš (SCB) - 014" ,
"confidence" : "77.84" ,
"file_name_bookbank" : "test" ,
"final_reason_codes" : {
"final_code" : 0 ,
"message" : "manuel_check" ,
"reason_codes" : {
"reason_code_bookbank" : 1 ,
"reason_code_bookbank_signature" : 0 '
"reason_codename_bookbank_signature" : "No signature found"
}
} ,
"inference_time(s)" : "0.177" ,
"message" : "Success" ,
"signature" : "" ,
"status" : 200
}
Copy {
"final_reason_codes" : {
"final_code" : 0 ,
"message" : "manuel_check" ,
"reason_codes" : {
"reason_code_bookbank" : 0 ,
"reason_code_bookbank_signature" : 0
}
} ,
"inference_time(s)" : "0.105" ,
"message" : "Invalid image" ,
"status" : 400
}
CURL Python Java - Unirest C# NodeJS - Request Objective C PHP
Copy curl --location --request POST 'https://api.iapp.co.th/book-bank-ocr/lineman/file'
--header 'apikey: --- Your API Key ---'
--form 'file=@"/your/path/to/image.jpg"'
Copy import requests
url = "https://api.iapp.co.th/book-bank-ocr/lineman/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)
Copy Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.iapp.co.th/book-bank-ocr/lineman/file")
.header("apikey", "--- Your API Key ---")
.field("file", new File("/your/path/to/image.jpg"))
.asString();
Copy var client = new RestClient("https://api.iapp.co.th/book-bank-ocr/lineman/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);
Copy var request = require('request');
var fs = require('fs');
var options = {
'method': 'POST',
'url': 'https://api.iapp.co.th/book-bank-ocr/lineman/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);
});
Copy #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/lineman/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);
Copy <?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.iapp.co.th/book-bank-ocr/lineman/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();
final-reason-codes (dict)