Skip to main content
Storefront API Session Handling provides functions to create and manage sessions in the storefront. This makes it possible to use user states (e.g. anonymous visit or logged-in customer) as well as session-bound data such as shopping cart and wish list consistently across multiple requests. The session is a component of the shop and is mandatory. For more information, see here.

Supported methods

List of all supported methods.
CommandEndpointsGETPOSTPUTDELETE
Create sessionsession/create
Create link to a template page.session/prepareRedirect

Methods for session handling

These methods take care of session handling between API and storefront: First, new session IDs are generated as the technical basis for all further API calls. If needed, complete redirect links to template pages (e.g. checkout) are built up, including handover of the current session. Optional parameters can be used to specifically control target pages (e.g. a specific checkout step or highlights), while the actual session ID is securely embedded in the link.

POST session/create

The following call creates a session ID.
More info: Storefront API Basics
POST https://<your-shop>.de/api/v1/session/create

Example response

{
   "id" : "bc37dffbf7a3d067a1b0a3040143c5a8d1a1d8651f79159f59d81705c9733c49"
}

POST session/prepareRedirect

The following call generates a complete link to a template page (e.g. “checkout.htm”) and carries the current session over into the storefront. Optionally, additional parameters can be passed that the target template reads (e.g. to directly open a specific checkout step). Using this method makes sense if your shop is set up in a mixed way, i.e. if some parts have been created with the WEBSALE template theme and other parts with the Storefront API. The endpoint ensures that both parts use the same session. Example request that creates a complete link to the template page checkout and takes the current session along
{
  "viewIdentifier": "checkout"
}

Parameter overview

ParameterTypeDescription
x-sessionstringRequired field
ID of the current session. More information: Storefront API Basics
viewIdentifierstringRequired field
The ID configured in storefrontApi.redirects. More about this: storefrontApi - Storefront API
parametersobjectOptional values that are passed to the target page and are available there, for example, via $wsViews.storefrontApiLinkParameters. Example: { "viewIdentifier": "checkout", "params": { "step": "address", "highlight": "shipping" } }

Example response

{
  "storeFrontLink": "https://demo.shop.websale.biz/checkout?sessionKey=U2swGmPcfOeSsVPLF4wCXw2wmYDDcuzh"
}
(complete URL to the target template page including session handover)

Error codes

CodeDescription
redirectNotFoundNo configuration entry found for the specified viewIdentifier.
redisServicePoolInaccessibleInternal problem. Please contact WEBSALE support.
redisServiceNotFoundInternal problem. Please contact WEBSALE support.