/time sometimes returns invalid time IDs #15

Closed
opened 2025-07-07 00:16:07 +00:00 by fiveman1 · 5 comments

Example query: https://api.strafes.net/api/v1/time?page_size=100&page_number=1&game_id=1&mode_id=0&style_id=1&user_id=1545614420&sort_by=3

In the response I see

"id": 825832845792641000,
"time": 408246,
"user": {
  "id": 1545614420,
  "username": "70hzlol",
  "state_id": 1,
  "muted": false
},
"map": {
  "id": 5692157895,
  "display_name": "Koi",
  "creator": "supermushroom8",
  "game_id": 1,
  "date": "2020-09-14T16:07:43Z"
},
...
"id": 829034198848962600,
 "time": 27512,
"user": {
  "id": 1545614420,
  "username": "70hzlol",
  "state_id": 1,
  "muted": false
},
"map": {
  "id": 5692187016,
  "display_name": "Moderated",
  "creator": "jafferflaffer",
  "game_id": 1,
  "date": "2020-09-14T16:16:53Z"
},
...

These IDs do not work when used with endpoints that require time ID (like the newly released /time/placement/) and they look too large, so I'm guessing that they are wrong.

Example query: https://api.strafes.net/api/v1/time?page_size=100&page_number=1&game_id=1&mode_id=0&style_id=1&user_id=1545614420&sort_by=3 In the response I see ```json "id": 825832845792641000, "time": 408246, "user": { "id": 1545614420, "username": "70hzlol", "state_id": 1, "muted": false }, "map": { "id": 5692157895, "display_name": "Koi", "creator": "supermushroom8", "game_id": 1, "date": "2020-09-14T16:07:43Z" }, ... "id": 829034198848962600, "time": 27512, "user": { "id": 1545614420, "username": "70hzlol", "state_id": 1, "muted": false }, "map": { "id": 5692187016, "display_name": "Moderated", "creator": "jafferflaffer", "game_id": 1, "date": "2020-09-14T16:16:53Z" }, ... ``` These IDs do not work when used with endpoints that require time ID (like the newly released /time/placement/) and they look too large, so I'm guessing that they are wrong.
itzaname added the Kind/Bug
Priority
Critical
1
Reviewed
Confirmed
1
labels 2025-07-07 00:21:46 +00:00
Owner

So large IDs are valid but the ones being returned seem to to be incorrect. Probably a bad integer conversion somewhere.

825832845792641000 should be 825832845792641027

So large IDs are valid but the ones being returned seem to to be incorrect. Probably a bad integer conversion somewhere. `825832845792641000` should be `825832845792641027`
Owner

So looking into it further, if you just run the raw query with curl:

curl -X 'GET' \
  'http://localhost:9000/api/v1/time/825832845792641027' \
  -H 'accept: application/json' \
  -H 'X-API-Key: strafe_'

You get the correct response:

{
  "data": {
    "id": 825832845792641027,
    "time": 408246,
    "user": {
      "id": 1545614420,
      "username": "70hzlol",
      "state_id": 1,
      "muted": false
    },
    "map": {
      "id": 5692157895,
      "display_name": "Koi",
      "creator": "supermushroom8",
      "game_id": 1,
      "date": "2020-09-14T12:07:43-04:00"
    },
    "has_bot": true,
    "date": "2025-06-25T01:12:38-04:00",
    "style_id": 1,
    "mode_id": 0,
    "game_id": 1
  }
}

Which means this is a Javascript skill issue and everything is working fine from what the API itself is responding with.

So looking into it further, if you just run the raw query with curl: ```shell curl -X 'GET' \ 'http://localhost:9000/api/v1/time/825832845792641027' \ -H 'accept: application/json' \ -H 'X-API-Key: strafe_' ``` You get the correct response: ```json { "data": { "id": 825832845792641027, "time": 408246, "user": { "id": 1545614420, "username": "70hzlol", "state_id": 1, "muted": false }, "map": { "id": 5692157895, "display_name": "Koi", "creator": "supermushroom8", "game_id": 1, "date": "2020-09-14T12:07:43-04:00" }, "has_bot": true, "date": "2025-06-25T01:12:38-04:00", "style_id": 1, "mode_id": 0, "game_id": 1 } } ``` Which means this is a Javascript skill issue and everything is working fine from what the API itself is responding with.
itzaname added
Priority
Medium
3
and removed
Priority
Critical
1
labels 2025-07-07 00:41:33 +00:00
Owner

I'll graciously convert it to a string so your browser language can handle it. #16

Let me know if you can't handle anything else. 😊

I'll graciously convert it to a string so your browser language can handle it. https://git.itzana.me/StrafesNET/public-api/pulls/16 Let me know if you can't handle anything else. 😊
Author

javascript moment...

/time/placement still returns the ID as a number, mind updating that? I can workaround it by forcing the ID to get parsed as a string but if you updated /times and /times/worldrecord already might as well make it consistent all around.

javascript moment... /time/placement still returns the ID as a number, mind updating that? I can workaround it by forcing the ID to get parsed as a string but if you updated /times and /times/worldrecord already might as well make it consistent all around.
fiveman1 reopened this issue 2025-07-07 01:03:10 +00:00
Owner

Done 208f5c0b75

Done https://git.itzana.me/StrafesNET/public-api/commit/208f5c0b75f481e06044e3f0d5ff3e0bac824fd5
Sign in to join this conversation.