openDias API Spec

Version: 20130206001

Request method

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

Authentication

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.

Responses

--- some text here ---

Error Response

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>

Field Mappings

Scan Status

status idcode constantsupporting data will contain
0SCAN_IDLE 
1SCAN_INTERNAL_ERROR 
2SCAN_DB_WORKING 
3SCAN_DB_ERRORDB error code
4SCAN_WAITING_ON_SCANNER 
5SCAN_ERRO_FROM_SCANNERSANE error code
6SCAN_SCANNINGCurrent progress
7SCAN_WAITING_ON_NEW_PAGEWaiting for page [x]
8SCAN_TIMEOUT_WAITING_ON_NEW_PAGE 
9SCAN_CONVERTING_FORMAT 
10SCAN_ERROR_CONVERTING_FORMATFreeImage error code
11SCAN_PERFORMING_OCR 
12SCAN_ERROR_PERFORMING_OCRxxxxxx error code
13SCAN_SANE_BUSYused to be FIXING_SKEW
14SCAN_RESERVED_1 
15SCAN_RESERVED_2 
16SCAN_FINISHEDid of the saved doc

Document Types

type idDocument Type
1ODF Document
2Scanned Document
3PDF Document
4Imported Image

OCR language

ocrLanguage
engInternational English
deuGerman
fraFrench
spaSpanish
itaItalian
nldDutch
porBrasilian Portuguese
vieVietnamese

Sorting Fields

field idField
0docid
1title
2doc type
3date

checkForSimilar

Find other documents that 'look' the same as this one.

Calls method

pageRender::checkForSimilar

Known Callers

  • openDias.loadDetails.js :: anonymous()

Takes inputs of

action
fixed string 'getUserList'
docid
the documents id
<?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>

checkLogin

Checks login details and assigns the user role to the session, on success

Calls method

pageRender::checkLogin

Known Callers

  • openDias.userdetails.js :: loginbutton

Takes inputs of

action
fixed string 'checkLogin'
username
The username to login with
password
The usernames password
<?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>

createUser

Create a new user

Calls method

pageRender::createUser

Known Callers

  • openDias.accessControls.js :: anonymous()

Takes inputs of

action
fixed string 'createUser'
username
the username to create
realname
The new realname of the user
password
The new password of the user
role
The new role of the user
<?xml version='1.0' encoding='utf-8'?>
<Response>
  <CreateUser>
    result - Was login successful ['OK','FAIL']
  </CreateUser>
</Response>

deleteDoc

Removes a document from the database and scanned images store.

Calls method

docEditor::doDelete

Known Callers

  • openDias.saveDetails.js :: anonymous()

Takes inputs of

action
fixed string 'deleteDoc'
docid
the documents id
<?xml version='1.0' encoding='utf-8'?>
<Response>
  <DeleteDoc>
    status - indication of the update process - currently a static string 'OK'
  </DeleteDoc>
</Response>

deleteUser

Remove the user from the system

Calls method

pageRender::deleteUser

Known Callers

  • openDias.accessControls.js :: anonymous()

Takes inputs of

action
fixed string 'deleteUser'
username
the username to delete
<?xml version='1.0' encoding='utf-8'?>
<Response>
  <DeleteUser>
    result - Was login successful ['OK','FAIL']
  </DeleteUser>
</Response>

doScan

Starts a scanning process.

Calls method

pageRender::doScan()

Known Callers

  • openDias.acquire.js :: anonymous()

Takes inputs of

action
fixed string "doScan",
deviceid
The sane device id, as provided by getScannerList - Response.ScannerList.Devices.Device.name
format
The format to use for scanning, one of getScanningList - Response.ScanningList.Devices.Device.Formats.format
pages
The number of pages that make up the document,
resolution
The resolution to set the scanner to, between Response.ScannerList.Devices.Device.min and Response.ScannerList.Devices.Device.max,
ocr
Flag to indicate if an OCR process should be performed and in what language,
pagelength
The length of the page to scan, Percent, in relation to the maximum available by the scanner.
<?xml version='1.0' encoding='utf-8'?>
</Response>
  </DoScan>
    scanuuid - The application uniq id for the scanning process.
  </DoScan>
</Response>

docFilter

Get a list of documents that fit a specific set of criteria

Calls method

pageRender::docFilter

Known Callers

  • openDias.filter.js :: anonymous()

Takes inputs of

action
fixed string 'docFilter'
subaction
Get all details or just the count of matching docs ['count','fullList']
textSearch
Text that a document must match (title or ocr text)
isActionRequired
If 'true' return only records that are marked as 'action required'.
startDate
The first date that a document could fit into
endDate
The last date that a document could fit into
tags
Comma delimetered list of tagnames.
page
The number of 'range' offsets to apply before the first returned row.
range
The number of records to return in a single request.
sortfield*
Order the results by column
sortorder
present results in ascending/descending order ['0','1']
<?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>

getAudio

Get the web accessible filename that contains the read OCR

Calls method

[stump - not currently implemented]

Known Callers

  • openDias.loadDetails.js :: anonymous()

Takes inputs of

action
fixed string 'getAudio'
docid
the documents id
<?xml version='1.0' encoding='utf-8'?>
<Response>
  <Audio>
    filename - the filename that contains the audio of the selected doc 
  </Audio>
