Feature Pack 8

Viewing the WebSphere Commerce REST API in the Swagger UI

You can view a live version of the WebSphere Commerce REST API in a web browser on your WebSphere Commerce test server using the Swagger UI.

Procedure

  1. Start the WebSphere Commerce test server.
  2. Log in to your starter store as Site Administrator.
    Note: Logging in to the store sets up the security tokens so that you can make REST calls from Swagger. Although you can still view the REST resources in Swagger, failing to log in to the store with the appropriate permissions prevents you from running any REST calls from Swagger.
  3. Access the Swagger UI by using a web browser.
    1. Open a web browser and go to the following URL:
      http://localhost/webapp/wcs/stores/servlet/swagger/index.html
    2. In the Explore field, enter one of the following URLs, depending on which set of REST API you want to explore.
      • For the WebSphere Commerce REST API: http://WC_hostname/wcs/resources/api
      • For the Search REST API: http://WC_hostname/search/resources/api
      Notes:
      • By default, the Swagger UI web page loads the URL for the WebSphere Commerce REST APIs. After you update the Explore field, click the Explore button to avoid triggering a page refresh.
      • When you test your REST calls by using Swagger, select the storeId that corresponds to the store that you logged in to in Step 2.
      • When you access the Swagger UI page, the same protocol (HTTP or HTTPS) should be used for the REST API URL in the Explore field, or you will run into cross-origin resource sharing (CORS) errors.