Invoke

Last updated: 2020-02-28 10:12:11

1. API Description

Domain name for API request: scf.tencentcloudapi.com.

This API is used to run a function.

A maximum of 100 requests can be initiated per second for this API.

Note: This API supports Finance regions. If the common parameter Region is a Finance region, a domain name with the Finance region needs to be specified, for example: scf.ap-shanghai-fsi.tencentcloudapi.com

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common parameter. The value used for this API: Invoke
Version Yes String Common parameter. The value used for this API: 2018-04-16
Region Yes String Common parameter. For more information, please see the list of regions supported by the product.
FunctionName Yes String Function name
InvocationType No String The value is RequestResponse (synchronous) or Event (asynchronous). The default value is synchronous.
Qualifier No String Version number of the triggered function
ClientContext No String Function running parameter, which is in the JSON format. Maximum parameter size is 1 MB.
LogType No String If this field is specified for a synchronous invocation, the return value will contain a 4-KB log. The value is None (default) or Tail. If the value is Tail, logMsg in the return parameter will contain the corresponding function execution log.
Namespace No String Namespace

3. Output Parameters

Parameter Name Type Description
Result Result Function execution result
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Run a Function

Input Example

https://scf.tencentcloudapi.com/?Action=Invoke
&FunctionName=xxxx
&<common request parameters>

Output Example

{
  "Response": {
    "Result": {
      "MemUsage": 3207168,
      "Log": "",
      "RetMsg": "hello from scf",
      "BillDuration": 100,
      "FunctionRequestId": "6add56fa-58f1-11e8-89a9-5254005d5fdb",
      "Duration": 0.826,
      "ErrMsg": "",
      "InvokeResult": 0
    },
    "RequestId": "c2af8a64-c922-4d55-aee0-bd86a5c2cd12"
  }
}

5. Developer Resources

API Explorer

This tool allows online call, signature authentication, SDK code generation and quick search of APIs to greatly improve the efficiency of using TencentCloud APIs.

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation.FunctionStatusError Operation failed. The function is deploying.
FailedOperation.InvokeFunction Failed to invoke the function.
InternalError Internal error.
InternalError.System Internal system error.
InvalidParameterValue Incorrect parameter value.
InvalidParameterValue.Param The input parameter is not in the standard JSON format.
ResourceNotFound.Function The function does not exist.
ResourceNotFound.FunctionName The function does not exist.
ResourceUnavailable.InsufficientBalance Your balance is insufficient. Please top up first.
UnauthorizedOperation.CAM CAM authentication failed.