How to find running tournaments with API?

For discussion of the Poker Mavens server module and other administration topics
Post Reply
Grim
Posts: 87
Joined: Thu Oct 15, 2020 8:11 pm

How to find running tournaments with API?

Post 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?
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: How to find running tournaments with API?

Post 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.
Grim
Posts: 87
Joined: Thu Oct 15, 2020 8:11 pm

Re: How to find running tournaments with API?

Post by Grim »

Any plans on adding a TournamentsRunning API call? ;)
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: How to find running tournaments with API?

Post 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.
Grim
Posts: 87
Joined: Thu Oct 15, 2020 8:11 pm

Re: How to find running tournaments with API?

Post 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.
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: How to find running tournaments with API?

Post 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.
Grim
Posts: 87
Joined: Thu Oct 15, 2020 8:11 pm

Re: How to find running tournaments with API?

Post 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?
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: How to find running tournaments with API?

Post 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.
Grim
Posts: 87
Joined: Thu Oct 15, 2020 8:11 pm

Re: How to find running tournaments with API?

Post by Grim »

Aha. Thanks again!
Post Reply