调用云托管服务
GEThttps://your-envId.api.tcloudbasegateway.com/v1/cloudrun/:name/:anyPath
调用指定云托管服务。
通过开放 API 访问云托管时,针对可能存在的合规封禁风险,开放 API 会对响应头进行如下更改:
- 对于所有的
GET
请求返回的响应,响应头添加Content-Disposition: attachment
; - 对于非文本类型(文本类型包括响应头
Content-Type
中指示application/json
、application/x-www-form-urlencoded
、text/plain
类型的返回内容)的响应,响应头添加Content-Disposition: attachment
;
注意:
SSE(Server-Sent Event)
和WebSocket
请求不受到上述限制。
Request
Path Parameters
name stringrequired
Possible values: Value must match regular expression ^[a-zA-Z][a-zA-Z0-9_-]{0,58}[a-zA-Z0-9]$
需要调用的服务名称
anyPath string
追加任意路径
Responses
- 200
- 403
- 404
- default
调用成功时返回
Response Headers
- application/json
- text/plain
- Schema
- Example (from schema)
- Echo
Schema
property name* any
{}
echo
{
"a": 1,
"b": 2
}
- Schema
- Text
Schema
string
text
Hello world
云托管服务调用出错时返回
Response Headers
- application/json
- Schema
- Example (from schema)
- ServiceForbidden
Schema
code 错误码 (string)
message 错误信息 (string)
requestId 请求 ID (string)
{
"code": "string",
"message": "string",
"requestId": "string"
}
云托管服务拒绝访问
{
"code": "SERVICE_FORBIDDEN",
"message": "Service forbidden. For more information, please refer to https://docs.cloudbase.net/error-code/service",
"requestId": "yyxxxxxx-yyyy-yyyy-zzzz-xxxxxxzzyyyy"
}
云托管服务调用出错时返回
Response Headers
- application/json
- Schema
- Example (from schema)
- ServiceNotFound
Schema
code 错误码 (string)
message 错误信息 (string)
requestId 请求 ID (string)
{
"code": "string",
"message": "string",
"requestId": "string"
}
未找到云托管服务
{
"code": "SERVICE_NOT_FOUND",
"message": "Service not found. For more information, please refer to https://docs.cloudbase.net/error-code/service",
"requestId": "yyxxxxxx-yyyy-yyyy-zzzz-xxxxxxzzyyyy"
}
Response Headers
- application/json
- Schema
- Example (from schema)
- InvalidHost
Schema
code 错误码 (string)
message 错误信息 (string)
requestId 请求 ID (string)
{
"code": "string",
"message": "string",
"requestId": "string"
}
请求地址异常
{
"code": "INVALID_HOST",
"message": "xxx",
"requestId": "xxx"
}
Authorization: http
name: JWTAuthtype: httpscheme: bearerdescription: 环境 ID 所对应的 token,使用登录鉴权(v2)获取
- curl
- python
- go
- nodejs
- ruby
- csharp
- php
- java
- powershell
- CURL
curl -L 'https://your-envId.api.tcloudbasegateway.com/v1/cloudrun/:name/:anyPath' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>'
ResponseClear