预订 Liberty REST API 更新

Liberty REST API Discovery 功能部件现在展示新 REST API(即 /ibm/api/docs/subscription),它允许用户预订任何 REST API 更新,例如,可用的新 API 或要移除的旧 API。要在端点中有特定 Liberty 实例提供的任何更改时立即通知用户,这会很有用。

启用预订

除基本 apiDiscovery-1.0 配置外,还需要在 server.xml 中配置 websocket-1.0websocket-1.1

<server>
    <featureManager>
        <feature>apiDiscovery-1.0</feature>
        <feature>websocket-1.1</feature>
    </featureManager>

    <httpEndpoint id="defaultHttpEndpoint"
                  		host="*"
                  httpPort="8010"
                  httpsPort="8020"/>

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

/ibm/api/docs/subscription 端点允许格式如下的带有 JSON 有效内容的 POST 请求:

{ "docType" : String }

其中 String 可以是 Swagger_20_JSONSwagger_20_YAML。返回的 JSON 有效内容概述预订订阅源的类型及其 URL。

示例请求和对应响应

请求:
{"docType":"Swagger_20_JSON"}
响应:
{
  "feedType": "websocket",
  "feedURL": "wss://myserver.com:8020/ibm/api/docs/subscription/websocket/60db0d79-1863-48f5-a0f9-4fe22a27b82d"
}

现在可使用 WebSocket 客户机连接至订阅源 URL。连接后,Liberty 服务器中对 REST API 的任何进一步更新将通过 WebSocket 推送。更新为 JSON 或 YAML 格式(取决于预订)。


用于指示主题类型的图标 参考主题



时间戳记图标 最近一次更新时间: Tuesday, 6 December 2016
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=rwlp_subscribe_restapi
文件名:rwlp_subscribe_restapi.html