webapi

Top  Previous  Next

webapi

o=new("webapi")

 

The webapi object is used to generate URL strings appropriate for browser interaction with UnForm's document management web interface.  These strings can be used when constructing responses to the UnForm Desktop Client or the Web Extension, or for email notification content.

 

URL strings are built with a protocol, server, and script path prefix (a "script prefix"), such as http://myserver:27392/arc.  This prefix is derived automatically when the webapi object is instantiated by a rule set in response to a browser form or other web-based requests.  However, if the object is instantiated outside this environment, such as by a print job, a script prefix must be created dynamically.  At such times, the default value comes from the "external=value" setting in the [archive] section of uf100d.ini.  It is also possible to override the value by passing a scriptpfx$ string argument to the various methods.

 

This is important because the UnForm web server may need to be accessed in different ways depending on if the user is inside or outside the local network.  In some cases, it may be necessary to create two links so the user can select which is appropriate for their location at the time the link is clicked.

 

If the scriptpfx$ is passed as "*", then it will always attempt to use the [archive] section external= value regardless of the context in which it is run.  This can be useful in situations where UnForm is accessed via a proxy server, so that the browser environment requires a different server and path than what the web server actually provides (the UnForm web server is serving the proxy server, not the browser).

 

 

Methods:

browseurl$(lib$,order$,segments$[,scriptpfx$]) returns a URL to display a browse page in a particular order, optionally seeded with specific values based on the order.  The segments are pipe-delimited.  Segment dates must be in yyyymmdd order, such as "20141231".

 

Valid orders are:

 

type - segments$ is doctype
date - segments$ is yyyymmdd
updated - segments$ is yyyymmdd
type-date - segments$ is doctype|yyyymmdd
type-updated  - segments$ is doctype|yyyymmdd
keyword - segments$ is keyword
docdata - segments$ is name|value

 

Use the catlist$() method for category browsing.

 

catlist$(lib$,segments$[,scriptpfx$]) returns a URL to display a category browse page, as if the user had clicked through category segments until a list of documents is displayed.  Segments are pipe-delimited.

docflowdoc$(flowid$,doctype$,docid$[,scriptpfx$]) returns a url to load the DocFlow browser interface and preselect the specified flow and document.

documenturl$(lib$,doctype$,docid$[,subid$,[nowrapper[,scriptpfx$]]]) returns a document URL.  No subid will result in a document level view.  A "@" subid will result in a conditional view, document if multiple sub ids are available, or @unform if just that is available.  Otherwise, use a valid sub id.  If nowrapper is 1, an image is shown without the standard UnForm document wrapper menus.

multiview$(doclist$[,scriptpfx$]) returns a multi-view url, where documents can be viewed side by side.  The doclist$ variable contains a linefeed delimited list of document identifiers or urls in different formats:

 

Tab- or pipe-delimited document or image identification:

 

library|doctype|docid

library|doctype|docid|subid

 

Or a URL:

 

https://somewhere.com/images/1234.pdf

 

searchtpl(tpl$) returns search template tpl$ with the following fields:

library$
doctype$
docid$
date$ (in yyyymmdd format)
title$
keywords$
notes$
categories$ (pipe-delimited segments)
subids$
text$
links$
dateupdated$ (in yyyymmdd format)
entityid$
filter$
docdata$ (name=value pairs)

 

Populate these fields as you would in a browser search, and pass this template to the searchurl$ method.  Use of wildcards is supported with "*" or "?" characters.  For multiple settings of a given field, you can use comma or semicolon delimiters to represent "or" or "and" logic, or use the words " or " or " and ".

searchurl$(tpl$[,scriptpfx$]) returns search url with tpl$ based criteria.  Note lots of criteria could exceed http GET size limits, which are typically a few hundred characters.

webform$(formname$,lib$[,doctype$[,docid$[,scriptofx$]]]) displays the indicated web form, with the library and optional document type and doc id populated on the web form.