BackPrevious Topic  Next TopicNext

Using the Server API

You can use Logi Report Server API to achieve specific goals. This topic describes the HTTP methods GET and POST and how to specify the full paths of the server resources in the code.

The HTTP methods GET and POST are available for almost all of Logi Report commands. The following is an example of using the POST method in Java program:

                URL url = new URL("http://jrserver:8888");
URLConnection uc = url.getConnection();
if (uc instanceof HttpURLConnection) {
  HttpURLConnection huc = (HttpURLConnection)uc;
  //set use POST method.
  huc.setRequestMethod("POST");
  huc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
  huc.setDoOutput(true);

  //Write the HTTP query to the output stream.
  OutputStreamWriter writer = new OutputStreamWriter(huc.getOutputStream());
  writer.write("jrs.cmd=jrs.get_subnodes");
  writer.close();
  huc.getHeaderField(0);

  //Get the response content from the server.
  InputStream inStream = uc.getInputStream();
  if (inStream != null) {
    BufferedReader reader = new BufferedReader(new InputStreamReader(inStream));
    String inputLine;
    while (null != (inputLine = reader.readLine())) {
      System.out.println(inputLine);
    }
  }
}

When using the Server API to perform tasks on resources in the server resource tree, you need to specify the full path of the resources in the code. The rules are as follows:

  • If the resource is in the Public Reports folder in the server resource tree, you should start the path with "/". For example, for the /Public Report/SampleReports folder, the path is "/SampleReports".
  • If the resource is in the My Reports folder in the server resource tree, you should start the path with "/USERFOLDERPATH/username/" (change username to the real username with which you sign in to Logi Report Server). For example, suppose your username is Jim and you want to access the /My Reports/Shipments folder, the path in the URL is "/USERFOLDERPATH/Jim/Shipments".

The following list provides you with links on how to perform specific tasks using the Server API. Select the links to view the topics. For more information, see the Logi Report Javadoc.

Back to top

BackPrevious Topic  Next TopicNext