WSO2中API的生命周期及相关事件探究

探究WSO2中API的全流程与相关事件

api的生命周期状态

<p>WSO2中API的生命周期及相关事件探究</p>

  • 已创建(CREATED)
  • 预发布(PRE-RELEASED)
  • 已发布(PUBLISHED)
  • 已废弃(DEPRECATED)
  • 已冻结(BLOCKED)
  • 已退役(RETIRED)

处于已发布状态的API,能够在devportal平台被使用者访问

获取api的方式

/api/am/devportal/apis/{apiId}

{
    "id": "06bba96d-a591-4779-a7f0-ed721fb147aa",
    "name": "百度",
    "description": null,
    "context": "/baidu/v1",
    "version": "v1",
    "provider": "admin",
    "apiDefinition": "",
    "wsdlUri": null,
    "lifeCycleStatus": "PUBLISHED",
    "isDefaultVersion": false,
    "type": "HTTP",
    "transport": [
        "http",
        "https"
    ],
    "operations": [],
    "authorizationHeader": "Authorization",
    "apiKeyHeader": "ApiKey",
    "securityScheme": [
        "oauth_basic_auth_api_key_mandatory",
        "oauth2"
    ],
    "tags": [],
    "tiers": [
        {
            "tierName": "专业版",
            "tierPlan": "FREE",
            "monetizationAttributes": null
        }
    ],
    "hasThumbnail": false,
    "additionalProperties": [],
    "monetization": {
        "enabled": false
    },
    "endpointURLs": [
        {
            "environmentName": "Default",
            "environmentDisplayName": "Default",
            "environmentType": "hybrid",
            "URLs": {
                "http": "http://test-gateway-am-wso2.xxx.com/baidu/v1",
                "https": "https://test-gateway-am-wso2.xxx.com/baidu/v1",
                "ws": null,
                "wss": null
            },
            "defaultVersionURLs": {
                "http": null,
                "https": null,
                "ws": null,
                "wss": null
            }
        }
    ],
    "businessInformation": {
        "businessOwner": null,
        "businessOwnerEmail": null,
        "technicalOwner": null,
        "technicalOwnerEmail": null
    },
    "environmentList": [
        "Default"
    ],
    "scopes": [],
    "avgRating": "0.0",
    "subscriptions": 0,
    "advertiseInfo": {
        "advertised": false,
        "apiExternalProductionEndpoint": null,
        "apiExternalSandboxEndpoint": null,
        "originalDevPortalUrl": null,
        "apiOwner": "admin",
        "vendor": "WSO2"
    },
    "isSubscriptionAvailable": true,
    "categories": [],
    "keyManagers": [
        "all"
    ],
    "createdTime": "2025-06-13 05:31:24.000",
    "lastUpdatedTime": null,
    "gatewayVendor": "wso2",
    "asyncTransportProtocols": [],
    "egress": false,
    "subtype": "DEFAULT"
}

api的创建与发布

  • 发生场景:当API发布者在后台添加API后,执行“create and deploy”操作,并且在“Publish > Lifecycle”中选择“Published”状态,从而完成API的发布
  • 主题 apim
  • 条件 event.payloadData.eventType为"API_LIFECYCLE_CHANGE"且event.payloadData.event.lifecycleEvent为"Publish"
  • 需先对event.payloadData.event实体结构进行base64解码
{
    "apiName": "user-info-api",
    "apiId": 39,
    "uuid": "8c209615-bc40-44a9-b31e-1a4e8c479b1d",
    "apiVersion": "v1",
    "apiContext": "/user/v1",
    "apiProvider": "admin",
    "apiType": "HTTP",
    "apiStatus": "PUBLISHED",
    "securityScheme": "oauth_basic_auth_api_key_mandatory,oauth2",
    "currentStatus": "CREATED",
    "apiVisibility": "public",
    "lifecycleEvent": "Publish",
    "eventId": "6fe0f743-b659-4a6f-b579-c94599b9901f",
    "timeStamp": 1749721922584,
    "type": "API_LIFECYCLE_CHANGE",
    "tenantId": -1234,
    "tenantDomain": "carbon.super"
}

api的更新

<p>WSO2中API的生命周期及相关事件探究</p>

  • 发生场景:API发布者在后台对API的策略进行调整,比如在“Portal Configurations > Subscriptions”菜单下添加标准版、高级版,删除VIP版等
  • 主题 apim
  • 条件 event.payloadData.eventType为"API_UPDATE"且event.payloadData.event.currentStatus为"PUBLISHED"
  • 需先对event.payloadData.event实体结构进行base64解码
{
    "apiName": "xiaohezi01",
    "apiId": 40,
    "uuid": "538afd3f-3b05-46c2-96e9-28412c115f85",
    "apiVersion": "v1",
    "apiContext": "/xiaohezi/v1",
    "apiProvider": "admin",
    "apiType": "HTTP",
    "apiStatus": "PUBLISHED",
    "securityScheme": "oauth_basic_auth_api_key_mandatory,oauth2",
    "currentStatus": "PUBLISHED",
    "apiVisibility": "public",
    "apiVisibleRoles": "",
    "eventId": "02743376-5da1-4d12-9281-9f8520aae705",
    "timeStamp": 1749778764066,
    "type": "API_UPDATE",
    "tenantId": -1234,
    "tenantDomain": "carbon.super"
}

