Get types
package main
import ( "fmt" "net/http" "io")
func main() {
url := "https://pokeapi.co/api/v2/type/1/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://pokeapi.co/api/v2/type/1/")) .method("GET", HttpRequest.BodyPublishers.noBody()) .build();HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());System.out.println(response.body());OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder() .url("https://pokeapi.co/api/v2/type/1/") .get() .build();
Response response = client.newCall(request).execute();import axios from 'axios';
const options = {method: 'GET', url: 'https://pokeapi.co/api/v2/type/1/'};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}const url = 'https://pokeapi.co/api/v2/type/1/';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}use reqwest;
#[tokio::main]pub async fn main() { let url = "https://pokeapi.co/api/v2/type/1/";
let client = reqwest::Client::new(); let response = client.get(url) .send() .await;
let results = response.unwrap() .json::<serde_json::Value>() .await .unwrap();
dbg!(results);}curl --request GET \ --url https://pokeapi.co/api/v2/type/1/wget --quiet \ --method GET \ --output-document \ - https://pokeapi.co/api/v2/type/1/Types are properties for Pokémon and their moves. Each type has three properties: which types of Pokémon it is super effective against, which types of Pokémon it is not very effective against, and which types of Pokémon it is completely ineffective against.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”This parameter can be a string or an integer.
Examples
1Responses
Section titled “Responses”Serializer for the Type resource
object
The identifier for this resource.
The name for this resource.
A detail of how effective this type is toward others and vice versa.
object
A list of types this type has no effect on.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of types this type is not very effect against.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of types this type is very effect against.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of types that have no effect on this type.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of types that are not very effective against this type.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of types that are very effective against this type.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of details of how effective this type was toward others and vice versa in previous generations
object
The last generation in which the referenced type had the listed damage relations
object
The name of the referenced resource.
The URL of the referenced resource.
The damage relations the referenced type had up to and including the listed generation
object
A list of types this type has no effect on.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of types this type is not very effect against.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of types this type is very effect against.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of types that have no effect on this type.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of types that are not very effective against this type.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of types that are very effective against this type.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of game indices relevent to this item by generation.
object
The internal id of an API resource within game data.
The generation relevent to this game index.
object
The name of the referenced resource.
The URL of the referenced resource.
The generation this type was introduced in.
object
The name of the referenced resource.
The URL of the referenced resource.
The name of this resource listed in different languages.
object
The localized name for an API resource in a specific language.
The language this name is in.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of details of Pokémon that have this type.
object
The order the Pokémon’s types are listed in.
The Pokémon that has the referenced type.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of moves that have this type.
object
The name of the referenced resource.
The URL of the referenced resource.
Type icons grouped by generation and game, with name_icon and symbol_icon URLs. Unavailable icons are null.
object
object
object
The URL of the icon displaying the type name in this game, or null if unavailable.
The URL of the type symbol icon in this game, or null if unavailable.
Example
{ "id": 1, "name": "normal", "damage_relations": { "no_damage_to": [ { "name": "ghost", "url": "https://pokeapi.co/api/v2/type/8/" } ], "half_damage_to": [ { "name": "rock", "url": "https://pokeapi.co/api/v2/type/6/" }, { "name": "steel", "url": "https://pokeapi.co/api/v2/type/9/" } ], "double_damage_to": [], "no_damage_from": [ { "name": "ghost", "url": "https://pokeapi.co/api/v2/type/8/" } ], "half_damage_from": [], "double_damage_from": [ { "name": "fighting", "url": "https://pokeapi.co/api/v2/type/2/" } ] }, "past_damage_relations": [], "game_indices": [ { "game_index": 0, "generation": { "name": "generation-i", "url": "https://pokeapi.co/api/v2/generation/1/" } }, { "game_index": 0, "generation": { "name": "generation-ii", "url": "https://pokeapi.co/api/v2/generation/2/" } } ], "generation": { "name": "generation-i", "url": "https://pokeapi.co/api/v2/generation/1/" }, "move_damage_class": { "name": "physical", "url": "https://pokeapi.co/api/v2/move-damage-class/2/" }, "names": [ { "name": "Normal", "language": { "name": "en", "url": "https://pokeapi.co/api/v2/language/9/" } } ], "pokemon": [ { "slot": 1, "pokemon": { "name": "pidgey", "url": "https://pokeapi.co/api/v2/pokemon/16/" } }, { "slot": 1, "pokemon": { "name": "pidgeotto", "url": "https://pokeapi.co/api/v2/pokemon/17/" } } ], "moves": [ { "name": "pound", "url": "https://pokeapi.co/api/v2/move/1/" }, { "name": "double-slap", "url": "https://pokeapi.co/api/v2/move/3/" } ], "sprites": { "generation-v": { "black-white": { "name_icon": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/types/generation-v/black-white/1.png", "symbol_icon": null }, "black-2-white-2": { "name_icon": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/types/generation-v/black-2-white-2/1.png", "symbol_icon": null } }, "generation-iv": { "platinum": { "name_icon": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/types/generation-iv/platinum/1.png", "symbol_icon": null }, "diamond-pearl": { "name_icon": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/types/generation-iv/diamond-pearl/1.png", "symbol_icon": null } } }}