dolejska-daniel/riot-api

Help with Tournament Stub

Closed this issue ยท 7 comments

I'm trying to play with tournament stub , and create a tournament code, i've followed the wiki instructions but i keep getting the 403 error (forbidden)]

am I doing something wrong ? the api initialization maybe ?

thats my code :

use RiotAPI\LeagueAPI\LeagueAPI;
use RiotAPI\LeagueAPI\Definitions\Region;
use RiotAPI\LeagueAPI\Objects;


//  Initialize
$api = new LeagueAPI([

	LeagueAPI::SET_TOURNAMENT_KEY =>'xxxxxxxxxxxxxx',
	LeagueAPI::SET_KEY    => 'xxxxxxxxxxxxxxxxx',
	

	LeagueAPI::SET_REGION => Region::BRASIL,
	LeagueAPI::SET_CACHE_CALLS => true,
	LeagueAPI::SET_CACHE_CALLS_LENGTH => 860,
	LeagueAPI::SET_CACHE_RATELIMIT => false,
	

]);

$callback_url = "https://webhook.site/1075e48a-8504-4ca9-af73-67e2859523c3" ; (a callback url just to test it)
$tournament_name = "Test Tournament";
$count = 1;

$providerParams = new Objects\ProviderRegistrationParameters([
	'region' => Region::BRASIL,
	'url'    => $callback_url,
]);

$provider_id = $api->createTournamentProvider($providerParams);


$tournamentParams = new Objects\TournamentRegistrationParameters([
	'providerId' => $provider_id,
	'name'       => $tournament_name,
]);

$tournament_id = $api->createTournament($tournamentParams);


 $codeParams = new Objects\TournamentCodeParameters([
	
	'mapType'       => 'SUMMONERS_RIFT',
	'pickType'      => 'ALL_RANDOM',
	'spectatorType' => 'ALL',
	'teamSize'      => 5,
]);

$codes = $api->createTournamentCodes($tournament_id, $count, $codeParams);

Hello again! Is your API key tournament-approved by Riot? You first have to be allowed to use these endpoints.

I have the development api key ,but even on tournament stub have i need a tournament key ? because at the riot developers site I can execute requests on the tournament stub with my key.
Only on the regular tournament i can't , it says " cannot execute. this api endpoint is not available in your policy"

Yes, you do need explicitly allowed access even for stub endpoints.

thanks again for the help !
so where can i get this tournament key ? Do I Need to register an app on the riot developers site ?

Yeah, please read everything there is at dev portal. Probably create an app, request dev key through notes, etc. You can also join official Discord - people there are amazing and very helpful.

Thanks for your time and help !
Merry christmas and a happy new year !

To you too! ๐Ÿ’–๐ŸŽ‰ Please do not forget to close the issue if solved.