Version: 20130206001
Any of the API calls can be make invoked by making an HTTP POST request to the "/opendias/dynamic" entry point, over the port that the application is running on. Usually this would be done via an AJAX call on a webpage, but could just as easily be make from any application. eg, this is a call to invoke a new scanning operation from bash.
telnet localhost 8988 <<__endjob POST /opendias/dynamic HTTP/1.1 Host: localhost:8988 User-Agent: Mozilla/5.0 Accept: application/xml, text/xml, */* Accept-Language: en-gb,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Cookie: role=2; realname=Test User; o_session_id=2dcd2815-34a0-4d24-b392-c49ee5718b60 X-Requested-With: XMLHttpRequest Referer: http://localhost:8988/opendias/acquire.html Content-Length: 100 Pragma: no-cache Cache-Control: no-cache action=doScan&deviceid=test%3A0&format=Grey+Scale&pages=1&&resolution=300&ocr=-&pagelength=100 __endjob
After login (see 'checkLogin' API call), openDias will return a session id (o_session_id) via a cookie. This cookie must be returned with each request to the server in order for privileges to be used.
--- some text here ---
Any of the API calls could return an error message. Fontends should check for this error and take appropriate action.
<?xml version='1.0' encoding='utf-8'?> <Response> <error /> - a message describing the problem </Response>
status id | code constant | supporting data will contain |
---|---|---|
0 | SCAN_IDLE | |
1 | SCAN_INTERNAL_ERROR | |
2 | SCAN_DB_WORKING | |
3 | SCAN_DB_ERROR | DB error code |
4 | SCAN_WAITING_ON_SCANNER | |
5 | SCAN_ERRO_FROM_SCANNER | SANE error code |
6 | SCAN_SCANNING | Current progress |
7 | SCAN_WAITING_ON_NEW_PAGE | Waiting for page [x] |
8 | SCAN_TIMEOUT_WAITING_ON_NEW_PAGE | |
9 | SCAN_CONVERTING_FORMAT | |
10 | SCAN_ERROR_CONVERTING_FORMAT | FreeImage error code |
11 | SCAN_PERFORMING_OCR | |
12 | SCAN_ERROR_PERFORMING_OCR | xxxxxx error code |
13 | SCAN_SANE_BUSY | used to be FIXING_SKEW |
14 | SCAN_RESERVED_1 | |
15 | SCAN_RESERVED_2 | |
16 | SCAN_FINISHED | id of the saved doc |
type id | Document Type |
---|---|
1 | ODF Document |
2 | Scanned Document |
3 | PDF Document |
4 | Imported Image |
ocr | Language |
---|---|
eng | International English |
deu | German |
fra | French |
spa | Spanish |
ita | Italian |
nld | Dutch |
por | Brasilian Portuguese |
vie | Vietnamese |
field id | Field |
---|---|
0 | docid |
1 | title |
2 | doc type |
3 | date |
Find other documents that 'look' the same as this one.
pageRender::checkForSimilar
<?xml version='1.0' encoding='utf-8'?> <Response> <CheckForSimilar> <Docs> <Doc> docid - the id of the matching doc distance - how confident is the match [1 .. 100] lower the better title - the title of a similar doc <Taqs> tag - the name of the assigned tag ... </Tags> </Doc> ... </Docs> </CheckForSimilar> </Response>
Checks login details and assigns the user role to the session, on success
pageRender::checkLogin
<?xml version='1.0' encoding='utf-8'?> <Response> <Login> result - Was login successful ['OK','FAIL'] message - User message when result was 'FAIL' retry_throttle - The number of seconds that must pass before a further login attempt will be accepted. </Login> </Response>
Create a new user
pageRender::createUser
<?xml version='1.0' encoding='utf-8'?> <Response> <CreateUser> result - Was login successful ['OK','FAIL'] </CreateUser> </Response>
Removes a document from the database and scanned images store.
docEditor::doDelete
<?xml version='1.0' encoding='utf-8'?> <Response> <DeleteDoc> status - indication of the update process - currently a static string 'OK' </DeleteDoc> </Response>
Remove the user from the system
pageRender::deleteUser
<?xml version='1.0' encoding='utf-8'?> <Response> <DeleteUser> result - Was login successful ['OK','FAIL'] </DeleteUser> </Response>
Starts a scanning process.
pageRender::doScan()
<?xml version='1.0' encoding='utf-8'?> </Response> </DoScan> scanuuid - The application uniq id for the scanning process. </DoScan> </Response>
Get a list of documents that fit a specific set of criteria
pageRender::docFilter
<?xml version='1.0' encoding='utf-8'?> <Response> <DocFilter> count - The count of matching documents page - The requested page <Results> docid - the document id of a found document actionrequired - indicator flag title - the user defined title of the found document type* - the style of document date - the user defined date of the found document </Results> </DocFilter> </Response>
Get the web accessible filename that contains the read OCR
[stump - not currently implemented]
<?xml version='1.0' encoding='utf-8'?> <Response> <Audio> filename - the filename that contains the audio of the selected doc </Audio> </Response>
Get all the current information about a document
docEditor::getDocDetail
<?xml version='1.0' encoding='utf-8'?> <Response> <DocDetail> docid - the docid of the selected doc title - the user defined title of the selected doc (a default text is provided if NULL) extractedText - the OCR text of the selected doc docDate - the user defined date of the selected doc scanDate - the date that the document was added to the application. type* - the style of document pages - the number of pages used by the document actionrequired - indication if the document has been flagged as requiring an action hardcopyKept - indication if the original document has been retained x - the number of horizontal pixel required by the document y - the number of lines required by the document <Taqs> tag - the name of the assigned tag ... </Tags> <DocLinks> <doc> targetDocid - the docid of the linked doc targetTitle - the user defined title of the linked doc (a default text is provided if NULL) </doc> ... </DocLinks> </DocDetail> </Response>
Get the available attributes for a given scanner.
pageRender::getScannerDetails()
<?xml version='1.0' encoding='utf-8'?> <Response> <ScannerDetails> <Resolution> default - the default resolution min - the minimum resolution allowed by the scanning device max - the maximum resolution allowed by the scanning device </Resolution> <OCRLanguages> lang - the ocr language key ... </OCRLanguages> phash - indicator if 'find similar' is available </ScannerDetails> </Response>
Get a list of scanners that the application can use.
pageRender::getScannerList()
<?xml version='1.0' encoding='utf-8'?> <Response> <ScannerList cached='true'> -- optional param, present if data is returned from the cache <Devices> <Device> <Formats> format - the format that a scan can be performed in. currently only fixed string 'grey scale' ... </Formats> type - sane text that describes the scanning device (eg 'flat bed') vendor - sane text that names the scanning device model - sane text that names the scanning device host - text representation of the location of the scanner name - the machine id for the scanning device </Device> ... </Devices> </ScannerList> </Response>
Read the state of an asynchronous scan.
pageRender::getScanningProgress()
<?xml version='1.0' encoding='utf-8'?> <Response> <ScanningProgress> status* - the current action being done by the system value - representation of how far along the action being done, is. </ScanningProgress> </Response>
Provides a list of configured users on the system.
pageRender::getUserList
<?xml version='1.0' encoding='utf-8'?> <Response> <GetUserList> <Users> <User> username - the users user-id realname - the users chosen 'display name' last_access - the date the user last logged on role - the users assigned role </User> </Users> </GetUserList> </Response>
Removes any user specific information from the session
pageRender::doLogin
<?xml version='1.0' encoding='utf-8'?> <Response> <Logout> result - Was login successful ['OK','FAIL'] </Logout> </Response>
Updates links between documents n tags, and document n documents
docEditor::updateTagLinkage
<?xml version='1.0' encoding='utf-8'?> <Response> <MoveTag> status - indication of the update process - currently a static string 'OK' </MoveTag> </Response>
Signal to the application that the user has correctly placed the next page for scanning.
pageRender::nextPageReady()
<?xml version='1.0' encoding='utf-8'?> <Response> <NextPageReady> result - indication if the next page command was accepted, currently a fixed string 'ok' </NextPageReady> </Response>
Creates a thumbnail of PDF documents (some PDFs imported with earlier version of openDias did not have a thumbnail created for them at import time)
import_doc::extractThumbnail
<?xml version='1.0' encoding='utf-8'?> <Response> <RegenerateThumb> status - indication of the update process - currently a static string 'OK' </RegenerateThumb> </Response>
Complete a tagname from the start of the name.
pageRender::tagsAutoComplete
{"results":[ {"tag":"%s"}, ... ]}
Complete a title from the start of the name.
pageRender::titleAutoComplete
{"results":[ {"docid":"%s","title":"%s"}, ... ]}
Update a documents field with a specific value.
docEditor::updateDocDetails
<?xml version='1.0' encoding='utf-8'?> <Response> <UpdateDocDetails> status - indication of the update process - currently a static string 'OK' </UpdateDocDetails> </Response>
Update a user with new details
pageRender::updateUser
<?xml version='1.0' encoding='utf-8'?> <Response> <UpdateUser> result - Was login successful ['OK','FAIL'] </UpdateUser> </Response>
Uploads a file, determines its type and includes PDF, ODF and JPEG docs into the document store.
import_doc::uploadfile
The form submitting this request should not be an AJAX request, but instead a form submission with encoding of enctype="multipart/form-data"