I wanted to play with LeagueOfLegends API to get some data from my games.
I know I can append some params to the url like
https://europe.api.riotgames.com/riot/account/v1/accounts/by-riot-id/
-> https://europe.api.riotgames.com/riot/account/v1/accounts/by-riot-id/my_nickname/my_tag?api_key=123456
but I prefer to use headers so:
url = https://europe.api.riotgames.com/riot/account/v1/accounts/by-riot-id/
headers = {
'params': {
'name': my_name,
'tag': my_tag,
}
'api_key': 123456
}
In this question we can see that api_key
param is named X-Riot-Token
but how can I find out what are the keywords and their structure in headers?
How do I use Riot Games API with an API key?
there's no way to request the full list of headers from an api other than if you send the proper request and they return those headers. The same goes for query parameters, without docs, it's trial and error to find all the possible combinations.
Regarding the api you are using.
gameName
for League of Legends islol
tagLine
is a string value, which I believe is equivalent to theRiot ID
src: https://developer.riotgames.com/apis#account-v1/GET_getByRiotId
apparently, you can access their OpenAPI description on your local machine with the following. This should have all query and header parameter definitions for their apis.
curl -k https://127.0.0.1:2999/swagger/v3/openapi.json