Inserting Customer IDs in API Calls
Inserting a customer ID into an OCC API call allows a service agent to act on behalf of the customer. A typical use case for this feature is emulating customer actions in the Assisted Service Module, which uses OCC APIs to support customers.
A service agent emulating a customer must have the CUSTOMERMANAGERGROUP role, which is granted using OAuth2 authentication. To emulate the customer, the customer ID is provided in the API request. This correctly identifies them, and assigns them as the current user for the API call. How you insert the customer ID depends on the type of API call.
Endpoint URLs That Include the Customer ID
For endpoint URLs that include the customer ID, for example when a service agent fetches user carts, provide the customer ID directly in the request path parameter as follows:
occ/v2/{baseSiteId}/users/{customerId}/carts
In this case, the customer is always identified with the request path parameter, and any customer ID provided in HTTP headers is ignored.
Endpoint URLs That Don't Include the Customer ID
For endpoints that do not include the customer ID in the request path, for example when service agent is searching products on behalf the customer, provide the customer ID in the HTTP headers using the sap-commerce-cloud-user-id field as follows:
sap-commerce-cloud-user-id: {customerId}