Invoke cloud function
POST/v1/functions/:name
Invoke the specified cloud function.
Function invocation permissions are subject to cloud function security rules and identity authentication. Ensure the requesting identity has the required permissions to invoke the target cloud function.
For cloud function security rules, see Cloud Function Security Rules.
💡 Tip: If function invocation is blocked by security rules, you may encounter the error code: EXCEED_AUTHORITY
💡 Tip: If function invocation is blocked by the identity authentication mechanism, you may encounter the error code: ACTION_FORBIDDEN
Request
Path Parameters
Possible values: Value must match regular expression ^[a-zA-Z][a-zA-Z0-9_-]{0,58}[a-zA-Z0-9]$
Name of the function to invoke
Query Parameters
Possible values: [true]
Set to true when invoking a web function. Use this query parameter or the X-Tcb-Webfn=true header.
Header Parameters
Specify the function version to invoke. If omitted, the request follows the canary release rules.
Possible values: [true]
Set to true when invoking a web function. Use this header or the webfn=true query parameter.
- application/json
Body
Request payload for invoking the function. The payload must be a JSON object.
Responses
- 200
- 400
- default
Returned when the invocation succeeds
Response Headers
X-Request-Id string
Request ID
- application/json
- text/plain
- Schema
- Example (from schema)
- Echo
Schema
{}
{
"a": 1,
"b": 2
}
- Schema
- Text
Schema
string
Hello fn
Returned when the function call fails
Response Headers
X-Request-Id string
Request ID
- application/json
- Schema
- Example (from schema)
- ExecuteFail
Schema
{
"code": "string",
"message": "string",
"requestId": "string"
}
{
"code": "FUNCTION_PARAM_INVALID",
"message": "bad http request body (e1xxxxxx-xxxx-xxxx-xxxx-xxxxxxf7yyyy). For more information, please refer to https://docs.cloudbase.net/error-code/service",
"requestId": "yyxxxxxx-yyyy-yyyy-zzzz-xxxxxxzzyyyy"
}
Common error information, see https://docs.cloudbase.net/error-code/service for details
Response Headers
X-Request-Id string
Request ID
- application/json
- Schema
- Example (from schema)
- InvalidHost
Schema
{
"code": "string",
"message": "string",
"requestId": "string"
}
{
"code": "INVALID_HOST",
"message": "xxx",
"requestId": "xxx"
}