API management

Updated at:
Copy as MD

This topic lists the OpenAPI operations for API management and describes their request and response parameters.

Create API information

You can use sofa.apigateway.api.create to create an API service.

Request parameters

Name

Type

Required

Example

Description

param

ApiInfoVO

Yes

-

parameter

tenant_id

STRING

Yes

TSCPDICNT

The tenant identity.

workspace_id

STRING

Yes

default

Workspace ID

Response parameters

Name

Type

Example

Description

data

ApiInfoVO

-

Data

Code examples

Request example

{
"param":{
"api_group_id":"fifhwqgcsmqo****",
"api_name":"api-test",
"app_type":"STANDARD",
"path":"/openapi/apigateway/test/api",
"method":"GET",
"content_type":"application/json",
"charset":"UTF-8",
"path_rule":1,
"upstream_type":"SYSTEM_CLUSTER",
"upstream_protocol":"HTTP",
"upstream_path":"/openapi/apigateway/test/api",
"router_type":"PATH",
"sys_id":"A3QV9pym9CaVKdLV0gIcQMsGNIpl****",
"downstream_protocol":"HTTP",
"timeout":3000,
},
"tenant_id":"JADDGOCN",
"workspace_id":"antdemo"
}

Response example

{
"data":true,
"result_code":"OK"
}

Delete an API by ID

You can use sofa.apigateway.api.delete to delete an API by its ID.

Request parameters

Name

Type

Required

Example

Description

api_id

STRING

Yes

8Amfi67dmE9wpY46

The API identity.

tenant_id

STRING

Yes

TSCPDICNT

The tenant identity.

workspace_id

STRING

Yes

default

The workspace identity.

Response parameters

Name

Type

Example

Description

data

BOOLEAN

true, false

Data

Code examples

Request example

{
"api_id":"p4UXmtfxcjkzAKIi9Zgqzr598oa3****",
"tenant_id":"JADDGOCN",
"workspace_id":"antdemo"
}

Response example

{
"data":true,
"result_code":"OK"
}

Update an API

You can use sofa.apigateway.api.update to update API information.

Request parameters

Name

Type

Required

Example

Description

param

ApiInfoVO

No

-

parameter

tenant_id

STRING

Yes

TSCPDICNT

The tenant identity.

workspace_id

STRING

Yes

default

The workspace identity.

Response parameters

Name

Type

Example

Description

data

BOOLEAN

true, false

Data

Code examples

Request example

{
"param":{
"api_group_id":"fifhwqgcsmq****",
"api_name":"api-test2",
"app_type":"STANDARD",
"path":"/openapi/apigateway/test/api1",
"method":"GET",
"content_type":"application/json",
"charset":"UTF-8",
"path_rule":1,
"upstream_type":"SYSTEM_CLUSTER",
"upstream_protocol":"HTTP",
"upstream_path":"/openapi/apigateway/test/api",
"router_type":"PATH",
"sys_id":"A3QV9pym9CaVKdLV0gIcQMsGNIpl****",
"downstream_protocol":"HTTP",
"timeout":3000,
"api_id":"IjiuBaYgvZLz2ODOvRWiQT3OGCqS****"
},
"tenant_id":"JADDGOCN",
"workspace_id":"antdemo"
}

Response example

{
"data":true,
"result_code":"OK"
}

Query an API by ID

You can use sofa.apigateway.api.get to query information about a specific API by its ID.

Request parameters

Name

Type

Required

Example

Description

api_id

STRING

Yes

8Amfi67dmE9wpY46

The API identity.

tenant_id

STRING

Yes

TSCPDICNT

The tenant identity.

workspace_id

STRING

Yes

default

The workspace identity.

Response parameters

Name

Type

Example

Description

data

ApiInfoVO

-

Data

Code examples

Request example

{
"api_id":"IjiuBaYgvZLz2ODOvRWiQT3OGCqSbDYu",
"tenant_id":"JADDGOCN",
"workspace_id":"antdemo"
}

Response example

