Skip to main content
Version: ADONIS 14/ADOIT 15/ADOGRC 11.2

Retrieve a list of supported languages in XML format

This article shows how to use the API to get a list of the supported languages contained in the library in XML format.

The Java snippet below sends a request to the endpoint /rest/<VERSION>/languages and receives as a response an XML structure containing the available languages, each with ID and the language's name. In addition, the primary language is contained in the response structure.


The Java snippet below uses Basic Authentication.

Replace the values in angle brackets with values that fit your setup, e.g. instead of <HOST> use the host at which you access your ADOXX instance.

Click to view the code!

Source Code

public class GetLanguagesXML
public static void main (final String [] args) throws ClientProtocolException, IOException
final CloseableHttpClient aClient = HttpClients.createDefault ();

final String sUser = "<USER>";
final String sPass = "<PASSWORD>";
final String sPath = "http://<HOST>:<PORT>/ADOXX/rest/2.0/languages";

final HttpGet aMethod = new HttpGet (sPath);

// The headers controlling the return type and the language do not have to be considered for
// token generation
aMethod.addHeader ("Accept", "application/xml");
aMethod.addHeader ("Accept-Language", "en");

// Construction of the header to pass the basic authentication information
aMethod.addHeader ("Authorization",
"Basic " +
DatatypeConverter.printBase64Binary ((sUser + ":" + sPass).getBytes ()));

final CloseableHttpResponse aResponse = aClient.execute (aMethod);

final String sResult = EntityUtils.toString (aResponse.getEntity (), "UTF-8");
final StatusLine aStatusLine = aResponse.getStatusLine ();
System.out.println ("Status Code: " + aStatusLine.getStatusCode ());
System.out.println ("Result: \n" + sResult);
catch (final Exception aEx)
aEx.printStackTrace ();
aResponse.close ();

The result should look similar to the following:

Status Code: 200
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<rest_link href=".." method="GET" rel="self"/>
<language id="en" name="English"/>
<language id="en" name="English"/>
<language id="de" name="German"/>