Subscribe to Liberty REST API updates

The Liberty REST API discovery feature now exposes a new REST API, /ibm/api/docs/subscription, which allows users to subscribe to any REST API update, such as new APIs being available or old APIs being removed. This is useful when a user wants to be notified immediately of any changes in the endpoints that are provided by a particular Liberty instance.

Enable subscriptions

In addition to the base apiDiscovery-1.0 configuration, it is required to also configure either websocket-1.0 or websocket-1.1 in your server.xml.


    <httpEndpoint id="defaultHttpEndpoint"

    <keyStore id="defaultKeyStore" password="Liberty"/>
    <basicRegistry id="basic" realm="ibm/api">
        <user name="bob" password="bobpwd" />

The /ibm/api/docs/subscription endpoint allows for POST requests with a JSON payload in the format:

{ "docType" : String }

Where the String can be one of Swagger_20_JSON or Swagger_20_YAML. The returning JSON payload outlines the type of subscription feed and its URL.

Example request and corresponding response

  "feedType": "websocket",
  "feedURL": "wss://"

You can now use a websocket client to connect to the feed URL. Once connected, any further updates to REST APIs in the Liberty server is pushed through the websocket. The update is either in JSON or YAML format, depending on the subscription.