Page 1 of 1

How to find running tournaments with API?

Posted: Sat Jan 07, 2023 5:56 pm
by Grim
Is there an API call I can use where I see which tournaments are running?

I know there's a TournamentsPlaying call, but there I need a name. Is there a way to not have to cycle through all the tournaments?

Also, TournamentsPlaying doesn't tell if latereg is still possible - or even better, how long until registration closes. Is this possible to add?

Re: How to find running tournaments with API?

Posted: Sat Jan 07, 2023 6:12 pm
by Kent Briggs
Call TournamentsList and then loop through them and look at the Status field. For details like late registration, call TournamentsGet for a particular tournament and look at its particular settings like StartTime and LateRegMinutes, then compare that with the current time. That's not guaranteed to be exact because the late reg could end early if payouts start. If you want a real time notice about when the late registration ends, use the Tournament timer callback event.

Re: How to find running tournaments with API?

Posted: Sat Jan 07, 2023 8:27 pm
by Grim
Any plans on adding a TournamentsRunning API call? ;)

Re: How to find running tournaments with API?

Posted: Sat Jan 07, 2023 8:45 pm
by Kent Briggs
Grim wrote: Sat Jan 07, 2023 8:27 pm Any plans on adding a TournamentsRunning API call? ;)
No, it would be redundant with what's already available.

Re: How to find running tournaments with API?

Posted: Sun Jan 08, 2023 12:31 pm
by Grim
Kent Briggs wrote: Sat Jan 07, 2023 8:45 pm
Grim wrote: Sat Jan 07, 2023 8:27 pm Any plans on adding a TournamentsRunning API call? ;)
No, it would be redundant with what's already available.
Fair enough. Could you add number to TournamentsPlaying though? When TourneyStart fires, I can store the number in a file and when someone requests status, I can check with the number instead of the current cumbersome way. When it's finished I can just pop it out of the file.

Re: How to find running tournaments with API?

Posted: Sun Jan 08, 2023 1:12 pm
by Kent Briggs
Grim wrote: Sun Jan 08, 2023 12:31 pm Fair enough. Could you add number to TournamentsPlaying though? When TourneyStart fires, I can store the number in a file and when someone requests status, I can check with the number instead of the current cumbersome way. When it's finished I can just pop it out of the file.
The tournaments are indexed internally by name (which the TourneyStart callback provides to you) so the TournamentsPlaying API needs the name, just like the other calls that deal with a particular tournament. TournamentsResults maintains a cache of results in memory which is the only reason it works with just a number.

Re: How to find running tournaments with API?

Posted: Sun Jan 08, 2023 1:47 pm
by Grim
Yes, but when there's several of the same SNG played that night, wouldn't I get all of them when calling TournamentsPlaying?

Re: How to find running tournaments with API?

Posted: Sun Jan 08, 2023 3:03 pm
by Kent Briggs
Grim wrote: Sun Jan 08, 2023 1:47 pm Yes, but when there's several of the same SNG played that night, wouldn't I get all of them when calling TournamentsPlaying?
TournamentsPlaying returns the current names of players for the specified named tournament. It's doesn't retrieve past data, just what is happening currently with that tournament. Past data is in the Tourney Results logs.

Re: How to find running tournaments with API?

Posted: Sun Jan 08, 2023 3:24 pm
by Grim
Aha. Thanks again!