How to get schema of headers in REST API

113 views Asked by At

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?

1

There are 1 answers

1
Jeremy Fiel On

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.

  • the gameName for League of Legends is lol
  • the tagLine is a string value, which I believe is equivalent to the Riot ID

A Riot ID is comprised of two parts: your in-game name and a hashtag followed by three-to-five numbers or letters.

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