InetIntel / InetIntel/grip-api-v2

Date format is inconsistent with documentation

Open
#3 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the datetime parsing regex at app/elastic.py#L48 and the processing at app/elastic.py#L73, then compare them with the format documented in api-spec.md. Verify that timestamps using YYYY-MM-DDTHH:MM:SS are handled as documented and that invalid parameters no longer pass silently, using the example API requests to check the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.