Get The Most Recent CRON Job History
Introduction
This endpoint allows you to retrieve the most recent CRON job history records, including the brand, counts, and timestamps for the last 10 CRON jobs. This endpoint is useful for debugging and monitoring cron jobs within your system. It provides a quick view of recent job history with the ability to sort the results by creation time (asc or desc).
Note: This endpoint is primarily used for debugging and monitoring purposes, not active use in the production environment.
Getting Started
Before using this endpoint, ensure you have the following:
- Basic knowledge of making HTTP requests using tools like
cURLor JavaScriptfetch().
Example Request
To fetch the most recent CRON job history records sorted by ascending order (oldest first), use the following curl command:
curl -X GET "https://lenox-rb-app-fe68c2643fcd.herokuapp.com/api/v1/histories/asc
Alternatively, you can use JavaScript to make the request:
fetch("https://lenox-rb-app-fe68c2643fcd.herokuapp.com/api/v1/histories/asc")
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error fetching data:", error));
Example Response
A successful response will return a JSON object containing the most recent CRON history records, including brand, counts, and timestamps. Below is a sample response:
{
"histories": [
{
"brand": "*",
"counts": 0,
"created_at": "2025-03-11T12:30:00Z"
},
{
"brand": "*",
"counts": 120,
"created_at": "2025-03-10T11:25:00Z"
},
{
"brand": "*",
"counts": 200,
"created_at": "2025-03-09T10:20:00Z"
},
{
"brand": "*",
"counts": 180,
"created_at": "2025-03-08T09:15:00Z"
},
{
"brand": "*",
"counts": 210,
"created_at": "2025-03-07T08:10:00Z"
}
]
}
In this example, the histories array contains the most recent job history records, ordered by the created_at timestamp.
Handling Errors
If the Histories are not found the response will still be a valid JSON object, but the histories arrays will be empty:
{
"histories": []
}