Creating Requests

It easiest to make most Legacy REST Web Services requests with the RestComponentHelper and RestRepositoryHelper classes. These two classes simplify calling into the server by providing methods which hide the complexity of assembling the data for the request. All the methods for both classes are static and each returns a RestResult object and throws RestClientException. See the JavaDoc for more information about each method.

atg.rest.client.RestComponentHelper

The methods of the RestComponentHelper class allow access to components, properties, and methods. Each of the methods accepts a Map of parameters, which control the request. For more information and examples, see Accessing Components with the Java Client Library.

The Object[] pArguments parameter is an array of method arguments. This parameter should contain one Object for each of the method parameters. For example, if the method takes an int, then a java.lang.Integer object should be passed. The Java client library handles converting the object for transport to the server and the Legacy REST module handles converting it to an int. If any parameter object is passed as a String, the parameter will be transported to the server without any changes. This means that a method that takes an int can have a java.lang.String object with a value of 2, for example, passed. For parameters that are complex objects, the object can be passed as a parameter and the library will attempt to convert it for transport. When the request is sent to the server, a new instance will be constructed and its properties populated with the values from the original object. Collections and Maps can also be transported.

atg.rest.client.RestRepositoryHelper Class

The methods of the RestRepositoryHelper class allow you to access repository items, execute RQL queries, retrieve individual property values, set property values, create items, and remove items. Each of the methods takes a Nucleus repository path and item descriptor name as its first two arguments, as well as a Map of parameters, which control various aspects of the request. For more information and examples, see Accessing Repository Items with the Java Client Library.

Returns the contents of the repository item. If any of the properties are references to other items, Collections, arrays, or Maps, returns a REST URL that you can use to access the contents of the specific property. You can create a raw REST request to access the data for the property. For more information, see Creating a Raw REST Request.

Returns a series of URLs, one for each item which is being returned. T to control the number of items returned, the atg-rest-index and atg-rest-count parameters can be passed into the pParams argument.

Returns a series of URLs, one for each item which is being returned. To control the number of items returned, the atg-rest-index and atg-rest-count parameters can be passed into the pParams argument.

Note: Do not include parameters in the RQL queries that you perform via the Legacy REST Web Services. Make sure that all constants are explicitly included in the RQL statements. See information about parameters in RQL queries in the ATG Repository Guide.