Invoke Service#

Description#

Synchronously invoke a function service.

URI#

POST /serverless/v1/functions/{functionVersionURN}/invocations

Path Parameters:

Parameter

Required

Type

Description

functionVersionURN

Yes

String

Function version URN.

Request Parameters#

Request Header Parameters

Parameter

Required

Type

Description

Content-Type

Yes

string

Message body type.
Value: It is recommended to use application/json.

X-Instance-Cpu

No

string

CPU required for the function instance.

X-Instance-Memory

No

string

Memory required for the function instance.

X-Instance-Custom-Resource

No

string

Custom resources required for the function instance.

X-Pool-Label

No

string

Resource pool label for affinity scheduling of the function instance.

X-Instance-Label

No

string

Run on function instances with this label.

X-Instance-Session

No

string

Specify an instance session for invocation; the session is uniquely bound to the instance.
Example: {“sessionID”:“abc”,“sessionTTL”:10,“concurrency”: 5}, where sessionID does not exceed 63 characters, sessionTTL is not less than 0 (unit: seconds), and concurrency cannot exceed the concurrentNum configured in the function. When concurrency is -1, it indicates exclusive use of the entire function instance.


Request Body Parameters

Custom format defined by the user function.

Response Parameters#

Custom format defined by the user function.

Request Example#

POST {frontend endpoint}/serverless/v1/functions/{functionVersionURN}/invocations

{
    "name":"yuanrong"
}

Response Example#

Status Code: 200

Indicates successful function invocation.

"hello yuanrong"

Error Codes#

See Error Codes