Service API headers

Version:

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:

Header/Header property nameDescription
Content-TypeA standard entity-header field that indicates the media type of the entity-body sent to the recipient.
EnvironmentThe environment targeted by the request.
ShopNameThe name of the current shop being accessed (string).
ShopperIdA unique identifier for a shopper (normally a GUID represented as a string).
CustomerIdIf 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).
CurrencyThe currency to return in the response (string).
LanguageThe language desired in the response (string).
EffectiveDateThe 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.
GeoLocationProperties to identify shopper location (for location-based personalization or marketing campaigns, for example

  • AreaCode
  • BusinessName
  • City
  • DnsAddress
  • IpAddress
  • IspName
  • Latitude
  • Longitude
  • MetroCode
  • Policies
  • PostalCode
  • Region
  • TimeZone
RolesA 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).
IsRegisteredA flag that indicates whether the customer is logged into their account (boolean represented as a string).
PolicyKeysA list of flags delimited by a pipe symbol ("|" ) that alter the behavior of a command to obtain a required outcome.
If you have suggestions for improving this article, let us know!