{
"data":{
"gmt_create":"2020-03-27 14:12:43",
"tenant_id":"JADDGOCN",
"charset":"UTF-8",
"api_id":"IjiuBaYgvZLz2ODOvRWiQT3OGCqS****",
"app_type":"STANDARD",
"upstream_type":"SYSTEM_CLUSTER",
"gmt_modified":"2020-03-27 14:17:30",
"timeout":3000,
"operator":"",
"system_cluster":{
"tenant_id":"JADDGOCN",
"gmt_create":"2020-03-27 10:46:33",
"workspace_id":"antdemo",
"sys_id":"A3QV9pym9CaVKdLV0gIcQMsGNIpl****",
"upstream_protocol":"HTTP",
"host":[
"192.157.0.3:80",
"192.168.0.3:80"
],
"sys_name":"sys2",
"api_count":1,
"sys_type":"URL",
"gmt_modified":"2020-03-27 14:17:30",
"lb_type":"ROUND_ROBIN",
"operator":""
},
"workspace_id":"antdemo",
"upstream_path":"/openapi/apigateway/test/api1",
"sys_id":"A3QV9pym9CaVKdLV0gIcQMsGNIplTZwd",
"path":"/openapi/apigateway/test/api1",
"domain_name":"fifhwqgcsmqo9ycl.apigateway.inc.alipay.net",
"content_type":"application/json",
"api_group_name":"apigroup2",
"downstream_protocol":"HTTP",
"history_version_list":[],
"method":"GET",
"api_status":"CLOSED",
"api_group_id":"fifhwqgcsmqo9ycl",
"edit_version":{
"gmt_create":"2020-03-27 14:12:43",
"version_no":"20200327141243487-B0XAffhP",
"api_id":"IjiuBaYgvZLz2ODOvRWiQT3OGCqSbDYu",
"gmt_edit":"2020-03-27 14:17:30",
"version_id":"3VdYOmSsKAD07DuvX6EHvsnheXONfF80",
"gmt_modified":"2020-03-27 14:17:30"
},
"upstream_protocol":"HTTP",
"api_name":"api-test2",
"router_type":"PATH"
},
"result_code":"OK"
}

Query a list of APIs

You can use sofa.apigateway.api.all to query a list of all APIs.

Request parameters

Name

Type

Required

Example

Description

param

ApiInfoQueryVO

No

-

Parameter

tenant_id

STRING

Yes

TSCPDICNT

The tenant identity.

workspace_id

STRING

Yes

default

The workspace identity.

Response parameters

Name

Type

Example

Description

data

ARRAY[ApiInfoVO]

-

Data

Code examples

Request example

{
"param":{
"page_info":{
"page_index":1,
"page_size":10
},
"query":{}
},
"tenant_id":"JADDGOCN",
"workspace_id":"antdemo"
}

Response example

{
"data":[
{
"charset":"UTF-8",
"apiName":"api-test2",
"gmtModified":"2020-03-27 14:17:30",
"method":"GET",
"sysId":"A3QV9pym9CaVKdLV0gIcQMsGNIplTZwd",
"upstreamPath":"/openapi/apigateway/test/api1",
"routerType":"PATH",
"upstreamProtocol":"HTTP",
"gmtCreate":"2020-03-27 14:12:43",
"timeout":3000,
"operator":"",
"path":"/openapi/apigateway/test/api1",
"apiGroupId":"fifhwqgcsmqo9ycl",
"appType":"STANDARD",
"downstreamProtocol":"HTTP",
"tenantId":"JADDGOCN",
"contentType":"application/json",
"upstreamType":"SYSTEM_CLUSTER",
"apiId":"IjiuBaYgvZLz2ODOvRWiQT3OGCqSbDYu",
"apiStatus":"CLOSED",
"workspaceId":"antdemo"
},
{
"charset":"UTF-8",
"apiName":"rrrwe",
"gmtModified":"2020-03-26 11:58:29",
"method":"GET",
"upstreamPath":"/werwer",
"routerType":"HEADER",
"upstreamProtocol":"HTTP",
"gmtCreate":"2020-03-25 15:15:12",
"timeout":3000,
"operator":"",
"path":"/werwer",
"apiGroupId":"dumebnn9gbnyy02y",
"appType":"STANDARD",
"routerId":"aPdifmIr852vfqE4",
"downstreamProtocol":"HTTP",
"tenantId":"JADDGOCN",
"operationType":"wer.wer",
"contentType":"application/json",
"upstreamType":"SYSTEM_CLUSTER",
"apiId":"1h3WttiKTeTUtZpWn5Xg5P5bu2UBGjrP",
"apiStatus":"CLOSED",
"workspaceId":"antdemo"
}
],
"result_code":"OK"
}

Query a paginated list of APIs

