Calls a specified function.

Request syntax

POST /2019-09-30/functions/Function/invocations HTTP/1.1
Cookie: Cookie

Payload

Request Parameters

Parameter Type Required Description
Function String Yes The information about the function to be called. Two ARN formats are available:
  • Complete ARN format: The format is acs:fc:your_Region:your_AccountId:service:your_ServiceName:function:your_FunctionName.
  • Partial ARN format: The format is service:your_ServiceName:function:your_FunctionName.
Notice The ARN format must match the following regular expression pattern:

(^acs:fc:([a-z]{2}-[a-z]+(-\d)?)? :(\d{16})? :)? service:([a-zA-Z][\w-]{0,127}):function:([a-zA-Z][\w-]{0,127})$

Cookie String Yes The authentication cookie generated when the CreateAuthCookie API operation is called.
Payload JSON Yes The Payload content is passed to the function without modifications.

Response syntax

HTTP/1.1 StatusCode
X-Fc-Error-Type: ErrorType

Payload

Response Parameters

Parameter Type Description
StatusCode Number The HTTP status code. If the request is successful, 200 is returned. If the request fails, other status codes are returned. For information, see Status codes.
ErrorType String The error type. This parameter appears when a function encounters an error. The parameter has the following two values:
  • Handled: The error is reported by the function
  • Unhandled: The error is detected and reported by Function Compute. For example, the function execution has timed out or the memory is insufficient.
Payload JSON The content returned by the function or the error message that is in the following Payload format.

The format of the returned Payload is as follows:

{
    "Message": "string",
    "StackTrace": []
}

Example

$ curl -i -b token.cookie -k -X POST https://127.0.0.1:9999/2019-09-30/functions/service:helloworld:function:helloworld/invocations

HTTP/1.1 200 OK
Server: openresty/1.13.6.2
Date: Tue, 19 Nov 2019 09:25:42 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive

HelloWorld