Help Center/ Web3 Node Engine Service/ API Reference/ API/ Node Monitoring/ Obtaining the API Calling Information of a Node in a Specified Period
Updated on 2023-08-08 GMT+08:00

Obtaining the API Calling Information of a Node in a Specified Period

Description

This API is used to obtain the API calling information of a node in a specified period.

URI

POST /v1/{project_id}/node-provider/nodes/{node_id}/api-statistics

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Minimum length: 32 characters

Maximum length: 32 characters

node_id

Yes

String

Node ID.

Minimum length: 36 characters

Maximum length: 45 characters

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

Minimum length: 1 character

Maximum length: 65,535 characters

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

time_range

Yes

String

Query time range. For example, -1.-1.5 indicates the latest 5 minutes.

Minimum length: 0 characters

Maximum length: 100 characters

period

Yes

Integer

Monitoring data granularity. For example, 60 indicates 1 minute and 300 indicates 5 minutes.

Minimum value: 0

Maximum value: 86,400

statistics

No

Array of strings

Statistical mode.

Minimum length: 0 characters

Maximum length: 100 characters

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

top

Array of TopMethodResult objects

List of top 5 requests.

data

Array of MethodResult objects

API calling data.

Table 5 TopMethodResult

Parameter

Type

Description

method

String

Method name.

Minimum length: 0 characters

Maximum length: 100 characters

count

Integer

Number of records.

Minimum value: 0

Maximum value: 2,147,483,648

Table 6 MethodResult

Parameter

Type

Description

timestamp

String

Timestamp.

Minimum length: 0 characters

Maximum length: 100 characters

count

Integer

Number of calls.

Minimum value: 0

Maximum value: 2,147,483,648

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

code

String

Status code.

Minimum length: 3 characters

Maximum length: 3 characters

error_code

String

Error code.

Minimum length: 12 characters

Maximum length: 12 characters

error_msg

String

Error message.

Minimum length: 1 character

Maximum length: 65,535 characters

message

String

Error details.

Minimum length: 0 characters

Maximum length: 65,535 characters

Status code: 401

Table 8 Response body parameters

Parameter

Type

Description

code

String

Status code.

Minimum length: 3 characters

Maximum length: 3 characters

error_code

String

Error code.

Minimum length: 12 characters

Maximum length: 12 characters

error_msg

String

Error message.

Minimum length: 1 character

Maximum length: 65,535 characters

message

String

Error details.

Minimum length: 0 characters

Maximum length: 65,535 characters

Status code: 500

Table 9 Response body parameters

Parameter

Type

Description

code

String

Status code.

Minimum length: 3 characters

Maximum length: 3 characters

error_code

String

Error code.

Minimum length: 12 characters

Maximum length: 12 characters

error_msg

String

Error message.

Minimum length: 1 character

Maximum length: 65,535 characters

message

String

Error details.

Minimum length: 0 characters

Maximum length: 65,535 characters

Example Request

{
  "time_range" : "-1.-1.5",
  "period" : 300,
  "statistics" : [ "average" ]
}

Example Response

Status code: 200

Request successful.

{
  "top" : [ {
    "method" : "geth",
    "count" : 10
  } ],
  "data" : [ {
    "timestamp" : "2023-06-06T22:00:00+08:00",
    "count" : 10
  } ]
}

Status code: 400

Verify parameter failed.

{
  "code" : 400,
  "error_code" : "BCS.03400001",
  "error_msg" : "Invalid request.",
  "message" : "unmarshal request data error"
}

Status code: 401

Authentication failed.

{
  "code" : 401,
  "error_code" : "BCS.03401001",
  "error_msg" : "Authorization failed.",
  "message" : "request token is not valid"
}

Status code: 500

Internal service error.

{
  "code" : 500,
  "error_code" : "BCS.03500001",
  "error_msg" : "Internal error.",
  "message" : "project [xxx] node [xxx] get service bearer user token error"
}

Status Code

Status Code

Description

200

Request successful.

400

Verify parameter failed.

401

Authentication failed.

500

Internal service error.

Error Code

For details, see Error Codes.