Get genration
package main
import ( "fmt" "net/http" "io")
func main() {
url := "https://pokeapi.co/api/v2/generation/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/generation/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/generation/1/") .get() .build();
Response response = client.newCall(request).execute();import axios from 'axios';
const options = {method: 'GET', url: 'https://pokeapi.co/api/v2/generation/1/'};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}const url = 'https://pokeapi.co/api/v2/generation/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/generation/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/generation/1/wget --quiet \ --method GET \ --output-document \ - https://pokeapi.co/api/v2/generation/1/A generation is a grouping of the Pokémon games that separates them based on the Pokémon they include. In each generation, a new set of Pokémon, Moves, Abilities and Types that did not exist in the previous generation are released.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”This parameter can be a string or an integer.
Examples
1Responses
Section titled “Responses”object
The identifier for this resource.
The name for this resource.
A list of abilities that were introduced in this generation.
object
The name of the referenced resource.
The URL of the referenced resource.
The main region travelled in this generation.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of moves that were introduced in this generation.
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 Pokémon species that were introduced in this generation.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of types that were introduced in this generation.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of version groups that were introduced in this generation.
object
The name of the referenced resource.
The URL of the referenced resource.
Example
{ "id": 1, "name": "generation-i", "abilities": [], "main_region": { "name": "kanto", "url": "https://pokeapi.co/api/v2/region/1/" }, "moves": [ { "name": "pound", "url": "https://pokeapi.co/api/v2/move/1/" }, { "name": "karate-chop", "url": "https://pokeapi.co/api/v2/move/2/" } ], "names": [ { "name": "Generation I", "language": { "name": "en", "url": "https://pokeapi.co/api/v2/language/9/" } } ], "pokemon_species": [ { "name": "bulbasaur", "url": "https://pokeapi.co/api/v2/pokemon-species/1/" }, { "name": "ivysaur", "url": "https://pokeapi.co/api/v2/pokemon-species/2/" } ], "types": [ { "name": "normal", "url": "https://pokeapi.co/api/v2/type/1/" }, { "name": "fighting", "url": "https://pokeapi.co/api/v2/type/2/" } ], "version_groups": [ { "name": "red-blue", "url": "https://pokeapi.co/api/v2/version-group/1/" }, { "name": "yellow", "url": "https://pokeapi.co/api/v2/version-group/2/" } ]}