api从发布到下线

  • 发生场景:API发布者在“Publish > Lifecycle”菜单中点击“Pre-Release”,将已发布的接口下线
  • 主题 apim
  • 条件 event.payloadData.eventType为"API_LIFECYCLE_CHANGE"且event.payloadData.event.lifecycleEvent不为"Publish"
  • 需先对event.payloadData.event实体结构进行base64解码
{
    "apiName": "xiaohezi01",
    "apiId": 40,
    "uuid": "538afd3f-3b05-46c2-96e9-28412c115f85",
    "apiVersion": "v1",
    "apiContext": "/xiaohezi/v1",
    "apiProvider": "admin",
    "apiType": "HTTP",
    "apiStatus": "PROTOTYPED",
    "securityScheme": "oauth_basic_auth_api_key_mandatory,oauth2",
    "currentStatus": "PUBLISHED",
    "apiVisibility": "public",
    "lifecycleEvent": "Deploy as a Prototype",
    "eventId": "25d4abc0-f74b-4692-9a7b-579e2656c05a",
    "timeStamp": 1749777184970,
    "type": "API_LIFECYCLE_CHANGE",
    "tenantId": -1234,
    "tenantDomain": "carbon.super"
}

文章整理自互联网,只做测试使用。发布者:Lomu,转转请注明出处:https://www.it1024doc.com/12613.html

(0)
LomuLomu
上一篇 2025 年 6 月 22 日
下一篇 2025 年 6 月 23 日

相关推荐

  • ChatGPT Plus微信支付宝充值开通方法

    想把 ChatGPT Plus 开到自己的账号,关键是解决付款和账号确认。 通过卡密充值,可以先用国内支付购买,再用 Session 确认当前 ChatGPT 账号。这样不需要切换共享账号,也能保留自己的使用记录和工作资料。

    未分类 2026 年 6 月 23 日
    12700
  • 2025年最新DataGrip永久破解教程(附激活码/注册码)

    本教程适用于JetBrains全家桶(IDEA/PyCharm/DataGrip/Goland等) 先看破解成果!成功激活至2099年,亲测可用! 下面将详细介绍DataGrip的完整破解流程,该方法同样适用于旧版本,支持全平台操作系统。 下载DataGrip官方安装包 已安装用户可跳过此步骤 访问官网下载:https://www.jetbrains.com…

    2025 年 5 月 8 日
    73300
  • pycharm激活码大全附pycharm破解方法

    PyCharm永久激活教程:2025最新破解补丁安装与使用全攻略(附激活码) 重要提示:本文涉及的PyCharm破解补丁及激活码资源均来源于网络收集,仅限个人学习研究使用,禁止任何商业用途。若条件允许,强烈建议前往JetBrains官网购买正版授权,以获得官方技术支持与持续更新服务。 PyCharm作为JetBrains旗下专为Python开发者打造的集成开…

    PyCharm激活码 2026 年 2 月 26 日
    27300
  • 永久pycharm激活码替换方法+最新pycharm破解说明

    重要声明:本文涉及的PyCharm破解补丁与激活码均源自网络收集,严禁用于商业用途,仅限个人学习研究使用。若资源存在侵权问题,请联系管理员删除。经济条件允许的话,强烈建议支持官方正版! PyCharm作为JetBrains旗下强大的Python集成开发环境,凭借其丰富的功能深受开发者喜爱。本指南将手把手教你如何利用破解补丁完成永久激活,解锁全部专业版功能。 …

    PyCharm激活码 2026 年 3 月 17 日
    57800
  • 永久破解IntelliJ IDEA 2025.3,激活码已更新

    申明:本教程 IntelliJ IDEA 破解补丁、激活码均收集于网络,请勿商用,仅供个人学习使用,如有侵权,请联系作者删除。若条件允许,希望大家购买正版 ! 废话不多说,先上 IDEA 2025.2.1 版本破解成功的截图,如下图,可以看到已经成功破解到 2099 年辣,舒服的很! 接下来就给大家通过图文的方式分享一下如何破解最新的IDEA。 如果觉得破解…

    IDEA破解教程 2026 年 3 月 26 日
    22800

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信