Some Legacy REST Web Services operations require parameters that are not named. For example, if you invoke the loginUser method of the /atg/userprofiling/ProfileServices component you must pass in two positional arguments. The first is the login value for a user and the second is the password value for that user.

The Legacy REST Web Services server uses a convention to name positional parameters. It expects the first positional parameter to be named arg1, the second to be named arg2, and any further parameters to be named similarly.

The URL parameters in the following Legacy REST Web Services URL contain positional parameters that are passed to the loginUser method.

http://servername:port/rest/bean/atg/userprofiling/ProfileServices/loginUser?
arg1=MyUsername&arg2=MyPassword

The Legacy REST Web Services server will call the loginUser method with the arguments in the positional parameters arg1 and arg2 in that sequence. The method definition for loginUser is shown below. See information about invoking methods in Invoking Legacy REST Component Methods.

public String loginUser(String pLogin,
                        String pPassword)
                 throws ServletException

The Legacy REST Web Services server can interpret message body parameters in XML, JSON or URL query strings. Make sure you set the correct Content-Type value for the markup that you use.

XML Parameter Markup in Legacy REST Services

You can use XML to format parameters in the message body of an Oracle Commerce Platform REST Web Services request.

Enclose all message body content in a parameters element as shown in the example below. Include each parameter in a separate child element. Use the name of the parameter as its element name.

<parameters>
  <login>Username</login>
  <password>Password</password>
  <atg-rest-user-input>MyMessageId</atg-rest-user-input>
</parameters>

Make sure that you specify Content-Type: application/xml in the HTTP message.

JSON Parameter Markup in Legacy REST Services

You can use JSON to format parameters in the message body of a Legacy REST Web Services request.

Enclose the parameters in standard JSON format as shown in the example below. Include each parameter in a separate name and value pair. Use the name of the parameter as the name for the pair. For positional parameters that do not have names, use the arg1, arg2, arg3 convention as the names for the pairs.

{
  "login": "Username",
  "password": "Password",
  "atg-rest-user-input": "MyMessageId"
}

Make sure that you specify Content-Type: application/json in the HTTP message.

The Legacy REST Web Services server will only accept parameters in the message body of a POST or PUT HTTP request. If you need to use the GET or DELETE methods, you need to include data with your request, and you cannot include URL parameters, use the atg-rest-view and atg-rest-http-method control parameters. See Handling POST Requests as Other Methods.

URL Query String Parameter Markup

You can use the URL query string format to include parameters in the message body of a Legacy REST Web Services request.

Include the parameters in standard URL query string format as shown in the example below. Include each parameter in a separate name and value pair. Use the name of the parameter as the name for the pair. For positional parameters that do not have names, use the arg1, arg2, arg3 convention as the names for the pairs. See Positional Parameters.

arg1=MyUsername&arg2=MyPassword&atg-rest-user-input=MyMessageId

URL encode any special URL characters in the parameter values. Make sure that you specify Content-Type: application/x-www-form-urlencoded in the HTTP message.


Copyright © 1997, 2015 Oracle and/or its affiliates. All rights reserved. Legal Notices