The Oracle ATG Web Commerce platform REST Web Services calls are executed within the context of an HTTP session. This enables a client application to maintain state across requests and to use login information for security purposes.

The RestSession class contains all the logic required for connecting and communicating with an Oracle ATG Web Commerce server.

The following code creates a new RestSession object:

RestSession session = RestSession.createSession(host, port, username, password);

Note: You can perform multiple REST Web Services requests during an HTTP session. See information about HTTP sessions and the REST Web Services server in Logging In.

RestSession class properties

The RestSession class includes the following properties. Some are set when the object is created and others can be changed after the object has been constructed:

Property

Description

Hostname

The name of the host which the session will or is connected to. Default is localhost.

Port

The port number which the session will use. Default is 80.

Username

The username the session will use to connect.

Password

The password the session will use to connect.

Scheme

The scheme the session will use to connect. Default is HTTP expect for login calls.

restContextRoot

The web application context root for Oracle ATG Web Commerce platform REST Web Services. Default is /rest.

useInternalProfileForLogin

Tells the session object to login as an internal user instead of a profile user. You will probably need to change this property after the RestSession object is created and before login is called. When connecting to a server that can be accessed only by internal users, this property must be set to true or the login will fail.

useHttpsForLogin

Tells the session object to use the HTTPS scheme for login calls. Default is true.

httpsPort

The HTTPS port number which the session will use. Default is 443.

userId

The userId of the connected user. This value is set after logging in.

sessionId

The session ID of the current session. This value is set after logging in.

Encoding

The encoding to use when encoding parameter values. Default is UTF

inputFormat

The default input format that is set on the server. Changing this value has no effect on the server.

outputFormat

The default output format that is set on the server. Changing this value has no effect on the server