API Explorer 23.2

The API Explorer tool allows application developers to interactively explore the Open Commerce APIs in a few ways:

  • Browse and review APIs.
  • Test APIs by launching requests.

It is built on Swagger-UI and uses Swagger 2.0 specs that get delivered by the meta APIs.

Log in to API Explorer

  • Make sure that your user account has the Documentation User role.
  • Navigate to https://api-explorer.commercecloud.salesforce.com.
  • Authenticate yourself via Account Manager.
  • Get the Swagger API schema from metadata. For the Digital API, you may have to authenticate your client application using a client id and password. If you provide a different Swagger-compatible meta API instead of a Digital meta API, then the default Swagger behavior applies, and no credentials are required.
    Note: You can access the demo metadata at the default pre-populated URL (https://demo-ocapi.demandware.net/s/-/dw/meta/v1/rest) using the demo client id “[your_own_client_id]” and password “[your_own_client_id]”.
  • Once the metadata is validated, the APIs are displayed.

Select a Different Instance

You can connect API Explorer to a different system as follows:

  1. Enter the target system URL in the field at the top of the page. For example, if the instance is at sandbox_domain.net, the URL might be https://sandbox_domain.net/s/-/dw/meta/v1/rest.
  2. Click Authorize. This opens the Available Authorizations popup.
  3. Click Logout.
  4. Enter the appropriate Client ID and Password for the system and click Authorize.
  5. Click Dismiss to close the popup.
  6. Click Explore to load the metadata from the new target system.

Browse APIs

The navigation bar at the top of the page includes dropdown lists for selecting the specific API and version. Selecting an API refreshes the values available in the version dropdown. For OCAPI, you can view any version of the Data, Shop, or Meta APIs. Here are some usage examples:

  • View version 23.2 of the Shop API:
    1. Select shop from the Select API dropdown. This refreshes the page so the Select API Version dropdown includes the available versions for the Shop API.
    2. Select 23.2 from the Select API Version dropdown. This displays the resources in the Shop API version 23.2.
    3. Select a resource to expand its details.
  • Examine the GET /catalogs/{catalog_id} operation.
    1. Select data from the Select API dropdown list. This refreshes the page so the Select API Version dropdown includes the available versions for the Data API.
    2. Select 23.2 from the Select API Version dropdown list. This displays the resources in the Data API version 23.2.
    3. Select the catalogs resource. It expands to display the available endpoints.
    4. Select the GET /catalogs/{catalog_id} operation. It expands to display the details of this endpoint:
      • Implementation Notes
      • Response Class (Status default) (If the operation requires authorization, then a red exclamation point icon will appear on the right side of this section.)
        • Model
        • Example Value
        • Response content type
      • Parameters
      • Response Messages

Try an HTTP request

Here's an example of launching a request from the explorer.

  1. Select data from the Select API dropdown list. This refreshes the page so the Select API Version dropdown includes the available versions for the Data API.
  2. Select 23.2 from the Select API Version dropdown list. This displays the resources in the Data API version 23.2.
  3. Select the catalogs resource. It expands to display the available endpoints.
  4. Select the GET /catalogs/{catalog_id} operation. It expands to display the details of this endpoint.
  5. Enter electronics-catalog in the catalog_id parameter.
  6. Launch the request by clicking Try it out! The request and response are displayed. A successful call returns HTTP response code 200 and information about the specified catalog.
    Note: You can copy the Curl request displayed here and paste it directly into a terminal.

Running requests against sandboxes using the Shop API

You can use the Shop API to launch HTTP requests against specific sandboxes. To do that, enter the site ID of the sandbox (e.g., SiteGenesis) in the Write Site Id field.
Note: The Write Site Id field is only visible when shop is selected from the API dropdown.

Log out

You may need to log out in order to use different client credentials. Follow these steps to log out:

  1. Click Authorize at the top of the page. This opens the Available Authorizations dialog.
  2. Click Logout in the dialog. This refreshes the page.
X OCAPI versions 15.x and 16.x will be retired on March 31, 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.