[API Suggestion] add times of last change

[API Suggestion] add times of last change

in API Development

Posted by: Tub.4560

Tub.4560

Hi,

I’d like to have access to the time when an event last changed its state, or a WvW objective changed owners.

For events that are running, I’d like to see if they’ve just started (so I can join) or if they’ve been running for a while (so it’s likely finished by the time I get there) or maybe if they’ve been running for hours (likely to be bugged and worth checking out and reporting).
If they’re not running, I’d like to know when they’ve finished last, possibly making a prediction about their next start.

Same for WvW: did that camp switch owners in the last 5 minutes? Can it be taken back or not? Has the keep been in enemies hands for long, is it likely to be upgraded?

It’d be nice if a single query to the API could answer these questions.

Of course I can get that data by continuously polling the API, comparing with a local cache and inserting the time of change on my own. This is however
a) inaccurate, since I really shouldn’t poll every second
b) a waste of my bandwidth and system resources
c) a waste of ANet’s bandwidth and system resources
d) likely to get me a scolding from the College of Statics

My suggestion is to change the APIs as follows. The events.json might return something like this:

{
  "current_time": 1369858634,
  "events":[
   {"world_id":42,"map_id":42,"event_id":"12345","state":"Success","laststatechange":1369858217},
   {"world_id":42,"map_id":42,"event_id":"67890","state":"Active","laststatechange":1369858453},
   ...
}
  • .current_time is optional. It would be useful for synchronization, making it easier to deal with network lag or poorly synchronized local clocks.
  • .laststatechange is the time when the value of .state changed to the value it currently has. I don’t really care about the time format. Unix timestamps may be the most efficient in terms of encoding and calculations (seconds_since_change = myevent.laststatechange – data.current_time), but a properly formatted datestring should be workable, too.
  • Similary for wvw, match_details.json should add .lastownerchange to all objectives. Maybe lastownerguildchange for completeness’ sake.

Of course a proper push API would be even better, but since we’re stuck with polling, this is the next best thing to reduce load while increasing accuracy. It it possible to add this information with the current architecture, or should I expect to keep polling for my project?

Oh, and while I’m here: thank you ANet for this awesome toy!

[API Suggestion] add times of last change

in API Development

Posted by: Khisanth.2948

Khisanth.2948

There are already existing threads for these suggestions.
https://forum-en.gw2archive.eu/forum/community/api/API-Suggestion-Events
https://forum-en.gw2archive.eu/forum/community/api/API-Suggestion-World-vs-World

Even with the same suggestion for events.

For the WvW suggestion that should NOT be done. It would enable checking the remaining time on Righteous Indignation without ever being near the camp.

[API Suggestion] add times of last change

in API Development

Posted by: smiley.1438

smiley.1438

It would enable checking the remaining time on Righteous Indignation without ever being near the camp.

Thats already possible without a timestamp

http://mos.millenium.org/na/matchups/map/711