Difference between revisions of "Integration/REST"

From TempusServa wiki
Jump to navigation Jump to search
old>Admin
old>Admin
Line 57: Line 57:
     //Close connection
     //Close connection
     session.close();
     session.close();
== URL structure ==

Revision as of 12:35, 9 February 2020

Introduction to the REST interface

This article has not yet been fully converted to Wiki format.

Please download the original article: Tempus Serva REST interface.pdf


Netbeans quick start guide

Steps to create a simple interaction

  1. Add Webservice to ide (wadl import)
    • URL: [ServerName]/[ApplicationName]/rest/[SolutionSystemName].wadl
    • If import causes trouble: Download the wadl file
  2. Create a new project
    1. Add REST Client to project
      • Point to newly created webservice: [SolutionSystemName]
    2. Add JAXB bindings to project (use XSD schema)
      • URL: [ServerName]/[ApplicationName]/rest/[SolutionSystemName].xsd
      • If import causes trouble: Download the xsd file


Sample code for list view (BASIC athentication)

   //Create session
   FirmabilerClient session = new FirmabilerClient();
   session.setUsernamePassword("admin", "password1223");
   //Set search parameters (first parameter is a dummy)
   FirmabilerList result = session.getList(FirmabilerList.class, "", "TITEL=Kasper" );
   //Retrieve data and print
   List <FirmabilerListItem> list = result.getFirmabilerListItem();
   for(int i=0; i<list.size(); i++) {
       //Handle single item
       FirmabilerListItem item = list.get(i);
       System.out.println( item.getDataID() + "\t" + item.getNUMMERPLADE() );
   }
   //Close connection
   session.close();

Sample code for list view (parameter credentials)

   //Create session
   FirmabilerClient session = new FirmabilerClient();
   //Login and set search parameters 
   FirmabilerList result = session.getList(FirmabilerList.class, "admin", "password1223", "TITEL=Kasper" );
   //Retrieve data and print
   List <FirmabilerListItem> list = result.getFirmabilerListItem();
   for(int i=0; i<list.size(); i++) {
       //Handle single item
       FirmabilerListItem item = list.get(i);
       System.out.println( item.getDataID() + "\t" + item.getNUMMERPLADE() );
   }
   //Close connection
   session.close();


URL structure