了解 Oracle API Platform Cloud Service REST API

Oracle API Platform Cloud Service 提供可用于自动执行某些任务的 REST Web 服务。

The REST APIs included in Oracle API Platform Cloud Service are:

  • 管理服务:提供用于管理网关构件、创建和获取策略信息、获取和更新用户首选项以及获取有关用户角色和授权的信息以及其他管理操作的操作。
  • 分析:提供用于获取统计信息以及性能信息的操作,例如活动应用程序、失败次数、请求总数、活动网关、请求和响应时间序列数据等。
  • 使用者服务:提供支持创建和删除应用程序的操作,或更新应用程序信息,添加或删除对应用程序的授权,管理开发人员门户配置设置,设置或删除用户首选项等。
  • 网关控制器:提供与节点和安全配置文件配置相关的操作。
  • 管理服务:提供创建和部署 API、API 授权、创建和管理应用程序、部署和 API 权利以及其他操作的操作。

The Management Service is a REST API that you can use to create and deploy APIs in Oracle API Platform Cloud Service.

使用 Oracle API Platform Cloud Service 管理 API 创建新 API

使用 Oracle API Platform Cloud Service 管理 API 使用 REST 创建 API。

要使用管理 REST API 创建 API,您可以在脚本中执行 REST 命令之前,使用首选项的 cURL 或 REST 客户端测试您是否具有 API 管理器角色。

  1. 在编辑器中,使用以下信息为 cURL 请求创建基本 JSON 模板。
    {
        "name": "YOUR_API_NAME",
        "version": "YOUR_API_VERSION",
        "implementation":
        {
            "policies": [
            {
                "id": "1",
                "type": "o:ApiRequest",
                "version": "1.0",
                "draft": true,
                "config":
                {}
            },
            {
                "id": "2",
                "type": "o:ServiceRequest",
                "version": "1.0",
                "draft": true,
                "config":
                {}
            },
            {
                "id": "3",
                "type": "o:ServiceResponse",
                "version": "1.0",
                "config":
                {}
            },
            {
                "id": "4",
                "type": "o:ApiResponse",
                "version": "1.0",
                "config":
                {}
            }],
            "executions":
            {
                "request": ["1", "2"],
                "response": ["3", "4"]
            }
        }
    }

    在 JSON 模板中,name 是您的 API 名称,version 是您的 API 版本。此模板具有在 Oracle API Platform Cloud Service 中创建 API 所需的最低基本信息,例如 API 名称、版本、处于草稿模式的 API 请求和服务请求策略以及服务响应和 API 响应策略。

  2. By using cURL or your REST client, make a POST request to the https://YOUR-API-PCS-INSTANCE-URL/apiplatform/management/v1/apis endpoint, where YOUR-API-PCS-INSTANCE-URL is the URL of your Oracle API Platform Cloud Service instance.
  3. 验证请求和响应正文中的响应标头。
    HTTP/1.1 200 OK 
    Server: Oracle-Traffic-Director/12.2.1.0.0
    Date: Tue, 19 Jul 2016 13:27:08 GMT
    Content-Length: 30
    Content-Type: application/json
    X-oracle-dms-ecid: dd439614-7d4f-47ad-a1ea-a25a74ec9403-0000032d
    X-oracle-dms-rid: 0:1
    Via: 1.1 otd_opc
    Proxy-agent: Oracle-Traffic-Director/12.2.1.0.0

    服务器的响应正文也采用 JSON 格式。

    {
      "id": "101",
      "iterationId": "1"
    }