Help Center/ API Gateway/ API Reference/ Shared Gateway APIs (for Existing Users)/ Querying Metrics/ Querying API Calls Under an API Group in the Last One Hour
Updated on 2022-09-01 GMT+08:00

Querying API Calls Under an API Group in the Last One Hour

Function

This API is used to query the number of times APIs are called within a period by API group ID. The query is based on 1 minute. If the time range is within one hour, the server returns the number of API calls made every minute.

For security purposes, clear your operation records, including but not limited to records in the ~/.bash_history and /var/log/messages directories (if any), after running the curl command on the server to query information.

URI

The following table lists the HTTP/HTTPS request method and URI of the API.

Table 1 HTTP/HTTPS request method and URI

Request Method

URI

GET

/v1.0/apigw/statistics/group/latest?group_id=[group_id]

Request

Table 2 Parameter description

Parameter

Mandatory

Type

Description

group_id

Yes

String

API group ID

Response

Table 3 Parameter description

Parameter

Type

Description

Operation Type

code

String

Response code

R

msg

String

Response message

R

start_time

Long

Timestamp (UTC) of the start time

R

end_time

Long

Timestamp (UTC) of the end time

R

list

Structure

Statistic data

R

Table 4 Parameter description of statistic data

Parameter

Type

Description

Operation Type

group_id

String

API group ID

R

current_minute

Long

Timestamp (UTC)

R

provider

String

API provider

R

req_count

Integer

Total number of requests

R

max_latency

Integer

Maximum latency (ms)

R

avg_latency

Double

Average latency (ms)

R

output_throughput

Integer

Downstream throughput (bytes)

R

input_throughput

Integer

Upstream throughput (bytes)

R

req_count4xx

Integer

Total number of 4xx response codes

R

req_count5xx

Integer

Total number of 5xx response codes

R

req_count2xx

Integer

Total number of 2xx response codes

R

req_count_error

Integer

Number of errors

R

register_time

String

Recording time (yyyy-MM-dd HH:mm:ss)

R

req_time

String

Request time (yyyy-MM-dd HH:mm:ss)

R

Example response:

{
	"code": "000000",
	"msg": "",
	"list": [{
		"group_id": "d7b52683-341b-4234-8261-66b4cfbfbda5",
		"current_minute": 1516849440,
		"provider": "205fa874817a4dcfae9222a3be4725e8",
		"req_count": 1981,
		"max_latency": 199,
		"avg_latency": 98.17,
		"output_throughput": 694483,
		"input_throughput": 694483,
		"req_count4xx": 669,
		"req_count5xx": 312,
		"req_count2xx": 327,
		"req_count_error": 981,
		"register_time": "2018-01-25 11:04:09",
		"req_time": "2018-01-25 11:04:00"
	}],
	"start_time": 1516845900,
	"end_time": 1516849440
}

Status Codes

Table 5 Status codes

Status Code

Description

200

Query Success