查询消费者授权规则列表。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
授权信息
下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:
- 操作:是指具体的权限点。
- 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
- 资源类型:是指操作中支持授权的资源类型。具体说明如下:
- 对于必选的资源类型,用前面加 * 表示。
- 对于不支持资源级授权的操作,用
全部资源表示。
- 条件关键字:是指云产品自身定义的条件关键字。
- 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
| 操作 | 访问级别 | 资源类型 | 条件关键字 | 关联操作 |
|---|---|---|---|---|
| apig:QueryConsumerAuthorizationRules | none | *全部资源 * |
| 无 |
请求语法
GET /v1/authorization-rules HTTP/1.1
请求参数
| 名称 | 类型 | 必填 | 描述 | 示例值 |
|---|---|---|---|---|
| apiNameLike | string | 否 | API 名。 | api-xx |
| pageNumber | integer | 否 | 分页页码。 | 1 |
| pageSize | integer | 否 | 分页大小。 | 10 |
| consumerId | string | 否 | 消费者 ID。 | cs-ct21c16m1hkp64hk6qmg |
| resourceId | string | 否 | 资源 ID。 | ha-cn-li942gy8p03 |
| resourceType | string | 否 | 资源类型。 | HttpApiRoute |
| environmentId | string | 否 | 环境 ID。 | env-cpqnr6tlhtgubc*** |
| groupByApi | boolean | 否 | 通过 API 分组。 | true |
| parentResourceId | string | 否 | 父项资源 ID。 | ha-cn-li942gy8p01 |
| consumerNameLike | string | 否 | 消费者名称。 | consumer-xxx |
| resourceTypes | string | 否 | 服务来源类型 | K8S |
返回参数
示例
正常返回示例
JSON格式
{
"requestId": "A60EE5CA-1294-532A-9775-8D2FD1C6EFBF",
"code": "Ok",
"message": "success",
"data": {
"totalSize": 6,
"pageNumber": 1,
"pageSize": 10,
"items": [
{
"consumerAuthorizationRuleId": "car-csgeka5lhtggrjcprok0",
"consumerId": "cs-csheiftlhtgmp0j0hp4g",
"apiInfo": {
"httpApiId": "api-xxx",
"name": "test",
"basePath": "/v1",
"description": "测试专用API",
"versionInfo": {
"enable": true,
"scheme": "Query",
"headerName": "my-version",
"queryName": "myVersion",
"version": "v1"
},
"ingressInfo": {
"sourceId": "src-xxx",
"ingressClass": "mse",
"watchNamespace": "default",
"environmentInfo": {
"environmentId": "env-xxx"
},
"k8sClusterInfo": {
"clusterId": "ca435c77cba1547cca9311957bcxxxxxx"
},
"overrideIngressIp": true
},
"type": "Rest",
"resourceGroupId": "rg-xxx",
"enabelAuth": true,
"authConfig": {
"authType": "Jwt",
"authMode": "NoAuth"
},
"gatewayId": "gw-cpv4sqdl****",
"modelCategory": "Text",
"protocols": [
"HTTP"
],
"environments": [
{
"environmentId": "env-xxx",
"backendScene": "SingleService",
"backendType": "Service",
"serviceConfigs": [
{
"gatewayServiceId": "gs-xxx",
"name": "demo-service",
"protocol": "HTTP",
"port": 8080,
"weight": 100,
"version": "v1",
"match": {
"default": true,
"conditions": [
{
"type": "Query",
"key": "color",
"value": "gray",
"operator": "equal"
}
]
},
"serviceId": "svc-xxx"
}
],
"customDomains": [
{
"domainId": "d-xxx",
"name": "www.example.com",
"protocol": "HTTP"
}
],
"name": "test",
"alias": "test",
"gatewayInfo": {
"gatewayId": "gw-xxx",
"name": "test"
},
"deployStatus": "Deployed",
"subDomains": [
{
"domainId": "d-xxx",
"name": "www.example.com",
"protocol": "HTTP",
"networkType": "Internet"
}
]
}
],
"aiProtocols": [
"OpenAI/v1"
],
"deployConfigs": [
{
"environmentId": "env-xxx",
"backendScene": "SingleService",
"autoDeploy": true,
"gatewayId": "gw-xx",
"routeBackend": {
"scene": "Single",
"services": [
{
"serviceId": "service-cq2bmmdlhtgj***",
"name": "item-service",
"protocol": "HTTP",
"port": 0,
"weight": 49,
"version": "v1"
}
]
},
"gatewayInfo": {
"gatewayId": "gw-cq7og15lhtgi6qasrj60",
"name": "apitest-gw",
"vpcInfo": {
"vpcId": "vpc-uf664nyle5kh***",
"name": "商品中心预发环境专有网络"
},
"engineVersion": "2.0.7"
},
"mock": {
"enable": false,
"responseCode": 200,
"responseContent": "Mock测试"
},
"gatewayType": "API",
"customDomainIds": [
"d-xxx"
],
"serviceConfigs": [
{
"serviceId": "svc-xxx",
"weight": 100,
"modelNamePattern": "qwen-*",
"modelName": "qwen-max",
"intentCode": "INQUIRY",
"match": {
"default": true,
"conditions": [
{
"type": "Query",
"key": "color",
"value": "gray",
"operator": "equal"
}
]
}
}
],
"policyConfigs": [
{
"type": "AiFallback",
"enable": true,
"aiFallbackConfig": {
"serviceConfigs": [
{
"serviceId": "svc-******",
"targetModelName": "gpt-4/llama3-70b"
}
]
},
"aiSecurityGuardConfig": {
"serviceAddress": "https://api.example.com/v1",
"checkRequest": true,
"checkResponse": true,
"checkRequestImage": true,
"checkResponseImage": true,
"requestCheckService": "https://checker.example.com/validate-request",
"responseCheckService": "https://checker.example.com/validate-response",
"requestImageCheckService": "https://image-checker.example.com/scan",
"responseImageCheckService": "https://image-checker.example.com/scan-response",
"riskAlertLevel": "low/medium/high",
"riskConfig": [
{
"type": "K8S",
"level": "Critical",
"consumerRules": {
"pattern": "first",
"matchType": "term"
}
}
],
"bufferLimit": 50,
"consumerRequestCheckService": [
{
"name": "API",
"requestCheckService": "https://checker.example.com/validate",
"requestImageCheckService": "https://image-check.example.com/scan",
"matchType": "exact/prefix",
"modalityType": "text/image"
}
],
"consumerResponseCheckService": [
{
"name": "AI_API",
"responseCheckService": "https://checker.example.com/validate-response",
"responseImageCheckService": "https://image-check.example.com/scan-response",
"matchType": "term",
"modalityType": "text/image"
}
],
"consumerRiskLevel": [
{
"name": "APIG-UI",
"matchType": "term",
"type": "K8S",
"level": "Critical"
}
]
},
"aiTokenRateLimitConfig": {
"rules": [
{
"limitType": "request/token",
"matchKey": "user_id/api_path",
"matchType": "term",
"matchValue": "user123",
"limitMode": "local",
"limitValue": 100
}
],
"globalRules": [
{
"limitType": "request",
"matchKey": "user_id",
"matchType": "term",
"matchValue": "user123",
"limitMode": "local",
"limitValue": 100
}
],
"enableGlobalRules": true
}
}
],
"customDomainInfos": [
{
"domainId": "d-cshee6dlhtgk******",
"name": "hello-server.com",
"protocol": "HTTP"
}
],
"subDomains": [
{
"domainId": "d-csmn42um******",
"name": "test",
"protocol": "HTTP",
"networkType": "Intranet"
}
]
}
],
"deployCntMap": {
"key": {
"deployedCnt": 3,
"Cnt": 5
}
},
"agentProtocols": [
"DashScope"
]
},
"environmentInfo": {
"environmentId": "env-cq7l5s5lhtgi6qasrdc0",
"name": "test",
"alias": "测试环境",
"description": "这是xxx的xx项目测试环境",
"gatewayInfo": {
"gatewayId": "gw-cq7og15lhtgi6qasrj60",
"name": "apitest-gw",
"vpcInfo": {
"vpcId": "vpc-uf664nyle5kh***",
"name": "商品中心预发环境专有网络"
},
"engineVersion": "2.0.7"
},
"subDomainInfos": [
{
"domainId": "d-cpudb0llhtgl2djvq2sg",
"name": "abc.com",
"protocol": "HTTP",
"networkType": "Intranet"
}
],
"default": false,
"createTimestamp": 1721116090326,
"updateTimestamp": 1721116090326,
"resourceGroupId": "rg-xxxx"
},
"gatewayInfo": {
"gatewayId": "gw-cq7og15lhtgi6qasrj60",
"name": "apitest-gw",
"vpcInfo": {
"vpcId": "vpc-uf664nyle5kh***",
"name": "商品中心预发环境专有网络"
},
"engineVersion": "2.0.7"
},
"resourceId": 2351944,
"resourceType": "HttpApiRoute",
"expireStatus": "InEffect",
"expireMode": "ShortTerm",
"expireTimestamp": 172086834548,
"createTimestamp": 1719386834548,
"updateTimestamp": 1719386834548,
"deployStatus": {},
"consumerInfo": {
"consumerId": "cs-ctd4l1um1hkph7ki1k80",
"name": "test",
"enable": false
},
"resourceInfo": {
"route": {
"routeId": "hr-crf5l7tlhtgp91t***",
"name": "itemcenter-pre-route",
"deployStatus": "Deployed",
"description": "商品中心预发路由",
"match": {
"ignoreUriCase": true,
"path": {
"type": "Prefix",
"value": "/user"
},
"headers": [
{
"type": "Exact",
"name": "dev",
"value": true
}
],
"methods": [
"GET"
],
"queryParams": [
{
"type": "Exact",
"name": "age",
"value": 17
}
]
},
"backend": {
"scene": "Single",
"services": [
{
"serviceId": "service-cq2bmmdlhtgj***",
"name": "item-service",
"protocol": "HTTP",
"port": 0,
"weight": 49,
"version": "v1"
}
]
},
"environmentInfo": {
"environmentId": "env-crhq1u5lhtgju***",
"name": "itemcenter-pre",
"alias": "商品中心预发环境",
"gatewayInfo": {
"gatewayId": "gw-cqoohqtlh***",
"name": "itemcenter-gateway"
},
"subDomains": [
{
"domainId": "d-cqu19hdlhtgjuv4***",
"name": "env-crmic3llht***-cn-hangzhou-vpc.alicloudapi.com",
"protocol": "HTTP",
"networkType": "Internet"
}
]
},
"createTimestamp": 1726649310593,
"updateTimestamp": 1726819895636,
"mcpServerInfo": {
"importInstanceId": "import-001",
"importNamespace": "default",
"importMcpServerId": "mcp-002",
"createFromType": "Nacos",
"mcpServerConfig": "{\\\"config\\\":{}}",
"mcpRouteConfig": {
"protocol": "SSE",
"exposedUriPath": "/mcp"
}
},
"domainInfos": [
{
"domainId": "d-cr3v7dllhtgi9s***",
"name": "itemcenter.dev",
"protocol": "HTTP"
}
],
"gatewayStatus": {
"key": "Running"
},
"builtin": true
},
"operationInfo": {
"operationId": "op-xxx",
"method": "GET",
"name": "GetUserInfo",
"path": "/user/123",
"description": "获取用户信息",
"response": {
"contentType": "application/json",
"items": [
{
"code": 200,
"example": {
"result": "ok"
},
"description": "正常接口响应",
"jsonSchema": {
"type": "object",
"required": [
"result"
],
"properties": {
"result": {
"type": "string",
"description": "操作结果,'ok' 表示成功"
}
}
}
}
]
},
"request": {
"headerParameters": [
{
"name": "userId",
"required": true,
"type": "String",
"defaultValue": 123,
"exampleValue": 123,
"description": "用户ID"
}
],
"queryParameters": [
{
"name": "userId",
"required": true,
"type": "String",
"defaultValue": 123,
"exampleValue": 123,
"description": "用户ID"
}
],
"pathParameters": [
{
"name": "userId",
"required": true,
"type": "String",
"defaultValue": 123,
"exampleValue": 123,
"description": "用户ID"
}
],
"body": {
"description": "body参数描述",
"example": {
"result": "ok"
},
"contentType": "application/json",
"jsonSchema": {
"type": "object",
"required": [
"result"
],
"properties": {
"result": {
"type": "string",
"description": "操作结果,'ok' 表示成功"
}
}
}
}
},
"mock": {
"enable": false,
"responseCode": 200,
"responseContent": "Mock测试"
},
"createTimestamp": 1719386834548,
"enableAuth": true,
"authConfig": {
"authType": "Jwt",
"authMode": "NoAuth"
},
"status": "Deployed",
"deployConfigs": [
{
"environmentId": "env-xxx",
"backendScene": "SingleService",
"autoDeploy": true,
"gatewayId": "gw-xx",
"routeBackend": {
"scene": "Single",
"services": [
{
"serviceId": "service-cq2bmmdlhtgj***",
"name": "item-service",
"protocol": "HTTP",
"port": 0,
"weight": 49,
"version": "v1"
}
]
},
"mock": {
"enable": false,
"responseCode": 200,
"responseContent": "Mock测试"
},
"gatewayType": "API",
"customDomainIds": [
"d-xxx"
],
"serviceConfigs": [
{
"serviceId": "svc-xxx",
"weight": 100,
"modelNamePattern": "qwen-*",
"modelName": "qwen-max",
"intentCode": "INQUIRY",
"match": {
"default": true,
"conditions": [
{
"type": "Query",
"key": "color",
"value": "gray",
"operator": "equal"
}
]
}
}
],
"policyConfigs": [
{
"type": "AiFallback",
"enable": true,
"aiFallbackConfig": {
"serviceConfigs": [
{
"serviceId": "svc-******",
"targetModelName": "gpt-4/llama3-70b"
}
]
},
"aiSecurityGuardConfig": {
"serviceAddress": "https://api.example.com/v1",
"checkRequest": true,
"checkResponse": true,
"checkRequestImage": true,
"checkResponseImage": true,
"requestCheckService": "https://checker.example.com/validate-request",
"responseCheckService": "https://checker.example.com/validate-response",
"requestImageCheckService": "https://image-checker.example.com/scan",
"responseImageCheckService": "https://image-checker.example.com/scan-response",
"riskAlertLevel": "low/medium/high",
"riskConfig": [
{
"type": "K8S",
"level": "Critical",
"consumerRules": {
"pattern": "first",
"matchType": "term"
}
}
],
"bufferLimit": 50,
"consumerRequestCheckService": [
{
"name": "API",
"requestCheckService": "https://checker.example.com/validate",
"requestImageCheckService": "https://image-check.example.com/scan",
"matchType": "exact/prefix",
"modalityType": "text/image"
}
],
"consumerResponseCheckService": [
{
"name": "AI_API",
"responseCheckService": "https://checker.example.com/validate-response",
"responseImageCheckService": "https://image-check.example.com/scan-response",
"matchType": "term",
"modalityType": "text/image"
}
],
"consumerRiskLevel": [
{
"name": "APIG-UI",
"matchType": "term",
"type": "K8S",
"level": "Critical"
}
]
},
"aiTokenRateLimitConfig": {
"rules": [
{
"limitType": "request/token",
"matchKey": "user_id/api_path",
"matchType": "term",
"matchValue": "user123",
"limitMode": "local",
"limitValue": 100
}
],
"globalRules": [
{
"limitType": "request",
"matchKey": "user_id",
"matchType": "term",
"matchValue": "user123",
"limitMode": "local",
"limitValue": 100
}
],
"enableGlobalRules": true
}
}
],
"customDomainInfos": [
{
"domainId": "d-cshee6dlhtgk******",
"name": "hello-server.com",
"protocol": "HTTP"
}
],
"subDomains": [
{
"domainId": "d-csmn42um******",
"name": "test",
"protocol": "HTTP",
"networkType": "Intranet"
}
]
}
]
}
}
}
]
}
}错误码
访问错误中心查看更多错误码。
变更历史
| 变更时间 | 变更内容概要 | 操作 |
|---|---|---|
| 2025-07-24 | OpenAPI 入参发生变更 | 查看变更详情 |
