Can I use restful for statistical api?

problem description

Restful"s api can be used for regular add, delete, modify and other operations, but if my api is to do "statistics" for resources, how should I design such Api?

the environmental background of the problem

currently, I have a resource for reporting alarms, (alert),. I need to count the number of alarms added within a month, the number of alarms of emergency types, and the alarm data of corrective types.

related codes

{
  method: "GET",
  path: "/api/alert/alertByCategoryMonth",
  config: {
    tags: ["api", "alert", "category", "day"],
    description: " ",
    handler: { async: controller.AlertByCategoryMonth },
  },
},

result

this weird api / api/alert/alertByCategoryMonth makes me feel completely different from other rest api styles. I wonder if there is a rest api? suitable for this type

.
Mar.28,2021

first of all, you can create a table of alarm resources in the database, which probably includes the following field id (primary key), date (statistics date). Warning_resource_counts, emergency_counts,reform_counts, then uses a script to put the data statistics into the table built above, and then uses api to obtain the data in the table and display it at the front end

.
Menu