REST Java Client
The Rest Service API of the Heiler Product Manager can be from every client technology which is able to handle HTTP requests. However, we expect that a lot of clients will be built based on some Java technology, and therefore we provide also a Java client for the Rest Service API. The Java client is part of the PIM 7 distribution. Rest Client Java sources are also available. Therefor also Javadoc can be viewed or created.
Example
Below you can find a short example on how to use the client. The RestClientExample class is also part of the rest client API package.
Usage example for the client API
/** * Three arguments needed in the following order * <p> * - Basic Url, e.g.: "http://pim.heiler.com/rest"<br/> * - Username, e.g.: MyUserName <br/> * - Password, e.g.: MyPassword <br/> * </p> * <code> RestClientExample.main http://pim.heiler.com/rest MyUserName MyPassword </code> */ public static void main( String[] args ) { String basicUrl = extractBasicUrl( args ); String userName = extractUserName( args ); String password = extractPassword( args ); try { //Create and login to the client... RestClient restClient = new RestClient(); restClient.loginWithBasicAuth( basicUrl, userName, password, Locale.ENGLISH ); //Create and parameterize the report query you want to execute... EntityItemReference masterCatalog = EntityItemReferenceFactory.createByIdentifier( "MASTER" ); //$NON-NLS-1$ ReportQuery reportQuery = new ReportQuery( "byCatalog" ).addParameterValue( "catalog", masterCatalog ); //$NON-NLS-1$ //$NON-NLS-2$ //Create and parameterize the list request ListReadRequest listReadRequest = restClient.createListReadRequest(); EntityItemTable resultTable = listReadRequest.setFields( "Article.SupplierAID" ) //$NON-NLS-1$ .setPageSize( 100 ) .setStartIndex( 0 ) .getRootItems( "Article", reportQuery ); //$NON-NLS-1$ for ( EntityItemTableRow row : resultTable ) { List< Object > values = row.getValues(); String currentSupplierAid = ( String ) values.get( 0 ); System.out.println( currentSupplierAid ); } } catch ( RestClientException e ) { e.printStackTrace(); } }