找回密码
 立即注册
首页 业界区 业界 wso2~api生命周期与关联事件

wso2~api生命周期与关联事件

刘凤 2025-6-14 11:04:27
api生命周期

1.jpeg


  • CREATED 建立
  • PRE-RELEASED 预发布
  • PUBLISHED 发布
  • DEPRECATED 删除
  • BLOCKED 冻结
  • RETIRED 退役
状态为Published的api,可以在devportal平台即使用者访问
api的获取

/api/am/devportal/apis/{apiId}
  1. {
  2.     "id": "06bba96d-a591-4779-a7f0-ed721fb147aa",
  3.     "name": "百度",
  4.     "description": null,
  5.     "context": "/baidu/v1",
  6.     "version": "v1",
  7.     "provider": "admin",
  8.     "apiDefinition": "",
  9.     "wsdlUri": null,
  10.     "lifeCycleStatus": "PUBLISHED",
  11.     "isDefaultVersion": false,
  12.     "type": "HTTP",
  13.     "transport": [
  14.         "http",
  15.         "https"
  16.     ],
  17.     "operations": [],
  18.     "authorizationHeader": "Authorization",
  19.     "apiKeyHeader": "ApiKey",
  20.     "securityScheme": [
  21.         "oauth_basic_auth_api_key_mandatory",
  22.         "oauth2"
  23.     ],
  24.     "tags": [],
  25.     "tiers": [
  26.         {
  27.             "tierName": "专业版",
  28.             "tierPlan": "FREE",
  29.             "monetizationAttributes": null
  30.         }
  31.     ],
  32.     "hasThumbnail": false,
  33.     "additionalProperties": [],
  34.     "monetization": {
  35.         "enabled": false
  36.     },
  37.     "endpointURLs": [
  38.         {
  39.             "environmentName": "Default",
  40.             "environmentDisplayName": "Default",
  41.             "environmentType": "hybrid",
  42.             "URLs": {
  43.                 "http": "http://test-gateway-am-wso2.xxx.com/baidu/v1",
  44.                 "https": "https://test-gateway-am-wso2.xxx.com/baidu/v1",
  45.                 "ws": null,
  46.                 "wss": null
  47.             },
  48.             "defaultVersionURLs": {
  49.                 "http": null,
  50.                 "https": null,
  51.                 "ws": null,
  52.                 "wss": null
  53.             }
  54.         }
  55.     ],
  56.     "businessInformation": {
  57.         "businessOwner": null,
  58.         "businessOwnerEmail": null,
  59.         "technicalOwner": null,
  60.         "technicalOwnerEmail": null
  61.     },
  62.     "environmentList": [
  63.         "Default"
  64.     ],
  65.     "scopes": [],
  66.     "avgRating": "0.0",
  67.     "subscriptions": 0,
  68.     "advertiseInfo": {
  69.         "advertised": false,
  70.         "apiExternalProductionEndpoint": null,
  71.         "apiExternalSandboxEndpoint": null,
  72.         "originalDevPortalUrl": null,
  73.         "apiOwner": "admin",
  74.         "vendor": "WSO2"
  75.     },
  76.     "isSubscriptionAvailable": true,
  77.     "categories": [],
  78.     "keyManagers": [
  79.         "all"
  80.     ],
  81.     "createdTime": "2025-06-13 05:31:24.000",
  82.     "lastUpdatedTime": null,
  83.     "gatewayVendor": "wso2",
  84.     "asyncTransportProtocols": [],
  85.     "egress": false,
  86.     "subtype": "DEFAULT"
  87. }
复制代码
api建立与发布


  • 出现场景:api发布者在后台添加api之后,执行create and deploy动作,而且建立后,在Publish > Lifecycle中选择Published,完成api的发布
  • topic apim
  • 条件 event.payloadData.eventType"API_LIFECYCLE_CHANGE" and event.payloadData.event.lifecycleEvent"ublish"
  • event.payloadData.event实体结构,先base64解码
  1. {
  2.     "apiName": "user-info-api",
  3.     "apiId": 39,
  4.     "uuid": "8c209615-bc40-44a9-b31e-1a4e8c479b1d",
  5.     "apiVersion": "v1",
  6.     "apiContext": "/user/v1",
  7.     "apiProvider": "admin",
  8.     "apiType": "HTTP",
  9.     "apiStatus": "PUBLISHED",
  10.     "securityScheme": "oauth_basic_auth_api_key_mandatory,oauth2",
  11.     "currentStatus": "CREATED",
  12.     "apiVisibility": "public",
  13.     "lifecycleEvent": "Publish",
  14.     "eventId": "6fe0f743-b659-4a6f-b579-c94599b9901f",
  15.     "timeStamp": 1749721922584,
  16.     "type": "API_LIFECYCLE_CHANGE",
  17.     "tenantId": -1234,
  18.     "tenantDomain": "carbon.super"
  19. }
复制代码
api更新

2.jpeg


  • 出现场景:api发布者在后台对api的策略进行调整,如在Portal Configurations > Subscriptions菜单下面,添加标准版,高级版,删除VIP版等
  • topic apim
  • 条件 event.payloadData.eventType"API_UPDATE" and event.payloadData.event.currentStatus"UBLISHED",
  • event.payloadData.event实体结构,先base64解码
  1. {
  2.     "apiName": "xiaohezi01",
  3.     "apiId": 40,
  4.     "uuid": "538afd3f-3b05-46c2-96e9-28412c115f85",
  5.     "apiVersion": "v1",
  6.     "apiContext": "/xiaohezi/v1",
  7.     "apiProvider": "admin",
  8.     "apiType": "HTTP",
  9.     "apiStatus": "PUBLISHED",
  10.     "securityScheme": "oauth_basic_auth_api_key_mandatory,oauth2",
  11.     "currentStatus": "PUBLISHED",
  12.     "apiVisibility": "public",
  13.     "apiVisibleRoles": "",
  14.     "eventId": "02743376-5da1-4d12-9281-9f8520aae705",
  15.     "timeStamp": 1749778764066,
  16.     "type": "API_UPDATE",
  17.     "tenantId": -1234,
  18.     "tenantDomain": "carbon.super"
  19. }
复制代码
api从发布到下线


  • 出现场景:api发布者在Publish > Lifecycle菜单中,去点击Pre-Release,将发布的接口下线
  • topic apim
  • 条件  event.payloadData.eventType=="API_LIFECYCLE_CHANGE" and event.payloadData.event.lifecycleEvent!="ublish"
  • event.payloadData.event实体结构,先base64解码
  1. {
  2.     "apiName": "xiaohezi01",
  3.     "apiId": 40,
  4.     "uuid": "538afd3f-3b05-46c2-96e9-28412c115f85",
  5.     "apiVersion": "v1",
  6.     "apiContext": "/xiaohezi/v1",
  7.     "apiProvider": "admin",
  8.     "apiType": "HTTP",
  9.     "apiStatus": "PROTOTYPED",
  10.     "securityScheme": "oauth_basic_auth_api_key_mandatory,oauth2",
  11.     "currentStatus": "PUBLISHED",
  12.     "apiVisibility": "public",
  13.     "lifecycleEvent": "Deploy as a Prototype",
  14.     "eventId": "25d4abc0-f74b-4692-9a7b-579e2656c05a",
  15.     "timeStamp": 1749777184970,
  16.     "type": "API_LIFECYCLE_CHANGE",
  17.     "tenantId": -1234,
  18.     "tenantDomain": "carbon.super"
  19. }
复制代码
来源:程序园用户自行投稿发布,如果侵权,请联系站长删除
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
您需要登录后才可以回帖 登录 | 立即注册