Managing Common REST API session tokens and user tokens
Depending on your system resources, the number of sessions that you can have open simultaneously might be limited. BMC recommends that you reuse the associated session token for multiple getData or data requests from the same view.
Both user and session tokens expire if you don't use them. If you do not plan to reuse a session token it's not necessary to use the close parameter. Unless you indicate that you want the session to stay open, it closes immediately.
The following procedures are available:
Opening a session
To start a session and keep it open, use the following syntax:
https://<hostName>:<portNumber>/cra/serviceGateway/services/products/<productName>/views/<viewName>/data?close=false
Reusing a session token
To reuse a data session, use the following header parameters:
Append the following parameter to the initial data or getData request:
On subsequent data or getData requests on the same session, use the following header parameter:
session=<sessionId>
On the final getData or data request, use the following header parameter:
session=<sessionId>
and add the following parameter to the request:
Closing a session
Leaving sessions open, uses resources. If you no longer need a session that is open, you can use the following syntax to close it:
https://<hostname>:<portnumber>/cra/serviceGateway/services?close=true
Using the keepAlive command
If you want to keep a session alive for future reuse, issue a keepAlive command. You can issue keepAlive for either a user token or a specific session. The session parameter is optional. In either case, the user token is kept alive while any associated sessions are alive.
- In the Body, set the following key:
userToken=<userToken>
<userToken> is the token issued when you logged on. For more information, see Logging-in-to-a-service-using-the-Common-REST-API.