The GetChartData function provides time-series data for charts, specifically tracking IP counts, HTML page views, and API usage. It queries the api_login_log table.
Query Parameters:
sd: Start date in YYYY-MM-DD format. If omitted, it defaults to global.Config.ChartDay days ago.ed: End date in YYYY-MM-DD format. If omitted, it defaults to the current date.
Response Format:
Returns a JSON object with:
code: 0 for success, 500 for database errors.title: An array of date strings (YYYY-MM-DD) sorted chronologically.data: An array of objects containing:Name: The metric name ("IP", "Page/10", or "Api/10").Data: An array of integers corresponding to the values for each date in title.
// Example GET request
// GET /get-chart-data?sd=2023-01-01&ed=2023-01-31
// Example JSON Response
{
"code": 0,
"title": ["2023-01-01", "2023-01-02"],
"data": [
{ "Name": "IP", "Data": [10, 12] },
{ "Name": "Page/10", "Data": [5, 6] },
{ "Name": "Api/10", "Data": [8, 9] }
]
}