Get location area
package main
import ( "fmt" "net/http" "io")
func main() {
url := "https://pokeapi.co/api/v2/location-area/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/location-area/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/location-area/1/") .get() .build();
Response response = client.newCall(request).execute();import axios from 'axios';
const options = {method: 'GET', url: 'https://pokeapi.co/api/v2/location-area/1/'};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}const url = 'https://pokeapi.co/api/v2/location-area/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/location-area/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/location-area/1/wget --quiet \ --method GET \ --output-document \ - https://pokeapi.co/api/v2/location-area/1/Location areas are sections of areas, such as floors in a building or cave. Each area has its own set of possible Pokémon encounters.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”A unique integer value identifying this location area.
Examples
1Responses
Section titled “Responses”object
The identifier for this resource.
The name for this resource.
The internal id of an API resource within game data.
A list of methods in which Pokémon may be encountered in this area and how likely the method will occur depending on the version of the game.
object
The method in which Pokémon may be encountered in an area..
object
The name of the referenced resource.
The URL of the referenced resource.
The chance of the encounter to occur on a version of the game.
object
The chance of an encounter to occur.
The version of the game in which the encounter can occur with the given chance.
object
The name of the referenced resource.
The URL of the referenced resource.
The region this location area can be found 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 Pokémon that can be encountered in this area along with version specific details about the encounter.
object
The Pokémon being encountered.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of versions and encounters with Pokémon that might happen in the referenced location area.
object
The game version this encounter happens in.
object
The name of the referenced resource.
The URL of the referenced resource.
The total percentage of all encounter potential.
A list of encounters and their specifics.
object
The lowest level the Pokémon could be encountered at.
The highest level the Pokémon could be encountered at.
Percent chance that this encounter will occur.
The method by which this encounter happens.
object
The name of the referenced resource.
The URL of the referenced resource.
A list of condition values that must be in effect for this encounter to occur.
object
The name of the referenced resource.
The URL of the referenced resource.
Additional properties of the encountered Pokémon, or null if unspecified.
object
The minimum number of perfect IVs, or null if unspecified.
Whether the encountered Pokémon is always shiny.
Whether the encountered Pokémon can never be shiny.
Whether the encountered Pokémon is an alpha Pokémon.
Example
{ "id": 1, "name": "canalave-city-area", "game_index": 1, "encounter_method_rates": [ { "encounter_method": { "name": "old-rod", "url": "https://pokeapi.co/api/v2/encounter-method/2/" }, "version_details": [ { "rate": 25, "version": { "name": "diamond", "url": "https://pokeapi.co/api/v2/version/12/" } }, { "rate": 25, "version": { "name": "pearl", "url": "https://pokeapi.co/api/v2/version/13/" } } ] }, { "encounter_method": { "name": "good-rod", "url": "https://pokeapi.co/api/v2/encounter-method/3/" }, "version_details": [ { "rate": 50, "version": { "name": "diamond", "url": "https://pokeapi.co/api/v2/version/12/" } }, { "rate": 50, "version": { "name": "pearl", "url": "https://pokeapi.co/api/v2/version/13/" } } ] } ], "location": { "name": "canalave-city", "url": "https://pokeapi.co/api/v2/location/1/" }, "names": [ { "name": "Canalave City", "language": { "name": "en", "url": "https://pokeapi.co/api/v2/language/9/" } } ], "pokemon_encounters": [ { "pokemon": { "name": "tentacool", "url": "https://pokeapi.co/api/v2/pokemon/72/" }, "version_details": [ { "version": { "name": "diamond", "url": "https://pokeapi.co/api/v2/version/12/" }, "max_chance": 60, "encounter_details": [ { "min_level": 20, "max_level": 30, "chance": 60, "method": { "name": "surf", "url": "https://pokeapi.co/api/v2/encounter-method/5/" }, "condition_values": [], "pokemon_details": null } ] }, { "version": { "name": "pearl", "url": "https://pokeapi.co/api/v2/version/13/" }, "max_chance": 60, "encounter_details": [ { "min_level": 20, "max_level": 30, "chance": 60, "method": { "name": "surf", "url": "https://pokeapi.co/api/v2/encounter-method/5/" }, "condition_values": [], "pokemon_details": null } ] } ] }, { "pokemon": { "name": "tentacruel", "url": "https://pokeapi.co/api/v2/pokemon/73/" }, "version_details": [ { "version": { "name": "diamond", "url": "https://pokeapi.co/api/v2/version/12/" }, "max_chance": 5, "encounter_details": [ { "min_level": 20, "max_level": 40, "chance": 5, "method": { "name": "surf", "url": "https://pokeapi.co/api/v2/encounter-method/5/" }, "condition_values": [], "pokemon_details": null } ] }, { "version": { "name": "pearl", "url": "https://pokeapi.co/api/v2/version/13/" }, "max_chance": 5, "encounter_details": [ { "min_level": 20, "max_level": 40, "chance": 5, "method": { "name": "surf", "url": "https://pokeapi.co/api/v2/encounter-method/5/" }, "condition_values": [], "pokemon_details": null } ] } ] } ]}