Enabling and disabling the REST Discovery API

You might want to prevent Swagger from displaying your RESTful API in a web browser, especially in a production environment that is serving live traffic. By disabling the REST Discovery API, you can prevent your REST services from being retrieved and displayed in Swagger. Alternatively, you can enable the REST Discovery API to view and test your REST services with Swagger.

About this task

The availability of the REST Discovery API is controlled by the ApiDiscoveryEnabled property. You can change this property within the wc-component.xml file for the foundation component. For more information about updating wc-component.xml files, see Changing REST configuration properties in the component configuration file (wc-component.xml).

  • WebSphere Commerce DeveloperThe ApiDiscoveryEnabled element is set to true (enabled) in WebSphere Commerce Developer environments by default.
    WebSphere Commerce Version If you are currently on WebSphere Commerce Developer Mod Pack 1 (, then the ApiDiscoveryEnabled element is set to false. If you want to enable the REST Discovery API in WebSphere Commerce Developer, see REST API is disabled after you install Mod Pack 1 (
  • In runtime environments, the ApiDiscoveryEnabled element is set to false (disabled) by default.

When you are updating your version of the wc-component.xml file, ensure that you include the ApiDiscoveryEnabled property, and set value to true or false. For example, the following code snippet sets the value for the property to false, which disables the REST Discovery API:

<!-- Determines if the REST API Discovery should be enabled. -->
    <_config:property name="ApiDiscoveryEnabled" value="false"/>

When the Discovery API is set to false, a user can still access Swagger in a web browser, but no REST API are displayed.

What to do next

Viewing REST API by using the Swagger user interface.