The Base URL

The Item Search API is typically consumed by an AJAX client. You can use a client-side JavaScript framework like jQuery to send an HTTP request to the API and get the JSON response back. The URL is accessible by any client that supports HTTP and JSON. You can retrieve results for a particular item search by sending an HTTP GET request.

The Item Search API base URL has the following format:

http://www.mywebstore.com/api/items

The components of the base URL are described here:

Note:

JSONP (JSON with padding) wraps the JSON response from API requests in a JavaScript variable that can be included in a script tag to enable cross-domain AJAX requests. Web developers can use callback as the input parameter as described in Callback Function, and then create the variable name. For more information about the jQuery API, see api.jquery.com/jQuery.getJSON/.

Cacheable and Personalized Endpoints

The Item Search API has two additional endpoints:

  • /cacheable/items – responses are cached. This endpoint works in the same way as the /items endpoint.

  • /personalized/items – responses are never cached. This endpoint retrieves personalized item information that is specific to a customer.

Since the 2021.2 release of SuiteCommerce and SuiteCommerce Advanced (SCA), cacheable or personalized API endpoints are automatically used depending on whether a user is logged in to your Commerce website and whether the personalized endpoint configuration option has been enabled.

Example: Personalized API endpoints are used if the user is logged in and you have enabled the personalized endpoint configuration option.

If the user is not logged in, any of the following URLs can be used as both endpoints work the same way:

  • http://www.mywebstore.com/api/items

  • http://www.mywebstore.com/api/cacheable/items

The URL http://www.mywebstore.com/api/items can be used for SCA versions 2021.1 and earlier.

Personalized API endpoints are enabled by default. However, you can verify that they are enabled by checking the SuiteCommerce Configuration.

Note:

To ensure that logged-in users receive personalized catalog views that are not cached for other users, you should enable personalized API endpoints.

To verify that the personalized API endpoints are enabled:

  1. In NetSuite, go to Commerce > Websites > Configuration.

  2. Select your website and domain and click Configure.

  3. Go to the Shopping Catalog tab.

  4. Check the Enable New Search API Endpoints box.

  5. Click Save.

For information about the configurable property, see Enable Personalized Search API Endpoints.

Related Topics

General Notices