Closed Jimbly closed 7 years ago
Let's do a proper api endpoint here.
Put api endpoints under /api
.
This one would be /api/crashreports
. This returns an object with the total count sort of like this.
{
"count": 50,
"crashreports": [
...
]
}
That should return the 10 most recent crashreports. Later you can add query parameters to do more complex sorting and limiting.
That's just how I do things, but there are a lot of different api styles so if you would like to propose an alternative format, I'd like to hear it.
If all you need is the count right now, just make the object look like { "count": 50 }
so we have room to put in that functionality later.
I specifically just need the count per-product (have a separate alert for when a server crashes than for a client crash), but that seems reasonable, and I'm assuming my monitor software should be able to parse JSON :). I've reworked it to be in that format.
This allows the server to be queried by arbitrary monitoring software, which can be configured to alert whenever a new crash is submitted.