TMW-API Documentation | API-Version: 1.0.2 |
Version 2021-02-27
For simple help, see here.
The main script for all api calls is data.php in the api root
directory. The help file and documentation can be accessed via the
doc.php by adding the parameter =
The api can directly accessed without url rewrite. If the domain or format is left out, the default values, set in the config.ini, are used instead. The following parameters can be used:
The domain defines the data type to retrieve. There are four types of data:
Due to the different content of each domain there are different fields of content returned.
The format parameter defines the data type returned. There are four types of formates:
Every domain data can be formatted in these formats.
The language defines the data language to be returned.
The position parameter is an option value used in result lists to retreave a specific record. When using a image format (thumb, preview, download) it is possible to select the image out of a list.
The processor parameter defines the preprocesser to be called before the data is sent to the format transformation.
The query parameter contains the query string sent to the SolR api. It has to obey the rules of the SolR api.
The record number in a search list to start from.
The number of records to be returned. If no limit paramater is given, a miximum of 10 records is returned.
A predifined filter added to the query.
retrievel of object details: api/data.php?=object &=id:2938457 search with format definition: api/data.php?=object &=resolve &=object_name:Dampflok* AND title:*k.k.St.B.* &=xml search in thesaurus: api/data.php?=thesaurus &=term:keyboard
It is recommended to use the following url-rewrite rules on the webserver, due to the fact, that all inner links normally use this simple access method:
If a language code is used, the format parameter has to be present.
direct file access (css) | ||
---|---|---|
^api.*$ | ||
UNIX/LINUX | $0 | |
Windows | {R:0} |
Object by domain | ||
---|---|---|
^(.*)\.php?(.*)$ | ||
UNIX/LINUX | /api/$1.php$2 | |
Windows | /api/{R:1}.php{R:2} |
Processor | ||
---|---|---|
^([a-z]+)[\/]*(.*)$ | ||
UNIX/LINUX | api/data.php?domain=$1&data=$2 | |
Windows | api/data.php?domain={R:1}&data={R:2} |
No parameter (call help) | ||
---|---|---|
^[\/]*$ | ||
/api/doc.php?text=help.html |
Documentation | ||
---|---|---|
^doc.php?(.*)$ | ||
UNIX/LINUX | api/doc.php$1 | |
Windows | api/doc.php{R:1} |
The configuration file contains the setup for the the api. It is separated in five sections:
[path] | |
= |
path to the transformation stylesheets |
= |
path to transformation images |
[default] | |
= |
the html format allways should be defined for each domain |
= |
optional default domain |
= |
default http header |
= |
default language |
[lang] | list of supported languages |
= ... |
international language code xx_yy |
[format] | list of valid format names |
= ... |
formats for data retrieval with corresponding xsl templates |
[header] | list of valid http headers |
= ... |
header format definition for data output, i.e. application/xml, image/jpe. |
[processor] | list of automatic called preprocessors |
= ... |
|
[solr] | |
= |
|
[adlib] | |
= |
|
= |
|
= |
|
= |
|
= ... |
mapping list between domain names and SolR core name |
[{domain}.facets] | list of defined facets. the facet is called using this name |
= |
i.e. facet.field=object |
To use facets the solr facet string has to be defined in the config.ini for each domain. The group name in the ini-file is formed by the domain name and the .facets extension (object -> object.facets)
The following facets are defined in the config.ini:
The facet data is retrieved by adding the =
The xsl-stylesheets for the data transformation are located in the transform directory. For each domain and each format one definition has to be present. For the html-format a html.css stylesheet should be used.
The api offers a simple system to send store feedback to selected records.
The feedback preprocessor can be activated for different domains in the config.ini file. A feedback can be added by simply add the informations to the query and use the format
The following fields can be added to the query string:
Some informations are added automatically: