Skip to content
TORNLIFE More

[API] Missing timestamps

Started by Mauk [1494436] on in Bugs & Issues.

5 replies · 51 views · thread synced · 9 days ago · View on torn.com
About this thread

Posts archived: 6 / 6 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
6
Discussion span
→
People posting
2
Likes on archived posts
1
Posts by staff, officers and moderators
3
Authority score
58 / 100
Historical score
30 / 100
Story score
34 / 100
Engagement score
42 / 100
Mauk [1494436]

Hello, another minor API issue:

Several things in the API are only accessible via text (`4 minutes ago`, `In hospital for 10 hrs 20 mins `, etc) instead of a timestamp. While we can parse those numbers with some natural language heuristics, that's hardly efficient or always accurate.

Could we get these things as timestamps instead? If the concern is not handing out exact times, you could always round to the nearest minute and achieve the same level of precision. (actually, don't. you already provide accurate values through `getProfileData`, so illegal scripters would have an advantage).

Some of the things we need timestamps for:

- Last action
- Time in the hospital
- Time in jail
Chedburn [1] Admin Developer

On the 'profile' selection, I could add a 'states' category?

'jailtime'
'hospialtime'

Showing unix timestamps.

Then for 'last_action' I could split this up like this perhaps...

[last_action] => Array ( [0] => 0 minutes ago [1] => 1542623390)
Mauk [1494436]

That sounds good! Thanks!

I'd refrain from returning arrays for predefined things as it is really confusing, though. When first encountering it you don't know if the API could ever return fewer or more items. If you'd prefer to keep `last_action` a single thing, consider `last_action: { timestamp: 12345676, relative: '0 minutes ago' }` (believe me when I say that -- I still get confused around `profile/status`).

While we're talking about timestamps-- would you also add the server time to every API response?

We can currently get it from `users/bars` as `server_time` and `torn/stats` as `stats.timestamp`, but really, being able to compare responses' official server times is important for all calls -- I'm comparing the local time the request is made as a workaround, but an official `server_time` for every api response would be perfect. Supposedly you already have the unix timestamp handy for other uses anyway, so adding it to all calls shouldn't be a problem!