GetFunction

Last updated: 2020-06-24 11:46:46

1. API Description

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

This API is used to obtain function details, such as name, code, handler, associated trigger, and timeout.

A maximum of 20 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

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

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: GetFunction.
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 Name of the function to obtain details
Qualifier No String Function version number
Namespace No String Function namespace
ShowCode No String It indicates whether to display the code. TRUE means displaying the code, and FALSE means hiding the code. The code will not be displayed for entry files exceeding 1 MB.

3. Output Parameters

Parameter Name Type Description
ModTime Timestamp Latest modification time of the function
CodeInfo String Function code
Description String Function description
Triggers Array of Trigger Function trigger list
Handler String Function entry
CodeSize Integer Function code size
Timeout Integer Function timeout
FunctionVersion String Function version
MemorySize Integer Maximum available memory of the function
Runtime String Function running environment
FunctionName String Function name
VpcConfig VpcConfig Function VPC
UseGpu String Whether to use GPU
Environment Environment Function environment variable
CodeResult String Whether the code is correct
CodeError String Code error information
ErrNo Integer Error code
Namespace String Function namespace
Role String Role bound to the function
InstallDependency String Whether to install dependencies automatically
Status String Function status
StatusDesc String Status description
ClsLogsetId String CLS logset to which logs are shipped
ClsTopicId String CLS Topic to which logs are shipped
FunctionId String Function ID
Tags Array of Tag Function tag list
EipConfig EipOutConfig EipConfig configuration
AccessInfo AccessInfo Domain name information
Type String Function type. The value is HTTP or Event.
L5Enable String Whether to enable L5
Layers Array of LayerVersionInfo Version information of a layer associated with a function
DeadLetterConfig DeadLetterConfig Information of a dead letter queue associated with a function
AddTime Timestamp Function creation time
PublicNetConfig PublicNetConfigOut Public network access configuration
Note: This field may return null, indicating that no valid values can be obtained.
OnsEnable String Whether Ons is enabled
Note: This field may return null, indicating that no valid value was found.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Obtaining Function Details

You use this function to get the corresponding function information, and you can specify the version and namespace.

Input Example

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

Output Example

{
  "Response": {
    "ModTime": "2018-06-07 09:52:23",
    "Environment": {
      "Variables": []
    },
    "CodeError": "",
    "Description": "",
    "VpcConfig": {
      "SubnetId": "",
      "VpcId": ""
    },
    "Triggers": [],
    "ErrNo": 0,
    "UseGpu": "FALSE",
    "CodeSize": 0,
    "MemorySize": 128,
    "Namespace": "default",
    "FunctionVersion": "$LATEST",
    "Timeout": 3,
    "RequestId": "a1ffbba5-5489-45bc-89c5-453e50d5386e",
    "CodeResult": "failed",
    "Handler": "scfredis.main_handler",
    "Runtime": "Python2.7",
    "FunctionName": "ledDummyAPITest",
    "CodeInfo": "",
    "Role": ""
  }
}

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
InternalError Internal error.
InternalError.Exception Internal service error
InternalError.System Internal system error.
InvalidParameter.Payload Invalid request parameter.
InvalidParameterValue Incorrect parameter value.
InvalidParameterValue.CodeSecret CodeSecret error.
ResourceNotFound.Function The function does not exist.
ResourceNotFound.FunctionName The function does not exist.
UnauthorizedOperation Unauthorized operation.
UnauthorizedOperation.CAM CAM authentication failed.
UnauthorizedOperation.CodeSecret You do not have permissions to access the code.

Was this page helpful?

Was this page helpful?

  • Not at all
  • Not very helpful
  • Somewhat helpful
  • Very helpful
  • Extremely helpful
Send Feedback
Help