tencent cloud

Feedback

GetFunction

Last updated: 2022-01-17 10:20:28

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 100 requests can be initiated per second for this API.

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.
This document describes the parameters for Signature V1. It's recommended to use the V3 signature, which provides higher security. Note that for Signature V3, the common parameters need to be placed in the HTTP Header. See details.

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. For valid values and status change process, please see here
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.
CfsConfig CfsConfig File system configuration parameter, which is used for the function to mount the file system
Note: this field may return null, indicating that no valid values can be obtained.
AvailableStatus String Function billing status. For valid values, please see here
Note: this field may return null, indicating that no valid values can be obtained.
Qualifier String Function version
Note: this field may return null, indicating that no valid values can be obtained.
InitTimeout Integer Timeout period for function initialization
StatusReasons Array of StatusReason Cause of function failure
Note: this field may return null, indicating that no valid values can be obtained.
AsyncRunEnable String Specifies whether to enable asynchronization
Note: this field may return null, indicating that no valid values can be obtained.
TraceEnable String Specifies whether to enable event tracking
Note: this field may return null, indicating that no valid values can be obtained.
ProtocolType String Protocols supported by HTTP-triggered functions. It supports WebSockets for now.
Note: This field may return null, indicating that no valid value was found.
ProtocolParams ProtocolParams Parameters of the specified protocol
Note: this field may return null, indicating that no valid values can be obtained.
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

This example shows you how to query the information a function. You can also specify the version and namespace if necessary.

Input Example

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

Output Example

{
  "Response": {
    "ModTime": "2020-09-22 00:00:00",
    "Layers": [
      {
        "Status": "xx",
        "LayerVersion": 0,
        "Description": "xx",
        "LicenseInfo": "xx",
        "AddTime": "xx",
        "CompatibleRuntimes": [
          "xx"
        ],
        "LayerName": "xx"
      }
    ],
    "CodeError": "xx",
    "AccessInfo": {
      "Host": "xx",
      "Vip": "xx"
    },
    "UseGpu": "xx",
    "EipConfig": {
      "EipFixed": "xx",
      "Eips": [
        "xx"
      ]
    },
    "Namespace": "xx",
    "Environment": {
      "Variables": [
        {
          "Value": "xx",
          "Key": "xx"
        }
      ]
    },
    "OnsEnable": "xx",
    "InstallDependency": "xx",
    "Role": "xx",
    "StatusReasons": [
      {
        "ErrorCode": "xx",
        "ErrorMessage": "xx"
      }
    ],
    "Description": "xx",
    "Type": "xx",
    "Status": "xx",
    "Runtime": "xx",
    "DeadLetterConfig": {
      "FilterType": "xx",
      "Type": "xx",
      "Name": "xx"
    },
    "Qualifier": "xx",
    "Tags": [
      {
        "Value": "xx",
        "Key": "xx"
      }
    ],
    "ClsLogsetId": "xx",
    "FunctionId": "xx",
    "FunctionVersion": "xx",
    "FunctionName": "xx",
    "Triggers": [
      {
        "ModTime": "2020-09-22 00:00:00",
        "BindStatus": "xx",
        "Enable": 0,
        "TriggerAttribute": "xx",
        "Qualifier": "xx",
        "CustomArgument": "xx",
        "AddTime": "2020-09-22 00:00:00",
        "AvailableStatus": "xx",
        "TriggerDesc": "xx",
        "TriggerName": "xx",
        "ResourceId": "xx",
        "Type": "xx"
      }
    ],
    "ClsTopicId": "xx",
    "AddTime": "2020-09-22 00:00:00",
    "MemorySize": 128,
    "CfsConfig": {
      "CfsInsList": [
        {
          "MountSubnetId": "xx",
          "LocalMountDir": "xx",
          "UserId": "xx",
          "IpAddress": "xx",
          "MountInsId": "xx",
          "MountVpcId": "xx",
          "UserGroupId": "xx",
          "CfsId": "xx",
          "RemoteMountDir": "xx"
        }
      ]
    },
    "Timeout": 3,
    "StatusDesc": "xx",
    "TraceEnable": "xx",
    "CodeInfo": "xx",
    "AsyncRunEnable": "xx",
    "VpcConfig": {
      "SubnetId": "xx",
      "VpcId": "xx"
    },
    "ErrNo": 0,
    "CodeSize": 0,
    "L5Enable": "xx",
    "AvailableStatus": "xx",
    "Handler": "xx",
    "CodeResult": "xx",
    "PublicNetConfig": {
      "EipConfig": {
        "EipAddress": [
          "xx"
        ],
        "EipStatus": "xx"
      },
      "PublicNetStatus": "xx"
    },
    "InitTimeout": 0,
    "ProtocolType": "WS",
    "ProtocolParams": {
      "WSParams": {
        "IdleTimeOut": 15
      }
    },
    "RequestId": "xx"
  }
}

5. Developer Resources

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.Apigw Failed to create the trigger.
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.
InvalidParameterValue.FunctionName The function does not exist.
InvalidParameterValue.Namespace Namespace error.
InvalidParameterValue.Qualifier Unsupported function version.
ResourceNotFound.Function The function does not exist.
ResourceNotFound.FunctionName The function does not exist.
ResourceNotFound.Namespace Namespace does not exist.
ResourceNotFound.Version The version does not exist.
UnauthorizedOperation Unauthorized operation.
UnauthorizedOperation.CAM CAM authentication failed.
UnauthorizedOperation.CodeSecret You do not have permissions to access the code.
Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support