Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

This section describes how to search for concept and terms via TermWeb API.

Selecting dictionary, section and domain

Searching via the API is similar to searching in TermWeb directly. You need to select a dictionary, one or more sections, and optionally a set of domains. The selections are saved when the user's session is closed (i.e. by logging out), and applied again when the same user logs in.

Selecting dictionary

Selecting which dictionary to search in is done by the generic method setSelected

<?xml version="1.0"?>
<methodCall>
   <methodName>termwebapi2.setSelected</methodName>
   <params>
     <param><value><string>123456789abc</string></value></param>
	 <param><value><string>dictionary</string></value></param>
     <param><value><string>312</string></value></param>
   </params>
</methodCall>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
  <params>
    <param><value><i4>0</i4></value></param>
  </params>
</methodResponse>

The ID for the dictionary can be retrieved from the Dictionary data object retrieved from getAll or getSelected methods. It is also possible to find an object by its name, using the getObjectByName method. Only readable dictionaries for the user are returned, and the API will give authorization error (1100) if a non-readable dictionary is selected.

Selecting sections or domains

By default, all readable sections are selected in a dictionary. A single section, or a list of sections, can be selected with setSelected, and all sections are selected by calling setAllSelected.

<?xml version="1.0"?>
<methodCall>
   <methodName>termwebapi2.setSelected</methodName>
   <params>
     <param><value><string>123456789abc</string></value></param>
	 <param><value><string>section</string></value></param>
     <param><value><array><data>
  	   <value><string>7522308</string></value>
  	   <value><string>1184008</string></value>
       <value><string>244004</string></value>
	 </data></array></value></param>
   </params>
</methodCall>

Same methods apply for selecting domains. When retrieving a domain via getObjectByName method, the domain tree is searched top-down, and the first domain with matching name is returned.

Selecting language

Selecting the source language can also be done with setting the language's ID in setSelected, but an easier way is to use setSourceLanguage and the language code. The currently selected language code can be retrieved with getSourceLanguage.

<?xml version="1.0"?>
<methodCall>
   <methodName>termwebapi2.setSourceLanguage</methodName>
   <params>
     <param><value><string>123456789abc</string></value></param>
	 <param><value><string>fra</string></value></param>
   </params>
</methodCall>
<?xml version="1.0"?>
<methodCall>
   <methodName>termwebapi2.getSourceLanguage</methodName>
   <params>
     <param><value><string>123456789abc</string></value></param>
   </params>
</methodCall>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
  <params>
    <param><value>fra</value></param>
  </params>
</methodResponse>

Searching terms

 

  • No labels