PokeAPI / pokeapi.co

The PokéAPI documentation website
https://pokeapi.co
BSD 3-Clause "New" or "Revised" License
136 stars 52 forks source link

${mon}.varieties.${n}.pokemon.url return the wrong url #142

Closed MK-404 closed 9 months ago

MK-404 commented 1 year ago

Some Pokémon such as Dudunsparce and Glimmet are assigned at a different id than national dex number

This leads to errors that can occur if you try to access the same Pokémon again via ${mon}.varieties.${n}.pokemon.url

It return "https://pokeapi.co/api/v2/pokemon/xxx/" instead of "https://pokeapi.co/api/v2/pokemon-species/xxx/"

cmmartti commented 1 year ago

Pokemon and PokemonSpecies are two completely different resources with unrelated ID numbers. You should treat the URLs returned by the API as opaque strings and should never mutate or assemble them in code. Follow the links, don't create them yourself.

Obviously you can set your own limit and offset URL query parameters on resource lists, but you should treat the URL pathname as a static string.