Connecting
Connecting to the API
These are the steps to use the API:
- Connect to the API
- Create a new session for a user
- Call the desired methods, passing the session ID as argument
- Close the session
Connection example
The TermWeb API is configured at the URIÂ /termweb/api
 by default, so if your TermWeb is installed at http://myserver.example.com/termweb
 the API is found at http://myserver.example.com/termweb/api
.
The TermWeb API uses the prefix termwebapi2
 for all methods.
The API URI can be modified in the web.xml file. See Getting started.
Example code
Connect to the TermWeb server:
connect('http://myserver.example.com/termweb/api');
Create a new session for guest user:
<?xml version="1.0"?> <methodCall> <methodName>termwebapi2.initSession</methodName> <params> </params> </methodCall>
Response:
<?xml version="1.0" encoding="UTF-8"?> <methodResponse> <params> <param><value>123456789abc</value></param> </params> </methodResponse>
Close the session:
<?xml version="1.0"?> <methodCall> <methodName>termwebapi2.close</methodName> <params> <param><value><string>123456789abc</string></value></param> </params> </methodCall>
Response:
<?xml version="1.0" encoding="UTF-8"?> <methodResponse> <params> <param><value><i4>0</i4></value></param> </params> </methodResponse>
Session and version methods
Method | Description | Returns | Return type |
---|---|---|---|
initSession() | Creates a new session for a Guest user with auto-login enabled. | SessionID | string |
initSession(clientLogin) | Creates a new session for the guest user for specified client login. | SessionID | string |
initSession(clientLogin, userLogin, password) | Creates a new session for the specified client login, user name and password. | SessionID | string |
close() | Closes a session (logs out user) on the server. | 0 | int |
getApiVersion() | Returns the version of the API from the server. | The version string | string |
getTermWebVersion() | Returns the TermWeb version from the server. | The version string | string |