Help Center> FunctionGraph> API Reference> Function Data Zone API> Implementing Synchronous Function Execution

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

Table 1 Path parameters

Parameter

Mandatory

Type

Description

function_urn

Yes

String

Function URN.

project_id

Yes

String

Tenant's project ID.

Request Parameters

Table 2 Request header 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).

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

{User defined key}

Yes

Map<String,>

Request body of the synchronous function (JSON)

Response Parameters

Status code: 200

Table 4 Response header parameters

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).

Table 5 Response body parameters

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.