Shopper Context

GET Get the shopper's context based on the shopperJWT.

GET /organizations/{organizationId}/shopper-context/{usid}

Operation ID: getShopperContext. Security: ShopperToken (sfcc.shopper-context, sfcc.shopper-context.rw); ShopperClientContextToken (sfcc.shopper-context, sfcc.shopper-context.rw).

Parameters

  • usid (path, string, required) The Shopper's unique identifier. It is a required parameter and is part of the response from the Guest or Registered User Shopper Login (SLAS) API call.
  • organizationId (path, OrganizationId, required) An identifier for the Salesforce Commerce Cloud organization the request is being made by. It consists of a prefix 'f_ecom_' followed by a 4-character realm identifier and a 3-character instance type identifier.

    Example

    f_ecom_zzxy_prd
  • siteId (query, SiteId, required) The site context.

    Example

    RefArch
  • sfdc_usid (header, string (uuid)) A unique shopper identifier (USID) for tracking client context. Used with endpoints secured with ShopperClientContextToken. This header is required for all endpoints secured with ShopperClientContextToken.
    Example: 550e8400-e29b-41d4-a716-446655440000.

Responses

  • 200 Shopper Context retrieved successfully.

    Headers:

    • X-Geolocation (string) The response header returns the geolocation based on the clientIp or geoLocation attribute set in the shopper context. If both are set, geoLocation takes precedence.
      Example: CountryCode: US; Country: United States; MetroCode: 0; Latitude: 37.751; Longitude: -97.822.

    Media type: application/json. Schema: ShopperContext.

    Example: ShopperContextExample

    {
      "effectiveDateTime": "2020-12-20T00:00:00Z",
      "sourceCode": "wii1-98",
      "customQualifiers": {
        "deviceType": "mobile",
        "ipAddress": "189.0.0.0",
        "operatingSystem": "Android"
      },
      "assignmentQualifiers": {
        "store": "boston"
      },
      "customerGroupIds": [
        "BigSpenders",
        "MobileUsers"
      ],
      "clientIp": "12.12.12.1",
      "couponCodes": [
        "Save20",
        "FREESHIP"
      ]
    }
  • 400 The usid in the incoming request does not match the usid in the token.

    Media type: application/problem+json. Schema: ErrorResponse.

    Example: getShopperContext400

    {
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/usid-not-matching-with-token",
      "detail": "Usid in incoming request does not match Usid in token.",
      "title": "Usid not matching with token"
    }
  • 401 Your shopper JWT is invalid and cannot be used to identify the API client.

    Media type: application/problem+json. Schema: ErrorResponse.

    Example: getShopperContext401

    {
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/unauthorized",
      "title": "Unauthorized",
      "detail": "Your shopper JWT is invalid and could not be used to identify the API client."
    }
  • 403 Your shopper JWT is valid, but you do not have permission to access the resource.

    Media type: application/problem+json. Schema: ErrorResponse.

    Example: getShopperContext403

    {
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/forbidden",
      "title": "Forbidden",
      "detail": "Your shopper JWT is valid, but you have no permissions to access the resource."
    }
  • 404 Shopper Context for ORGANIZATION_ID - f_ecom_bhbv_prd and USID - 7e1f65fb-185c-4788-8cec-05fef8dac77d not found in repository.

    Media type: application/problem+json. Schema: ErrorResponse.

    Example: getShopperContext404

    {
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/shopper-context-no-found",
      "detail": "Shopper Context for ORGANIZATION_ID: f_ecom_bhbv_prd and USID: 7e1f65fb-185c-4788-8cec-05fef8dac77d not found in Repository.",
      "title": "Shopper Context Not Found"
    }