tencent cloud

文档反馈

DescribeNetworkInterfaces

最后更新时间:2023-08-23 14:11:32

1. API Description

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

This API (DescribeNetworkInterfaces) is used to query the ENI list.

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.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: DescribeNetworkInterfaces.
Version Yes String Common Params. The value used for this API: 2017-03-12.
Region No String Common Params. This parameter is not required for this API.
NetworkInterfaceIds.N No Array of String Queries the ID of the ENI instance, such as eni-pxir56ns. Each request can have a maximum of 100 instances. NetworkInterfaceIds and Filters cannot be specified at the same time.
Filters.N No Array of Filter Filter. NetworkInterfaceIds and Filters cannot be specified at the same time.
  • vpc-id - String - VPC ID, such as vpc-f49l6u0z.
  • subnet-id - String - Subnet ID, such as subnet-f49l6u0z.
  • network-interface-id - String - ENI ID, such as eni-5k56k7k7.
  • attachment.instance-id - String - ID of the bound CVM instance, such as ins-3nqpdn3i.
  • groups.security-group-id - String - ID of the bound security group, such as sg-f9ekbxeq.
  • network-interface-name - String - ENI instance name.
  • network-interface-description - String - ENI instance description.
  • address-ip - String - Private IPv4 address. A single IP will be fuzzily matched with the suffix, while multiple IPs will be exactly matched. It can be used with ip-exact-match to query and exactly match a single IP.
  • ip-exact-match - Boolean - Exact match by private IPv4 address. The first value will be returned if multiple values are found.
  • tag-key - String - u200dOptional - u200dTag key. See Example 2 to learn more details.
  • tag:tag-key - String - Optional - Tag key-value pair. The tag-key should be replaced with a specific tag key. See Example 2 to learn more details.
  • is-primary - Boolean - Optional - Filter based on whether it is a primary ENI. Values: true, false. If this parameter is not specified, filter the both.
  • eni-type - String - Optional - Filter by ENI type. Values: 0 (Secondary ENI), 1 (Primary ENI), 2 (Relayed ENI)
  • eni-qos - String - Optional - Filter by ENI service level. Values: AG (Bronze), AU (Silver)
  • address-ipv6 - String - Optional - Filter by private IPv6 address. Multiple IPv6 addresses can be used for query. If this field is used together with address-ip, their intersection will be used.
  • public-address-ip - String - Public IPv4 address. It supports exact matching.
  • Offset No Integer Offset. Default value: 0.
    Limit No Integer Number of returned results. Default value: 20. Maximum value: 100.

    3. Output Parameters

    Parameter Name Type Description
    NetworkInterfaceSet Array of NetworkInterface List of instance details.
    TotalCount Integer Number of eligible instances.
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Querying the list of ENIs

    This example shows you how to query the list of ENIs.

    Input Example

    POST / HTTP/1.1
    Host: vpc.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeNetworkInterfaces
    <Common request parameters>
    
    {}
    

    Output Example

    {
        "Response": {
            "TotalCount": 1,
            "NetworkInterfaceSet": [
                {
                    "MacAddress": "20:90:6F:F5:34:C7",
                    "VpcId": "vpc-2kx9z6h3",
                    "Business": "cvm",
                    "Zone": "ap-guangzhou-2",
                    "NetworkInterfaceId": "eni-f1xjkw1b",
                    "Primary": false,
                    "CdcId": "",
                    "PrivateIpAddressSet": [
                        {
                            "Description": "",
                            "Primary": true,
                            "PrivateIpAddress": "192.168.0.13",
                            "PublicIpAddress": "",
                            "IsWanIpBlocked": false,
                            "State": "AVAILABLE"
                        },
                        {
                            "Description": "",
                            "Primary": false,
                            "PrivateIpAddress": "192.168.0.15",
                            "PublicIpAddress": "",
                            "IsWanIpBlocked": false,
                            "State": "AVAILABLE"
                        },
                        {
                            "Description": "",
                            "Primary": false,
                            "PrivateIpAddress": "192.168.0.17",
                            "PublicIpAddress": "",
                            "IsWanIpBlocked": false,
                            "State": "AVAILABLE"
                        },
                        {
                            "Description": "",
                            "Primary": false,
                            "PrivateIpAddress": "192.168.0.24",
                            "PublicIpAddress": "",
                            "IsWanIpBlocked": false,
                            "State": "AVAILABLE"
                        }
                    ],
                    "NetworkInterfaceDescription": "aaa",
                    "Ipv6AddressSet": [],
                    "State": "AVAILABLE",
                    "GroupSet": [
                        "sg-c2r7lnxh",
                        "sg-f9ekbxeq"
                    ],
                    "Attachment": {
                        "InstanceId": "ins-ymk3eje8",
                        "DeviceIndex": 1,
                        "InstanceAccountId": "251153169",
                        "AttachTime": "2021-01-08 16:36:49"
                    },
                    "TagSet": [],
                    "EniType": 1,
                    "CreatedTime": "2021-01-07 16:32:55",
                    "SubnetId": "subnet-nao8lfro",
                    "NetworkInterfaceName": "royhyangtest-main",
                    "AttachType": 1
                }
            ],
            "RequestId": "5cf1a813-d4f8-4e0c-8f90-c155a84a3ea1"
        }
    }
    

    Example2 Querying the list of ENIs with the specified tag

    This example shows you how to query by tag:tag-key.

    Input Example

    POST / HTTP/1.1
    Host: vpc.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeNetworkInterfaces
    <Common request parameters>
    
    {
        "Filters": [
            {
                "Values": [
                    "TEST"
                ],
                "Name": "tag:Version"
            }
        ]
    }
    

    Output Example

    {
        "Response": {
            "NetworkInterfaceSet": [
                {
                    "VpcId": "vpc-709l0i0x",
                    "SubnetId": "subnet-qymfizh2",
                    "NetworkInterfaceId": "eni-p17uqigx",
                    "NetworkInterfaceName": "test",
                    "NetworkInterfaceDescription": "",
                    "GroupSet": [
                        "sg-hcd8t9xj"
                    ],
                    "Primary": false,
                    "MacAddress": "20:90:6F:FC:9F:69",
                    "State": "AVAILABLE",
                    "CreatedTime": "2018-04-18 21:46:56",
                    "PrivateIpAddressSet": [
                        {
                            "Description": "12312",
                            "Primary": true,
                            "PrivateIpAddress": "192.168.3.10",
                            "AddressId": "",
                            "PublicIpAddress": "",
                            "IsWanIpBlocked": false,
                            "State": "AVAILABLE"
                        },
                        {
                            "Description": "",
                            "Primary": false,
                            "PrivateIpAddress": "192.168.3.104",
                            "AddressId": "",
                            "PublicIpAddress": "",
                            "IsWanIpBlocked": false,
                            "State": "AVAILABLE"
                        },
                        {
                            "Description": "13123",
                            "Primary": false,
                            "PrivateIpAddress": "192.168.3.18",
                            "AddressId": "",
                            "PublicIpAddress": "",
                            "IsWanIpBlocked": false,
                            "State": "AVAILABLE"
                        },
                        {
                            "Description": "",
                            "Primary": false,
                            "PrivateIpAddress": "192.168.3.223",
                            "AddressId": "",
                            "PublicIpAddress": "",
                            "IsWanIpBlocked": false,
                            "State": "AVAILABLE"
                        },
                        {
                            "Description": "",
                            "Primary": false,
                            "PrivateIpAddress": "192.168.3.86",
                            "AddressId": "",
                            "PublicIpAddress": "",
                            "IsWanIpBlocked": false,
                            "State": "AVAILABLE"
                        }
                    ],
                    "Attachment": null,
                    "Business": "cvm",
                    "Zone": "ap-guangzhou-2",
                    "Ipv6AddressSet": [
                        {
                            "Description": "",
                            "Primary": false,
                            "Address": "2402:4e00:1000:7400:0:9028:a2c9:85b2",
                            "AddressId": "",
                            "IsWanIpBlocked": false,
                            "State": "AVAILABLE"
                        }
                    ],
                    "AttachType": 1,
                    "EniType": 1,
                    "CdcId": "",
                    "TagSet": [
                        {
                            "Key": "Version",
                            "Value": "TEST"
                        },
                        {
                            "Key": "Compony",
                            "Value": "Compony-A"
                        }
                    ]
                }
            ],
            "TotalCount": 1,
            "RequestId": "0c10340b-2551-4414-a8c7-8d90dc24ddd0"
        }
    }
    

    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
    InternalError.ModuleError Internal module error
    InvalidParameter.Coexist The parameters cannot be specified at the same time.
    InvalidParameter.FilterInvalidKey The specified filter condition does not exist.
    InvalidParameter.FilterNotDict The specified filter condition should be a key-value pair.
    InvalidParameter.FilterValuesNotList The specified filter value should be a list.
    InvalidParameterValue.LimitExceeded The parameter value exceeds the limit.
    InvalidParameterValue.Malformed Invalid input parameter format.
    InvalidParameterValue.Range The parameter value is not in the specified range.
    LimitExceeded.ActionLimited Too often API invocations
    ResourceNotFound The resource does not exist.
    UnsupportedOperation Unsupported operation.