API, using 'from' 'to' for endpoint /api/v0/logs/alertlog/:hostname

Hello,

I am having an issue where I cannot seem to get the to and from fields to work properly when I query the /api/v0/logs/alertlog/:hostname endpoint.

In particular I can get the dates to filter properly but no matter how i encode the request the api is ignoring the time field

from the documentation:

curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/logs/eventlog/:hostname?limit=20&start=5&from=2017-07-22%2023:00:00

The documentation suggests using the %20 to encode the space between the date and time, which I’ve tried to no avail. I cannot seem to get the api to properly filter the time. It will pick up and filter the dates, so I can limit requests to a particular day, but I also would like to filter this down to a particular range of a few minutes.

Any help is appreciated.

Ok, I figured out the API expects just a long string of numbers without any special characters…

for example the from field for today 6pm would be ‘20190410180000’

example url with hostname removed, this is for one minute on 2019-02-01 11:35:00 to 2019-02-01 11:36:00
/api/v0/logs/alertlog/333?from=20190201113500&to=20190201113600

please update your api documentation whenever you can.

Steven,

If you don’t mind in the docs the top right you can edit the docs and submit changes.

Thanks, I submitted a pull request – let me know if it wasn’t done correctly.

1 Like