The getItem() method of the RestRepositoryHelper class returns a data stream that contains all the property values of a repository item.

The following code sample returns an array of URLs. Issuing a request using the RestSession.createHttpRequest() method returns the property values of the requested item.

RestResult result = RestRepositoryHelper.getItem("/atg/commerce/catalog/ProductCatalog", "product",
productId, params, session)

The getItems() method retrieves multiple repository items of the same type in a single call. The following code sample returns an array of URLs:

RestResult result = RestRepositoryHelper.getItems("/atg/commerce/catalog/ProductCatalog", "product",
params, session)

When a getItems() call returns many items, you can control the number of items returned with the atg-rest-index and atg-rest-count parameters. The atg-rest-index parameter tells the server which item to return first. The atg-rest-count parameter tells the server how many items past the index item to return.

In the following code sample, the first query, with an index of 0 and a count of 10, retrieves 10 items at a time. The next query has an index of 10 and a count of 10, third, index of 20 and count of 10, and so on.

Map<String,String> params = new HashMap<String,String>();
params.put(RestConstants.COUNT, 10);
params.put(RestConstants.INDEX, 0);
RestResult result = RestRepositoryHelper.getItems("/atg/commerce/catalog/ProductCatalog", "product",
params, session);

params.put(RestConstants.INDEX, 10);

result = RestRepositoryHelper.getItems("/atg/commerce/catalog/ProductCatalog",
"product", params, session);

params.put(RestConstants.INDEX, 20);

result = RestRepositoryHelper.getItems("/atg/commerce/catalog/ProductCatalog",
"product", params, session);
 
loading table of contents...