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:

  • Sync: synchronous
  • Async: asynchronous
X-Fc-Log-Type String Header No None

The method used to return logs. Valid values:

  • Tail: returns the last 4 KB of logs that are generated for the current request.
  • None: No logs are returned for the current request.

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:

  • HandledInvocationError: errors returned when a callback function is executed in Node.js. For more information, see the "Handle errors" section of the Terms topic.
  • UnhandledInvocationError: all errors except those of the HandledInvocationError type. For more information, see the "Handle errors" section of the Terms topic.
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.


Sample requests

POST /services/service_name.test/functions/function_name HTTP/1.1 
Common request headers

Sample success responses

JSON format

HTTP/1.1 200 OK
Common response headers