Session management

Retrieving a session context

get

Retrieves a specified session context. A session context is created when a cart is created for that session; until then it does not exist. Recommended for performing calls on the management side.

chevron-right
lockRequired scopes
This endpoint requires the following scopes:
  • : Manage session context
Authorizations
OAuth2clientCredentialsRequired
Token URL:
Path parameters
tenantstring · min: 3 · max: 16Required

Your Emporix tenant name.

Note: The tenant name should always be provided in lowercase.

Pattern: ^[a-z][a-z0-9]+$
sessionIdstringRequired

Customer session ID. The session context (and this ID) is created when a cart is created for the user; until then, only an anonymous or customer token is returned and there is no session context resource.

Responses
chevron-right
200

The request was successful. Session context details are returned.

application/json
sessionIdstringOptional

Unique identifier of the customer's session.

Example: 62528895-b561-4518-bfdc-2cbf52a07845
customerIdstringOptional

Customer unique identifier.

Note: This field is only applicable to logged-in customers.

Example: C87362407845
siteCodestringOptional

Code of the site, as defined in the Site Settings Service.

Note: The default country code for anonymous sessions is based on the home base address country of the default site. In the case of a logged-in customer session, the country code is derived from the customer's shipping address, with the billing address being used as a fallback if the former is not available. If both addresses are not set, the home base address country code from the default site is used.

Example: main
currencystringOptional

Three-letter currency code, as defined in the Currency Service.

Note: During an anonymous session, the default currency of the site serves as the initial currency. Whereas, for a user session, the customer's preferred currency is set as the initial currency.

Example: EUR
cartIdstringOptional

Unique identifier of the active customer cart, generated when the cart is created through the Cart Service.

Example: 61079711ce0eb90861357045
targetLocationstringOptional

The country code, as defined in the country service.

Note: The default country code for anonymous sessions is based on the home base address country of the default site. In the case of a logged-in customer session, the country code is derived from the customer's shipping address, with the billing address being used as a fallback if the former is not available. If both addresses are not set, the home base address country code from the default site is used.

Example: DE
get
/session-context/{tenant}/context/{sessionId}

Updating a session context

put

Updates a specified session context. Recommended for performing calls on the management side.

Note: To update a session context, you need to provide its current metadata.version value in the request body.

chevron-right
lockRequired scopes
This endpoint requires the following scopes:
  • : Manage session context
Authorizations
OAuth2clientCredentialsRequired
Token URL:
Path parameters
tenantstring · min: 3 · max: 16Required

Your Emporix tenant name.

Note: The tenant name should always be provided in lowercase.

Pattern: ^[a-z][a-z0-9]+$
sessionIdstringRequired

Customer session ID. The session context (and this ID) is created when a cart is created for the user; until then, only an anonymous or customer token is returned and there is no session context resource.

Query parameters
upsertstringOptional
  • If set to true and the session with the specified id does not exist, the session will be created.
  • If set to false or not specified, a standard update will be performed.
Header parameters
saas-tokenstringOptional

Customer access token.

Note: This header is only required if the session context belongs to a logged-in customer. In that case, the value of the token and the customerId in the request body must belong to the same customer.

Body
sessionIdstringOptional

Unique identifier of the customer's session.

Example: 62528895-b561-4518-bfdc-2cbf52a07845
customerIdstringOptional

Customer unique identifier.

Note: This field is only applicable to logged-in customers.

Example: C87362407845
siteCodestringOptional

Code of the site, as defined in the Site Settings Service.

Note: The default country code for anonymous sessions is based on the home base address country of the default site. In the case of a logged-in customer session, the country code is derived from the customer's shipping address, with the billing address being used as a fallback if the former is not available. If both addresses are not set, the home base address country code from the default site is used.

Example: main
currencystringOptional

Three-letter currency code, as defined in the Currency Service.

Note: During an anonymous session, the default currency of the site serves as the initial currency. Whereas, for a user session, the customer's preferred currency is set as the initial currency.

Example: EUR
cartIdstringOptional

Unique identifier of the active customer cart, generated when the cart is created through the Cart Service.

Example: 61079711ce0eb90861357045
targetLocationstringOptional

The country code, as defined in the country service.

Note: The default country code for anonymous sessions is based on the home base address country of the default site. In the case of a logged-in customer session, the country code is derived from the customer's shipping address, with the billing address being used as a fallback if the former is not available. If both addresses are not set, the home base address country code from the default site is used.

Example: DE
Responses
put
/session-context/{tenant}/context/{sessionId}

No content

Last updated

Was this helpful?