2

I have the browser id of the guest in Sitecore CDP and Personalize, but I want to update the guest using the REST APIs. To update the guest using the REST APIs I require the guest ref. Is there a way to get the guess ref using the browser id?

2 Answers 2

3

To get the guest ref using the id you can:

Use the JavaScript Library

Boxever.browserShow(Boxever.browser_id,Boxever.client_key,function(data){
    console.log(data.customer.ref);
  }, 'json');

or

Use the REST Locate endpoint

You can use the Guest REST API to perform the locate guests function to return guests using their email address or other identifying information. After you perform the locate guests function, you can use the guestRef included in the response to retrieve the full guest record.

$ curl -H "Accept: application/json" \
        "https://{apiEndpoint}/v2/[email protected]"

REST Locate Endpoint : https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/use-the-locate-guests-function-in-sitecore-cdp-rest-api.html or

Use a Full Stack Interactive Experience

Create a Full Stack Interactive Experience that given the Browser Id returns the guest ref.

Full Stack Interactive experiences are available as part of Sitecore Personalize. Therefore for organizations with Sitecore CDP only, this solution is not available.

Full Stack Interactive Experiences Endpoint : https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/sitecore-cdp-flow-execution-data-model-rest-api.html

Full Stack Interactive Experiences Overview: https://doc.sitecore.com/cdp/en/users/sitecore-personalize/composing-the-api-response-for-an-interactive-experiment.html

1

An alternative method is to use the browser ID via the Rest APIs:

https://{{apiEndpoint}}/v2/guestContexts?browserRef={{browserid}}

This API isn't listed publicly: https://doc.sitecore.com/cdp/en/developers/api/rest-apis.html

However, I simply viewed the network traffic while I searched for "bid:{my-id}" in the search view and I saw it was used. It seems to work just fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.