If you use the Java or ActionScript client libraries that ship with the ATG Platform REST Web Services, passing parameters to methods is as simple as supplying the Objects in the pArguments argument for the RestComponentHelper.executeMethod() method. For more information, see Client Libraries.

If one of the parameters is a simple type, then it should be wrapped in an object. For example, an int will become a java.lang.Integer, a boolean becomes a java.lang.Boolean, and so on.

When you pass collections, Maps, and arrays as parameters, the client library attempts to convert those types. Date, Time, and Timestamp objects can also be passed, as shown in the following sample.

RestResult result = RestComponentHelper.executeMethod("/some/Component", "aMethod", new Object[] {1,2,3,4.4,5.5,true,'a',0xa}, null, session)

In order to pass repository items, use a preformatted string that takes the format of

repository Nucleus path:item descriptor name:item id

For example:

/atg/commerce/catalog/ProductCatalog:product:prod12345

When you reference a repository item this way, the server performs a lookup and uses the item as the method argument. For example:

RestResult result = RestComponentHelper.executeMethod("/some/Component",
"aMethod", new Object[] {"/atg/commerce/catalog/ProductCatalog:product:prod12345"}, null, session)

If a method takes a GenericService as an argument, simply passing the Nucleus path as a string will cause the server to lookup the Nucleus component and use it as the method argument. For example:

RestResult result = RestComponentHelper.executeMethod("/some/Component",
"aMethod", new Object[] {"/atg/dynamo/Configuration"}, null, session)

If passing a complex Java object, attempt to add the object to the pArguments argument and call the method. In most cases, the argument will not need to be transformed before it is transported to the server. The client library will make an attempt at converting the object for you.

MyObject myObject = new MyObject();
RestResult result = RestComponentHelper.executeMethod("/some/Component",
"aMethod", new Object[] {myObject}, null, session)
 
loading table of contents...