ocr-sdk
ocr - JavaScript client for ocr-sdk
The OCR API 'ocr' performs Optical Character Resolution on input files. The flow is generally as follows: 1. First upload an image/file using the /ocr POST endpoint. You will get back a job response that contains a job with its associated settings. 2. Start the job from a PUT request to the /ocr/{jobid} endpoint, with the Job and Settings JSON as request body. The ocr extraction will now start. 3. Check the job status from the /ocr/{jobid} GET endpoint until the status has changed to DONE or ERROR. Messaging using a websocket will be available as an alternative in a future version 4. Retrieve the OCR result using the /ocr/{jobid}/result GET endpoint. This will return the OCR result only when the status is DONE. In other cases it will return the Job Response JSON (with http code 202 instead of 200) Interactive testing: A web based test console is available in the <a href="https://store.sphereon.com\">Sphereon API Store
This SDK is automatically generated by the Swagger Codegen project:
- API version: 1.0.0
- Package version: 0.3.2
- Build date: 2017-03-30T16:04:07.623+02:00
- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen
For more information, please visit https://sphereon.com
Installation
npm
To publish the library as a npm,
please follow the procedure in "Publishing npm packages".
Then install it via:
npm install ocr-sdk --save
git
If the library is hosted at a git repository, e.g.
https://github.com/GIT_USER_ID/GIT_REPO_ID
then install it via:
npm install GIT_USER_ID/GIT_REPO_ID --save
For browser
The library also works in the browser environment via npm and browserify. After following
the above steps with Node.js and installing browserify with npm install -g browserify
,
perform the following (assuming main.js is your entry file):
browserify main.js > bundle.js
Then include bundle.js in the HTML pages.
Getting Started
Please follow the installation instruction and execute the following JS code:
var ocr = require('ocr-sdk');
var defaultClient = ocr.ApiClient.instance;
var oauth2schema = defaultClient.authentications['oauth2schema'];
oauth2schema.accessToken = "YOUR ACCESS TOKEN"
var api = new ocr.OcrApi()
var jobid = "jobid_example";
api.deleteJob(jobid).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
Documentation for API Endpoints
All URIs are relative to https://gw.api.cloud.sphereon.com/
Class | Method | HTTP request | Description |
---|
ocr.OcrApi | deleteJob | DELETE /ocr/1.0.0/ocr/{jobid} | Delete a job manually |
ocr.OcrApi | getJob | GET /ocr/1.0.0/ocr/{jobid} | Job definition and state |
ocr.OcrApi | getJobs | GET /ocr/1.0.0/ocr | Get all jobs |
ocr.OcrApi | getResult | GET /ocr/1.0.0/ocr/{jobid}/result | Get the current ocr result |
ocr.OcrApi | submitJob | PUT /ocr/1.0.0/ocr/{jobid} | Submit OCR job for processing |
ocr.OcrApi | uploadFile | POST /ocr/1.0.0/ocr | Upload first file |
Documentation for Models
Documentation for Authorization
oauth2schema
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes: