Walkthrough: Testing a Search and Recommendation API request in the API Explorer

Sitecore Discover Customer Engagement Console (CEC) includes the API Explorer in the Developer Resources section. Using the API Explorer, you can build a JSON request and fetch data using a Discover Search and Recommendation API endpoint.

You will be using the API Explorer during this walkthrough to fetch data for the widgets on the Home Page. This walkthrough describes how to:

  • Build a request.

  • View and edit the request.

  • Save the request as a JSON data object.

  • Run request and save the response as a JSON data object.

Build a request

To build the request to fetch data to populate widgets on the Home Page:

  1. To access the API Explorer in the CEC, go to Developer Resources, in API Explorer.

  2. Click Reset to clear the form in the Builder panel of the API Explorer.

  3. In the Builder panel, click Page drop-down and then click Home Page.

  4. Enter / (backslash) as the URL for the Home Page.

  5. Check All widgets to get data for all widgets on the Home Page.

  6. Enter 10 for N_item to retrieve per widget.

  7. Enter 1 for Page_number in case any of the widgets display paginated results.

  8. Click Build.

View and edit a request

To view and edit the request"

  1. Read the request in JSON format in the Request panel of the API Explorer. An error, visible above the JSON, says that context.user.uuid or context.user.user_id is required.

  2. Open the Context/User section in the Builder panel. Enter 123456 for UUID.

  3. Click Build.

  4. Verify there are no more errors.

Save the request as a JSON data object

To save the request to a text file:

  1. Read the request in JSON format in the Request panel of the API Explorer.

  2. Click Copy to clipboard as... and select Copy as data object.

Run request and copy the response to text file

To run the request and copy the response:

  1. Click Run.

  2. Read the response in JSON format in the Response panel of the API Explorer. You can scaffold and scroll through the response.

  3. Click Copy to clipboard as... and select Copy as data object.

Do you have some feedback for us?

If you have suggestions for improving this article,