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.

 

URL strings are built with a protocol, server, and script path prefix (a "script prefix"), such as http://myserver:27292/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 uf90d.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.

 

 

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

 

Use the catlist$() method for category browsing.  This method became available in version 9.0.06.

 

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.

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.

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

library$
doctype$
docid$
date$
title$
keywords$
notes$
categories$
subids$
text$
links$
dateupdated$
entityid$
filter$

 

Populate these fields as you would in a browser search, and pass this template to the searchurl$ method.

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.