Abstract

Overview of the headers you can use to establish context for calls.

Sitecore XC uses HTTP request headers and header properties or fields passed in through the service APIs to establish context for calls. These headers and properties are available as methods and properties of the CommerceContext class, which must be included in all calls.

Sitecore XC supports standard known headers out-of-box, representing an extensibility point where additional headers can be established for specific plugins. Plugins can reference these headers when taking actions.

Some headers are only relevant in certain actions; however, you can include a header even if it is not used or needed for the particular call.

The following table lists headers and header properties or attributes that are supported out-of-the-box:

Description

Content-Type

A standard entity-header field that indicates the media type of the entity-body sent to the recipient.

Environment

The environment targeted by the request.

ShopName

The name of the current shop being accessed (string).

ShopperId

A unique identifier for a shopper (normally a GUID represented as a string).

CustomerId

If the shopper is registered, then an additional identifier is passed in, representing the unique identifier of a registered customer (normally a GUID represented as a string).

Currency

The currency to return in the response (string).

Language

The language desired in the response (string).

EffectiveDate

The effective date to use during any date-based calculations. This supports hypothetical scenarios where you want to see results as if the interactions occurred at dates and times not in the present.

If an EffectivateDate is not passed in, then DateTime.UtcNow is used by default.

GeoLocation

Properties to identify shopper location (for location-based personalization or marketing campaigns, for example

• AreaCode

• City

• IspName

• Latitude

• Longitude

• MetroCode

• Policies

• PostalCode

• Region

• TimeZone

Roles

A list of roles for the caller, delimited by a pipe symbol ("|" ). This can determine what actions are allowed and what information is returned in queries, or whether the query can be performed at all (string).

IsRegistered

A flag that indicates whether the customer is logged into their account (boolean represented as a string).

PolicyKeys

A list of flags delimited by a pipe symbol ("|" ) that alter the behavior of a command to obtain a required outcome.