</Response>

getDocDetail

Get all the current information about a document

Calls method

docEditor::getDocDetail

Known Callers

  • openDias.loadDetails.js :: anonymous()

Takes inputs of

action
fixed string 'getDocDetail'
docid
the documents id
<?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>

getScannerDetails

Get the available attributes for a given scanner.

Calls method

pageRender::getScannerDetails()

Known Callers

  • openDias.acquire.js :: anonymous()

Takes inputs of

action
fixed string '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>

getScannerList

Get a list of scanners that the application can use.

Calls method

pageRender::getScannerList()

Known Callers

  • openDias.acquire.js :: anonymous()

Takes inputs of

action
fixed string '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>

getScanningProgress

Read the state of an asynchronous scan.

Calls method

pageRender::getScanningProgress()

Known Callers

  • openDias.acquire.js :: getScanningProgress()

Takes inputs of

action
Fixed string 'getScanningProgress'
scanprogressid
The uuid of the scanning process (as returned by 'doScan')
<?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>

getUserList

Provides a list of configured users on the system.

Calls method

pageRender::getUserList

Known Callers

  • openDias.accessControls.js :: anonymous()

Takes inputs of

action
fixed string '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>

logout

Removes any user specific information from the session

Calls method

pageRender::doLogin

Known Callers

  • openDias.userdetails.js :: logoutbutton

Takes inputs of

action
fixed string 'logout'
<?xml version='1.0' encoding='utf-8'?>
<Response>
  <Logout>
    result - Was login successful ['OK','FAIL']
  </Logout>
</Response>

moveTag

Updates links between documents n tags, and document n documents

Calls method

docEditor::updateTagLinkage

Known Callers

  • openDias.saveDetails.js :: anonymous()

Takes inputs of

action
fixed string 'moveTag'
docid
the documents id
tag
the tag that is being (un)linked
subaction
flag to indicate if the tag should be added or removed ['addTag','removeTag','addDoc','removeDoc']
<?xml version='1.0' encoding='utf-8'?>
<Response>
  <MoveTag>
    status - indication of the update process - currently a static string 'OK'
  </MoveTag>
</Response>

nextPageReady

Signal to the application that the user has correctly placed the next page for scanning.

Calls method

pageRender::nextPageReady()

Known Callers

  • openDias.acquire.js :: anonymous()

Takes inputs of

action
fixed string 'nextPageReady'
scanprogressid
The uuid of the scanning process (as returned by 'doScan')
<?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>

regenerateThumb

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)

Calls method

import_doc::extractThumbnail

Known Callers

  • openDias.acquire.js :: anonymous()

Takes inputs of

action
fixed string 'regenerateThumb'
docid
the documents id
<?xml version='1.0' encoding='utf-8'?>
<Response>
  <RegenerateThumb>
    status - indication of the update process - currently a static string 'OK'
  </RegenerateThumb>
</Response>

tagsAutoComplete

Complete a tagname from the start of the name.

Calls method

pageRender::tagsAutoComplete

Known Callers

  • openDias.loadDetails.js :: autocomplete function()

Takes inputs of

action
fixed string 'tagsAutoComplete'
startsWith
the beginning of the tags to return.
docid
the documents id
{"results":[
  {"tag":"%s"},
  ...
]}

titleAutoComplete

Complete a title from the start of the name.

Calls method

pageRender::titleAutoComplete

Known Callers

  • openDias.loadDetails.js :: autocomplete function()

Takes inputs of

action
fixed string 'titleAutoComplete'
startsWith
the beginning of the titles to return.
notLinkedTo
(optional) Do not return document with this docid, or documents linked to this docid
{"results":[
  {"docid":"%s","title":"%s"},
  ...
]}

updateDocDetails

Update a documents field with a specific value.

Calls method

docEditor::updateDocDetails

Known Callers

  • openDias.saveDetails.js :: anonymous()

Takes inputs of

action
fixed string 'updateDocDetails'
docid
the documents id
kkey
the name of the field that is being updated ['ocrtext','title','docDate','actionrequired','hardcopyKept']
vvalue
the new value to set the field to
<?xml version='1.0' encoding='utf-8'?>
<Response>
  <UpdateDocDetails>
    status - indication of the update process - currently a static string 'OK'
  </UpdateDocDetails>
</Response>

updateUser

Update a user with new details

Calls method

pageRender::updateUser

Known Callers

  • openDias.accessControls.js :: anonymous()

Takes inputs of

action
fixed string 'updateUser'
username
the username to update or the fixed string '[current]'
realname
(optional) The new realname of the updated user
password
(optional) The new password of the updated user
role
(optional) The new role of the updated user (not available for '[current]')
<?xml version='1.0' encoding='utf-8'?>
<Response>
  <UpdateUser>
    result - Was login successful ['OK','FAIL']
  </UpdateUser>
</Response>

uploadfile

Uploads a file, determines its type and includes PDF, ODF and JPEG docs into the document store.

Calls method

import_doc::uploadfile

Known Callers

  • openDias.acquire.js :: anonymous()

Takes inputs of

action
fixed string 'uploadfile'
uploadfile
(of type 'file') the filename/data of the file being imported

The form submitting this request should not be an AJAX request, but instead a form submission with encoding of enctype="multipart/form-data"


Google+ Find us on Google+