Page 1 of 1

How to use TournamentsResults API call?

Posted: Fri Jan 06, 2023 8:03 pm
by Grim
I'm struggling a bit with this call when we have several of the same SNG running the same day (or any other tourney where the tournament name is the same really). I use this to send the result to everyone, once the SNG is finished.
When I fire the call with name and date, I get all the SNG tournaments (with the same name) that has run on that date. Using Start -1 doesn't change anything until I use Count. However, how do I know how many lines to pull with the Count parameter as number of participants will vary?

I'm not sure how it is intended to be used to only retrieve the last tournament with the same name. Is this even possible?

Re: How to use TournamentsResults API call?

Posted: Fri Jan 06, 2023 8:45 pm
by Kent Briggs
If you use the Tournament Finish callback event, it will give you a unique tournament number. With that, see this note from the help file:

Beginning with version 7.09, call with a Number parameter (indicating the tournament number) to retrieve the results of a single tournament. Leave the other parameters blank when using the Number parameter. The server caches the results of the last 100 tournaments played so the specified number must still be in the cache or an error will be returned. Use the Tournament Finish callback event to get notified when a new result (and its number) is available.

Re: How to use TournamentsResults API call?

Posted: Fri Jan 06, 2023 9:48 pm
by Grim
Worked like a charm, thanks!

Re: How to use TournamentsResults API call?

Posted: Fri Jan 06, 2023 10:45 pm
by Kent Briggs
By the way, to get the last tournament prior to 7.09 you would just read in the whole file and start from the bottom line, then read up line by line until you found a "Tournament=" line. That would be the start of the last tournament.

Re: How to use TournamentsResults API call?

Posted: Fri Jan 06, 2023 11:31 pm
by Grim
Well, thank God for 7.09 then. :D

Re: How to use TournamentsResults API call?

Posted: Sat Jan 07, 2023 12:44 am
by Kent Briggs
Grim wrote: Fri Jan 06, 2023 11:31 pm Well, thank God for 7.09 then. :D
It was setspike's idea:

viewtopic.php?t=3811