The webapi object is often used by custom web forms or the web extension rule sets, as it provides methods to construct urls to access several types of library navigation, such as document retrieval, library browsing, and searching.  This object is documented in the manual under the Programming Code Blocks, Built In Objects chapter.  Below is a rule set that demonstrates how to generate various urls for the standard demo_sales library.  You can run this rule set in order to see how different types of urls are structured, in order to emulate that structure in custom code, and then open the url in a browser to see the results.  When writing your own custom code to generate urls,remember to url-encode the query values.


To use this rule set, copy and paste it into an UnForm design tool, and run it with Force Ruleset turned on.


[urls]


# Documentation for these webapi object methods is provided here:

# https://unform.com/unform10/documentation/obj_webapi.htm


# Method signatures:


# browseurl$(lib$,order$,segments$[,scriptpfx$]) 

# catlist$(lib$,segments$[,scriptpfx$]) 

# documenturl$(lib$,doctype$,docid$[,subid$,[nowrapper[,scriptpfx$]]]) 

# multiview$(doclist$[,scriptpfx$])

# searchtpl(tpl$)

# searchurl$(tpl$[,scriptpfx$]) 

#


# scriptpfx$ can be provided as the base url to the unform server, such as "https://10.1.1.1:27392/arc"

# When run from outside a web server request, such as a rule set, scriptpfx$ defaults the [archive] section external= path in uf100d.ini

# In the design tool, it is run as a web server request, so will use the design tool's server url.



prejob{


    

    o=new("webapi")

    

    browseurl$=o'browseurl$("demo_sales","type","Invoice")

    

    caturl$=o'catlist$("demo_sales","OrderId|EverestIndustries|0001053")

    

    documenturl$=o'documenturl$("demo_sales","Invoice","0005134")

    

    pdfurl$=o'documenturl$("demo_sales","Invoice","0005134","@unform")


    doclist$="demo_sales|Invoice|0005136|@unform"

    doclist$+=$0a$+"demo_sales|Invoice|0005137|@unform"

    

    multiurl$=o'multiview$(doclist$)

    

    o'searchtpl(t$)

    t.library$="demo_sales"

    t.filter$="everest"

    searchurl$=o'searchurl$(t$)

    

}


cols 150

landscape


text 1,1,"Browse"

text 12,1,{browseurl$}


text 1,3,"Category"

text 12,3,{caturl$}


text 1,5,"Document"

text 12,5,{documenturl$}


text 1,7,"PDF"

text 12,7,{pdfurl$}


text 1,9,"Multiview"

text 12,9,{multiurl$}


text 1,11,"Search"

text 12,11,{searchurl$}