Implementing Synchronous Function Execution
Function
This API is used to implement synchronous function execution. For synchronous function execution, clients must wait for explicit responses to their requests from a function. Responses are returned only after function invocation is complete.
URI
POST /v2/{project_id}/fgs/functions/{function_urn}/invocations
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| function_urn | Yes | String | Function URN. |
| project_id | Yes | String | Tenant's project ID. |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Cff-Log-Type | No | String | Options: tail (4 KB logs will be returned) and null (no logs will be returned). |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| {User defined key} | Yes | Map<String,> | Request body of the synchronous function (JSON) |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| X-Cff-Function-Log | String | Function execution log encoded using Base64. |
| X-Cff-Invoke-Summary | String | Execution summary. duration: Function execution duration (unit: ms). billingDuration: Billing duration (unit: ms). memorySize: Configured memory (unit: MB). memoryUsed: Used memory (unit: MB). |
| Parameter | Type | Description |
|---|---|---|
| {User defined key} | Map<String,String> | Response body of the synchronous function |
Example Requests
POST https://{functiongraph_endpoint}/v2/7aad83af3e8d42e99ac194e8419e2c9b/fgs/functions/urn:fss:xxxxxxxxx:7aad83af3e8d42e99ac194e8419e2c9b:function:default:test:latest/invocations
{
"message" : "Hello World"
} Example Responses
Status code: 200
Accepted
"message: hello world from FunctionGraph"
Status code: 404
Not Found
{
"error_code" : "FSS.1051",
"error_msg" : "Not found the function"
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Accepted |
| 404 | Not Found |
Error Codes
See Error Codes.
Last Article: Function Data Zone API
Next Article: Implementing Asynchronous Function Execution
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.