Session Management
Typically, when calling a Connect API, the call opens a new session in SAP, executes the needed functionality, and then closes the session. Sometimes it is desirable to execute multiple API calls in a single session for performance purposes - ensuring that various pieces of data remain in memory in SAP. Specifically, the most frequent use case for this functionality is when doing variant configuration - that RIO is specifically designed to allow you to take advantage of keeping the prior configuration round in memory to reduce the need to recompute every piece of the configuration.

Using the session APIs

There are two session APIs:
  • /api/sap/[ConnectionName]/session/start
  • /api/sap/[ConnectionName]/session/stop
These APIs are added to every Connect end point - they do not need to be selected on the API screen.
Note that if the end point supports multiple connections, these API calls will exist for each one.

Starting a session

To start a session, simply call the start API. You will get back a response with a set-cookie header for a cookie named Sap-session. Store the value of that cookie for use below.

Executing calls in a session

Whenever you want to execute a call in a session you previously created, simply add a cookie header to the normal API call and pass in a cookie named SAP-session with the value returned in the start call. This call will behave normally in all respects, other than it will be executed in the same SAP session as any other call with that cookie.
Passing an invalid session cookie value will result in an error response.

Ending a session

To end a session, simply call the stop API, including the same cookie header used when executing calls in the session. This will end the session in SAP. Failure to end a session will result in the session being closed according to the settings of the particular SAP system (often something like 30 minutes after last use).
Last modified 5mo ago