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. |
Accept |
No |
string |
Whether to use SSE streaming return. |
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. |
X-Session-Context |
No |
string |
Specify the Session Context. This header only takes effect when the function metadata |
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"
}
For functions with enableSessionCtx enabled, specify the Session Context through X-Session-Context during invocation:
curl -X POST "{frontend endpoint}/serverless/v1/functions/{functionVersionURN}/invocations" \
-H "Content-Type: application/json" \
-H 'X-Session-Context: {"sessionCtx":"ctx-a"}' \
-d '{"name":"yuanrong"}'
Response Example#
Status Code: 200
Indicates successful function invocation.
"hello yuanrong"
Error Codes#
See Error Codes