You can use sofa.apigateway.api.list to query a paginated list of APIs.

Request parameters

Name

Type

Required

Example

Description

param

ApiInfoQueryVO

No

-

Parameter

tenant_id

STRING

Yes

TSCPDICNT

The tenant identity.

workspace_id

STRING

Yes

default

The workspace identity.

Response parameters

Name

Type

Example

Description

data

ApiInfoPagedListVO

-

Data

Code examples

Request example

{
"param":{
"page_info":{
"page_index":1,
"page_size":10
},
"query":{}
},
"tenant_id":"JADDGOCN",
"workspace_id":"antdemo"
}

Response example

{
"data":{
"page_info":{
"total":2,
"page_index":1,
"page_size":10
},
"list":[
{
"charset":"UTF-8",
"apiName":"api-test2",
"gmtModified":"2020-03-27 14:17:30",
"method":"GET",
"sysId":"A3QV9pym9CaVKdLV0gIcQMsGNIplTZwd",
"upstreamPath":"/openapi/apigateway/test/api1",
"routerType":"PATH",
"upstreamProtocol":"HTTP",
"gmtCreate":"2020-03-27 14:12:43",
"timeout":3000,
"operator":"",
"path":"/openapi/apigateway/test/api1",
"apiGroupId":"fifhwqgcsmqo9ycl",
"appType":"STANDARD",
"downstreamProtocol":"HTTP",
"tenantId":"JADDGOCN",
"contentType":"application/json",
"upstreamType":"SYSTEM_CLUSTER",
"apiId":"IjiuBaYgvZLz2ODOvRWiQT3OGCqSbDYu",
"apiStatus":"CLOSED",
"workspaceId":"antdemo"
},
{
"charset":"UTF-8",
"apiName":"rrrwe",
"gmtModified":"2020-03-26 11:58:29",
"method":"GET",
"upstreamPath":"/werwer",
"routerType":"HEADER",
"upstreamProtocol":"HTTP",
"gmtCreate":"2020-03-25 15:15:12",
"timeout":3000,
"operator":"",
"path":"/werwer",
"apiGroupId":"dumebnn9gbnyy02y",
"appType":"STANDARD",
"routerId":"aPdifmIr852vfqE4",
"downstreamProtocol":"HTTP",
"tenantId":"JADDGOCN",
"operationType":"wer.wer",
"contentType":"application/json",
"upstreamType":"SYSTEM_CLUSTER",
"apiId":"1h3WttiKTeTUtZpWn5Xg5P5bu2UBGjrP",
"apiStatus":"CLOSED",
"workspaceId":"antdemo"
}
]
},
"result_code":"OK"
}

Query a list of authorized applications by API ID

You can use sofa.apigateway.api.authapp.all to query a list of all applications authorized to call a specific API.

Request parameters

Name

Type

Required

Example

Description

api_id

STRING

Yes

8Amfi67dmE9wpY46

The API identity.

param

AuthAppInfoQueryVO

No

-

Parameter

tenant_id

STRING

Yes

TSCPDICNT

The tenant identity.

workspace_id

STRING

Yes

default

The workspace identity.

Response parameters

Name

Type

Example

Description

data

ARRAY[AuthAppInfoVO]

-

data

Code examples

Request example

{
"param":{
"page_info":{
"page_index":1,
"page_size":10
},
"query":{}
},
"api_id":"h4ZWfWe9anCJn4Tye3tPMiGJZJ2PeGWq",
"tenant_id":"JADDGOCN",
"workspace_id":"antdemo"
}

Response example

{
"data":[
{
"gmtModified":"2020-03-25 15:06:51",
"authAppType":"INNER",
"apiCount":1,
"gmtCreate":"2020-03-25 15:05:42",
"subWorkspaceId":"antdemo",
"operator":"",
"subTenantId":"JADDGOCN",
"appType":"STANDARD",
"subAppInfo":{
"gmtModified":"2020-03-25 15:06:51",
"appName":"test_lq",
"appId":"Oo2llCf0MkkhGtgL",
"tenantId":"JADDGOCN",
"apiCount":1,
"gmtCreate":"2020-03-25 15:04:30",
"operator":"",
"workspaceId":"antdemo"
},
"authAppInfoId":"H71mhS7Co7CyY6YI",
"authenticationType":"SECRET",
"encryptType":"NONE",
"subAppId":"Oo2llCf0MkkhGtgL"
}
],
"result_code":"OK"
}

