-
Notifications
You must be signed in to change notification settings - Fork 0
Description
According to the documentation, the GET parameters ts_start and ts_end for searching events should be formatted according to the following date string: YYYY-MM-DDTHH:MM:SS (https://github.com/InetIntel/grip-api-legacy/blob/master/api-spec.md#query-parameters-none-required). However, the API only accepts date strings of the form YYYY-MM-DDTHH:MM, and silently ignores dates using the documented format.
-
Example:
Fetching all events at 2024-11-20 18:25:00 using ts_start=ts_end=2024-11-20T18:25:00 returns an event at the current time (2024-12-04 20:25:00) since the invalid parameters are ignored: https://api.grip.inetintel.cc.gatech.edu/json/events?length=1&ts_start=2024-11-20T18:25:00&ts_end=2024-11-20T18:25:00
To get the intended events, the date format must be YYYY-MM-DDTHH:MM (https://api.grip.inetintel.cc.gatech.edu/json/events?length=1&ts_start=2024-11-20T18:25&ts_end=2024-11-20T18:25) or YYYY-MM-DD HH:MM:SS (https://api.grip.inetintel.cc.gatech.edu/json/events?length=1&ts_start=2024-11-20%2018:25:00&ts_end=2024-11-20%2018:25:00). -
Proposed Solution:
Adjust the datetime parsing regex (https://github.com/InetIntel/grip-api-v2/blob/main/app/elastic.py#L48) and processing (https://github.com/InetIntel/grip-api-v2/blob/main/app/elastic.py#L73) to be consistent with the documentation.
Furthermore, returning a warning or error in case invalid parameters are specified instead of silently ignoring them, would be helpful for future versions.