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 日

相关推荐

  • Java刷题常见的集合类,各种函数的使用以及常见的类型转化等等

    目录 前言 集合类 ArrayList 1. 创建和初始化 ArrayList 2.添加元素 add 3.获取元素 get 4.删除元素 remove 5.检查元素 6.遍历 ArrayList LinkedList Stack 1. 创建Stack对象 2. 压入元素 (push) 3. 弹出元素 (pop) 4. 查看栈顶元素 (peek) 5. 检查栈…

    2025 年 1 月 5 日
    47500
  • datagrip破解环境搭建+激活码配置技巧

    申明:本教程 DataGrip破解补丁、激活码均收集于网络,请勿商用,仅供个人学习使用,如有侵权,请联系作者删除。若条件允许,希望大家购买正版 ! DataGrip是 JetBrains 推出的开发编辑器,功能强大,适用于 Windows、Mac 和 Linux 系统。本文将详细介绍如何通过破解补丁实现永久激活,解锁所有高级功能。 如果觉得破解麻烦,可以购买…

    DataGrip激活码 2025 年 12 月 26 日
    2500
  • 全平台通用最新版goland激活码,权威破解教程一站查

    申明:本教程 GoLand破解补丁、激活码均收集于网络,请勿商用,仅供个人学习使用,如有侵权,请联系作者删除。若条件允许,希望大家购买正版 ! GoLand是 JetBrains 推出的开发编辑器,功能强大,适用于 Windows、Mac 和 Linux 系统。本文将详细介绍如何通过破解补丁实现永久激活,解锁所有高级功能。 不管你是什么版本、什么操作系统。都…

    4天前
    2000
  • CAS相关知识探索:疑问及解决办法

    CAS相关知识剖析:疑问与应对之策 何为CAS? CAS的全称是Compare And Swap,即比较与交换,是乐观锁的关键实现形式。CAS能在无需使用锁的状况下达成多线程间的变量同步。ReentrantLock内部的AQS以及原子类内部均运用了CAS。 CAS算法涉及三个操作数:- 需读写的内存值V。- 用于比较的值A。- 要写入的新值B。 仅当V的值与…

    2025 年 6 月 23 日
    22900
  • 2025年最新IDEA激活码分享 | 永久破解IDEA教程及注册码获取

    本文将详细介绍如何获取最新IDEA激活码并完成永久破解的全过程,适用于JetBrains全家桶(包括PyCharm、DataGrip、Goland等)。以下是详细图文教程: 破解效果预览 首先展示成功破解至2099年的效果截图,验证方法真实有效: 本方法适用于所有操作系统和版本,下面将分步骤详细说明。 第一步:下载IDEA安装包 若尚未安装,请前往官网下载:…

    IDEA破解教程 2025 年 7 月 17 日
    26700

发表回复

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

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

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

关注微信