Query a paginated list of authorized applications by API ID

You can use sofa.apigateway.api.authapp.list to query a paginated list of applications authorized to call a specific API.

Request parameters

Name

Type

Required

Example

Description

api_id

STRING

Yes

8Amfi67dmE9wpY46

The API identity.

param

AuthAppInfoQueryVO

No

-

Parameter

tenant_id

STRING

Yes

TSCPDICNT

The tenant identity.

workspace_id

STRING

Yes

default

Workspace Identity

Response parameters

Name

Type

Example

Description

data

AuthAppInfoPagedListVO

-

Data

Code examples

Request example

{
"param":{
"page_info":{
"page_index":1,
"page_size":10
},
"query":{}
},
"api_id":"h4ZWfWe9anCJn4Tye3tPMiGJZJ2PeGWq",
"tenant_id":"JADDGOCN",
"workspace_id":"antdemo"
}

Response example

{
"data":{
"page_info":{
"total":1,
"page_index":1,
"page_size":10
},
"list":[
{
"gmtModified":"2020-03-25 15:06:51",
"authAppType":"INNER",
"apiCount":1,
"gmtCreate":"2020-03-25 15:05:42",
"subWorkspaceId":"antdemo",
"operator":"",
"subTenantId":"JADDGOCN",
"appType":"STANDARD",
"subAppInfo":{
"gmtModified":"2020-03-25 15:06:51",
"appName":"test_lq",
"appId":"Oo2llCf0MkkhGtgL",
"tenantId":"JADDGOCN",
"apiCount":1,
"gmtCreate":"2020-03-25 15:04:30",
"operator":"",
"workspaceId":"antdemo"
},
"authAppInfoId":"H71mhS7Co7CyY6YI",
"authenticationType":"SECRET",
"encryptType":"NONE",
"subAppId":"Oo2llCf0MkkhGtgL"
}
]
},
"result_code":"OK"
}

Attach authorized applications to an API

You can use sofa.apigateway.api.authapp.mount to attach authorized applications to a specific API.

Request parameters

Name

Type

Required

Example

Description

api_id

STRING

Yes

8Amfi67dmE9wpY46

The API identity.

auth_app_info_id_list

ARRAY[STRING]

Yes

-

A list of authorized application identities.

tenant_id

STRING

Yes

TSCPDICNT

The tenant identity.

workspace_id

STRING

Yes

default

The workspace identity.

Response parameters

Name

Type

Example

Description

data

BOOLEAN

true, false

data

Code examples

Request example

{
"auth_app_info_id_list":[
"hg42jDqSYGREHHKN"
],
"api_id":"h4ZWfWe9anCJn4Tye3tPMiGJZJ2PeGWq",
"tenant_id":"JADDGOCN",
"workspace_id":"antdemo"
}

Response example

{
"data":true,
"result_code":"OK"
}

Detach authorized applications from an API

You can use sofa.apigateway.api.authapp.unmount to detach authorized applications from a specific API.

Request parameters

Name

Type

Required

Example

Description

api_id

STRING

Yes

api_id

The API identity.

auth_app_info_id_list

ARRAY[STRING]

Yes

-

auth_app_info_id_list

tenant_id

STRING

Yes

tenant_id

tenant_id

workspace_id

STRING

Yes

workspace_id

workspace_id

Response parameters

Name

Type

Example

Description

data

BOOLEAN

true, false

Data

Code examples

Request example

{
"api_id":"h4ZWfWe9anCJn4Tye3tPMiGJZJ2PeGWq",
"auth_app_info_id_list":[
"H71mhS7Co7CyY6YI"
],
"tenant_id":"JADDGOCN",
"workspace_id":"antdemo"
}

Response example

{
"data":true,
"result_code":"OK"
}

Publish an API

You can use sofa.apigateway.api.online to publish a specific API.

Request parameters

Name

Type

Required

Example

Description

api_id_list

ARRAY[STRING]

Yes

-

A list of identities for the APIs to publish.

online_desc

STRING

No

online_desc1

The description for publishing.

tenant_id

STRING

Yes

TSCPDICNT

The tenant identity.

workspace_id

STRING

Yes

default

The workspace identity.

Response parameters

Name

Type

Example

Description

data

BOOLEAN

true, false

Data

Code examples

Request example

