Help Center/ ROMA Connect/ API Reference/ Service Integration APIs/ Querying Metrics/ Querying Top N Metrics of Difference Application Requests
Updated on 2025-03-26 GMT+08:00

Querying Top N Metrics of Difference Application Requests

Function

This API is used to query the top few metric values of API calls for all integration applications, or for one application or API, within a specified period.

This function is restricted for use. If you have any questions, contact technical support.

Constraints

If the invoking times out or the error message "request statistics error" is returned, switch to another mode or shorten the statistics collection duration.

URI

GET /v2/{project_id}/apic/instances/{instance_id}/statistics/app-usages

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Appendix > Obtaining a Project ID in the ROMA Connect API Reference.

instance_id

Yes

String

Instance ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

mode

Yes

String

Query mode.

  • ALL: Queries all applications in an instance. The master account permission is required.

  • APP: Queries a specified integration application.

  • API: Queries a specified API.

roma_app_id

No

String

Integration application ID. This parameter is mandatory when mode is set to APP.

api_id

No

String

API ID. This parameter is mandatory when mode is set to API.

cycle

No

String

Statistical period.

  • minute

  • hour

  • day

    If cycle is set to minute, data of the last 3 hours can be queried.

    If cycle is set to hour, data of the last 3 days can be queried.

    If cycle is set to day, data of the last 90 days can be queried.

start_time

No

String

Start time, for example, 2020-06-18 10:00:01.

end_time

No

String

End time, for example, 2020-06-18 23:00:00.

duration

No

String

The measurement duration is in the format of "integer+unit (m or h)". m indicates minute, and h indicates hour. The combination of hour and minute is supported. For example, 1h or 2h45m.

  • If both start_time and end_time are specified, the query time range is [start_time, end_time].

  • If start_time does not exist, but end_time and duration exist and are valid, the query time range is [end_time – duration, end_time].

  • If start_time and end_time do not exist, duration exists and is valid, and end_time is now, the query time range is [end_time – duration, end_time].

  • If end_time does not exist, start_time and duration exist and are valid, and end_time is now, the query time range is [end_time – duration, end_time].

  • If start_time, end_time, and duration do not exist, the error message "missing time range parameters" is displayed.

top_app_num

No

Integer

The top applications that are invoked.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token, which can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

code

String

Response code.

start_time

Long

Timestamp (UTC) of the statistics start time.

end_time

Long

End time (UTC).

app_req_count

Array of AppRequestStatisticInfo objects

Top N application requests.

app_input_throughput

Array of AppInputStatisticInfo objects

Top N uplink throughput of the APIs that are called by applications.

app_output_throughput

Array of AppOutputStatisticInfo objects

Top N downlink throughput of the APIs that are called by applications.

Table 5 AppRequestStatisticInfo

Parameter

Type

Description

app_id

String

Application ID.

app_name

String

Application name.

req_count

Integer

Total number of requests.

Table 6 AppInputStatisticInfo

Parameter

Type

Description

app_id

String

Application ID.

app_name

String

Application name.

input_throughput

Long

Total uplink throughput.

Table 7 AppOutputStatisticInfo

Parameter

Type

Description

app_id

String

Application ID.

app_name

String

Application name.

output_throughput

Long

Total downlink throughput.

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 401

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 403

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 404

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 500

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Example Requests

None

Example Responses

Status code: 200

OK

{
  "code" : "APIG.0000",
  "start_time" : 1599400492,
  "end_time" : 1599616492,
  "app_req_count" : [ {
    "app_id" : "c38f75b5-b28a-41e9-afba-b6329b959d07",
    "app_name" : "ycs-app",
    "req_count" : 5
  } ],
  "app_input_throughput" : [ {
    "app_id" : "c38f75b5-b28a-41e9-afba-b6329b959d07",
    "app_name" : "ycs-app",
    "input_throughput" : 2990
  } ],
  "app_output_throughput" : [ {
    "app_id" : "c38f75b5-b28a-41e9-afba-b6329b959d07",
    "app_name" : "ycs-app",
    "output_throughput" : 1695
  } ]
}

Status code: 400

Bad Request

{
  "error_code" : "APIG.2012",
  "error_msg" : "Invalid parameter value,parameterName:api_id. Please refer to the support documentation"
}

Status code: 401

Unauthorized

{
  "error_code" : "APIG.1002",
  "error_msg" : "Incorrect token or token resolution failed"
}

Status code: 403

Forbidden

{
  "error_code" : "APIG.1005",
  "error_msg" : "No permissions to request this method"
}

Status code: 404

Not Found

{
  "error_code" : "APIG.3002",
  "error_msg" : "API 39bce6d25a3f470e8cf7b2c97174f7d9 does not exist"
}

Status code: 500

Internal Server Error

{
  "error_code" : "APIG.9999",
  "error_msg" : "System error"
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Internal Server Error

Error Codes

See Error Codes.