Invokes a function.
Request headers
This operation uses only common request headers. For more information, see Common parameters.
Request syntax
POST /services/{serviceName.qualifier}/functions/{functionName}
Request parameters
Parameter | Type | Position | Required | Example | Description |
---|---|---|---|---|---|
X-Fc-Invocation-Type | String | Header | No | Sync |
The method used to invoke the function. Valid values:
|
X-Fc-Log-Type | String | Header | No | None |
The method used to return logs. Valid values:
Default value: None. |
serviceName | String | Path | Yes | service_name |
The name of the service. |
qualifier | String | Path | No | test |
The version or alias of the service. |
functionName | String | Path | Yes | function_name |
The name of the function. |
String | Body | Yes | event |
The event of the function. The value of this parameter is a binary array. Function Compute passes the event to the function for processing. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
String | hello world |
The results returned after the function is invoked. You can specify the results returned. |
|
X-Fc-Error-Type | String | UnhandledInvocationError |
The type of errors returned after the function is invoked. Valid values:
|
X-Fc-Log-Result | String | demo log result |
The returned log results. |
X-Fc-Code-Checksum | String | 5697641582914695457 |
The CRC-64 value of the function code package. |
Examples
Sample requests
POST /services/service_name.test/functions/function_name HTTP/1.1
Common request headers
{
"X-Fc-Log-Type":"None",
"functionName":"function_name",
"qualifier":"test",
"X-Fc-Invocation-Type":"Sync",
"serviceName":"service_name",
"body":"event"
}
Sample success responses
JSON
format
HTTP/1.1 200 OK
Common response headers