{
"api_id_list":[
"xN0YItcXFg9Ny6BRLFXaFv4fGHjt24P2"
],
"tenant_id":"JADDGOCN",
"workspace_id":"antdemo"
}

Response example

{
"data":true,
"result_code":"OK"
}

Unpublish an API

You can use sofa.apigateway.api.offline to unpublish an API service.

Request parameters

Name

Type

Required

Example

Description

api_id_list

ARRAY[STRING]

Yes

-

API IDs for publishing

offline_desc

STRING

No

offline_desc1

The description for unpublishing.

tenant_id

STRING

Yes

TSCPDICNT

The tenant identity.

workspace_id

STRING

Yes

default

Workspace identifier

Response parameters

Name

Type

Example

Description

data

BOOLEAN

true, false

data

Code examples

Request example

{
"api_id_list":[
"h4ZWfWe9anCJn4Tye3tPMiGJZJ2P****"
],
"tenant_id":"JADDGOCN",
"workspace_id":"antdemo"
}

Response example

{
"data":true,
"result_code":"OK"
}

Get a specific version of an API

You can use sofa.apigateway.api.versionapi.get to query information about a specific version of an API.

Request parameters

Name

Type

Required

Example

Description

api_id

STRING

Yes

api_id

The API identity.

tenant_id

STRING

Yes

tenant_id

The tenant ID.

version_id

STRING

Yes

version_id

The version number.

workspace_id

STRING

Yes

workspace_id

The workspace ID.

Response parameters

Name

Type

Example

data

ApiInfoVO

data

Code examples

Request example

{
"api_id":"IjiuBaYgvZLz2ODOvRWiQT3OGCqSbDYu",
"version_id":"3VdYOmSsKAD07DuvX6EHvsnheXO****",
"tenant_id":"JADDGOCN",
"workspace_id":"antdemo"
}

Response example

{
"data":{
"gmt_create":"2020-03-27 14:12:43",
"tenant_id":"JADDGOCN",
"charset":"UTF-8",
"api_id":"IjiuBaYgvZLz2ODOvRWiQT3OGCqSbDYu",
"app_type":"STANDARD",
"method":"GET",
"upstream_type":"SYSTEM_CLUSTER",
"api_status":"CLOSED",
"gmt_modified":"2020-03-27 14:17:30",
"timeout":3000,
"operator":"",
"system_cluster":{
"tenant_id":"JADDGOCN",
"gmt_create":"2020-03-27 10:46:33",
"workspace_id":"antdemo",
"sys_id":"A3QV9pym9CaVKdLV0gIcQMsGNIplTZwd",
"upstream_protocol":"HTTP",
"host":[
"192.157.1.3:80",
"192.168.2.3:80"
],
"sys_name":"sys2",
"api_count":1,
"sys_type":"URL",
"gmt_modified":"2020-03-27 14:17:30",
"lb_type":"ROUND_ROBIN",
"operator":""
},
"upstream_path":"/openapi/apigateway/test/api1",
"api_group_id":"fifhwqgcsmqo9ycl",
"workspace_id":"antdemo",
"sys_id":"A3QV9pym9CaVKdLV0gIcQMsGNIplTZwd",
"path":"/openapi/apigateway/test/api1",
"domain_name":"fifhwqgcsmqo9ycl.apigateway.inc.alipay.net",
"upstream_protocol":"HTTP",
"content_type":"application/json",
"api_group_name":"apigroup2",
"api_name":"api-test2",
"downstream_protocol":"HTTP",
"router_type":"PATH"
},
"result_code":"OK"
}

Update an API version number

You can use sofa.apigateway.api.versionno.update to update the version number of an API.

Request parameters

Name

Type

Required

Example

Description

api_id

STRING

Yes

8Amfi67dmE9wpY46

The API identity.

tenant_id

STRING

Yes

TSCPDICNT

The tenant identity.

version_no

STRING

Yes

version_no1

The version number.

workspace_id

STRING

Yes

default

The workspace identity.

Response parameters

Name

Type

Example

Description

data

BOOLEAN

true, false

data

Code examples

Request example

{
"api_id":"IjiuBaYgvZLz2ODOvRWiQT3OGCqSbDYu",
"version_no":"20200327141243487-B0XAffhP",
"tenant_id":"JADDGOCN",
"workspace_id":"antdemo"
}

Response example

{
"data":true,
"result_code":"OK"
}