Help Center/ Virtual Private Network/ API Reference/ API/ P2C VPN APIs/ P2C VPN Gateway/ Querying the Connections of a P2C VPN Gateway
Updated on 2024-12-03 GMT+08:00

Querying the Connections of a P2C VPN Gateway

Function

This API is used to query the connections of a P2C VPN gateway with a specified ID.

Calling Method

For details, see Calling APIs.

URI

GET /v5/{project_id}/p2c-vpn-gateways/{p2c_vgw_id}/connections

Table 1 Parameter description

Parameter

Type

Mandatory

Description

project_id

String

Yes

Specifies a project ID. You can obtain the project ID by referring to Obtaining the Project ID.

p2c_vgw_id

String

Yes

Specifies the ID of a P2C VPN gateway instance.

Table 2 Parameter in a query request

Parameter

Type

Mandatory

Description

limit

Integer

No

Specifies the number of records returned on each page during pagination query.

offset

Integer

No

Specifies the offset for pagination query.

Request

  • Request parameters

    None

  • Example requests

    1. Query the connection list in non-pagination mode.

    GET https://{Endpoint}/v5/{project_id}/p2c-vpn-gateways/{p2c_vgw_id}/connections
    2. Query the connection list in pagination mode.
    GET https://{Endpoint}/v5/{project_id}/p2c-vpn-gateways/{p2c_vgw_id}/connections?limit=10&offset=0

Response

  • Response parameters

    Returned status code 200: successful query

    Table 3 Parameters in the response body

    Parameter

    Type

    Description

    connections

    Array of Connection objects

    Specifies connection information.

    total_count

    Long

    Specifies the total number of connections.

    request_id

    String

    Specifies a request ID.

    Table 4 Connection

    Parameter

    Type

    Description

    connection_id

    String

    • Specifies a connection ID.
    • The value is a UUID containing 36 characters.

    client_virtual_ip

    String

    Specifies the virtual IP address assigned to a client for establishing a connection.

    client_ip

    String

    Specifies the public IP address that a client accesses.

    client_user_name

    String

    Specifies a client username.

    inbound_packets

    Long

    Specifies the number of inbound packets.

    outbound_packets

    Long

    Specifies the number of outbound packets.

    inbound_bytes

    Long

    Specifies the number of inbound bytes.

    outbound_bytes

    Long

    Specifies the number of outbound bytes.

    connection_established_time

    String

    • Specifies the time when a client connection is established.
    • The UTC time format is yyyy-MM-ddTHH:mm:ssZ.

    timestamp

    String

    • Specifies the timestamp in the statistics about traffic transmitted over the connection.
    • The UTC time format is yyyy-MM-ddTHH:mm:ssZ.
  • Example response
    {
        "connections": [
            {
                "connection_id": "10293371-114e-4d2a-878e-c6a616d0ec0e",
                "client_virtual_ip": "36.***.***.149",
                "client_ip": "100.***.***.100",
                "client_user_name": "1111",
                "inbound_packets": 13,
                "outbound_packets": 24,
                "inbound_bytes": 4185,
                "outbound_bytes": 10480,
                "connection_established_time": "2024-06-17T02:58:27.213Z",
                "timestamp": "2024-06-17T02:58:48Z"
            },
            {
                "connection_id": "6ade9de6-b19e-4b87-874d-f4880be317c1",
                "client_virtual_ip": "36.***.***.145",
                "client_ip": "100.***.***.100",
                "client_user_name": "1111",
                "inbound_packets": 13,
                "outbound_packets": 38,
                "inbound_bytes": 4185,
                "outbound_bytes": 15804,
                "connection_established_time": "2024-06-17T02:58:12.413Z",
                "timestamp": "2024-06-17T02:58:48Z"
            }
        ],
        "total_count": 2,
        "request_id": "6844f73ab1dd713d369b88904a935bd6"
    }

Status Codes

For details, see Status Codes.