List genrations
GET
/api/v2/generation/
package main
import ( "fmt" "net/http" "io")
func main() {
url := "https://pokeapi.co/api/v2/generation/"
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/")) .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/") .get() .build();
Response response = client.newCall(request).execute();import axios from 'axios';
const options = {method: 'GET', url: 'https://pokeapi.co/api/v2/generation/'};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}const url = 'https://pokeapi.co/api/v2/generation/';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/";
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/wget --quiet \ --method GET \ --output-document \ - https://pokeapi.co/api/v2/generation/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”Query Parameters
Section titled “Query Parameters”limit
integer
Number of results to return per page.
offset
integer
The initial index from which to return the results.
q
string
Only available locally and not at pokeapi.co Case-insensitive query applied on the
nameproperty.
Responses
Section titled “Responses”Media typeapplication/json
object
count
required
The total number of resources available from this API.
integer
next
The URL for the next page in the list, or null if there is no next page.
string | null format: uri
previous
The URL for the previous page in the list, or null if there is no previous page.
string | null format: uri
results
required
A list of API resources on this page.
Array<object>
object
name
required
The name of the referenced resource.
string
url
required
The URL of the referenced resource.
string format: uri
Example
{ "count": 9, "next": "https://pokeapi.co/api/v2/generation/?offset=2&limit=2", "previous": null, "results": [ { "name": "generation-i", "url": "https://pokeapi.co/api/v2/generation/1/" }, { "name": "generation-ii", "url": "https://pokeapi.co/api/v2/generation/2/" } ]}