API headers
Sitecore XC uses headers passed in via the Service APIs to establish context for the call. These headers are available from within the CommerceContext, which is passed around on all calls. There are standard known headers that are supported upon installation, and additional headers can be established for specific plugins. Plugins may reference these headers when performing actions.
Some headers are only relevant in certain actions. However, it is not harmful to include a header even if it is not used in a particular call.
Supported headers include:
|
Name |
Usage |
|---|---|
|
ShopName |
The name of the current Shop that you are accessing. |
|
ShopperId |
A unique ID for a Shopper. This is normally a GUID, represented as a string. |
|
CustomerId |
If the Shopper is registered, then an additional ID is passed in, representing the unique ID for a registered customer. This is normally a GUID, represented as a string |
|
Currency |
The currency that is desired in the response. For example, if you request a SellableItem, you will get pricing in the desired currency (if available). |
|
Language |
The language desired in the response. For example, if you request a SellableItem, you will get localized strings in the desired language (if available). |
|
EffectiveDate |
The effective date to use during any date-based calculations. This allows time-travel scenarios where you wish to see results as if the interactions occurred at dates and times not in the present. If an EffectiveDate is not passed in, then DateTime.UtcNow is used. |
|
Latitude |
A string representing the current latitude of the Shopper. |
|
Longitude |
A string representing the current longitude of the Shopper. |
|
IpAddress |
The IP address of the Shopper. |
|
Roles |
A "|" delimited list of roles for the caller. This may influence what actions are allowed, what information is returned in queries, or if the query can be performed. For security, when you are authenticated via Federated Authentication, these roles are ignored and the roles are derived directly from the authentication token. |
|
IsRegistered |
A boolean represented as a string that indicates the current caller is registered. |