diff --git a/attached_assets/Pasted-Got-it-you-need-the-essential-information-to-use-the-IUCN-Red-List-API-V4-without-the-code-Here-s-1742512823907.txt b/attached_assets/Pasted-Got-it-you-need-the-essential-information-to-use-the-IUCN-Red-List-API-V4-without-the-code-Here-s-1742512823907.txt new file mode 100644 index 0000000..0839213 --- /dev/null +++ b/attached_assets/Pasted-Got-it-you-need-the-essential-information-to-use-the-IUCN-Red-List-API-V4-without-the-code-Here-s-1742512823907.txt @@ -0,0 +1,58 @@ +Got it, you need the essential information to use the IUCN Red List API V4, without the code. Here's a concise guide: + +**1. Base URL:** + +* The base URL for all API requests is: `https://apiv4.iucnredlist.org` + +**2. Authentication:** + +* The API uses Bearer token authentication. +* You'll need to include an `Authorization` header in your HTTP requests. +* The header value should be: `Bearer YOUR_API_TOKEN` (replace `YOUR_API_TOKEN` with your actual token). + +**3. Common Endpoints and Parameters:** + +Here are a few common endpoints with examples of parameters you can pass: + +* **Get a list of biogeographical realms:** + * Endpoint: `GET /api/v4/biogeographical_realms/` + * No parameters needed. +* **Get assessments for a biogeographical realm:** + * Endpoint: `GET /api/v4/biogeographical_realms/{code}` (replace `{code}` with the realm code, e.g., `NT`) + * Parameters (query parameters): + * `page`: Page number (integer). + * `year_published`: Filter by year published (integer). + * `latest`: Filter by latest (boolean). + * `possibly_extinct`: Filter by possibly extinct (boolean). + * `possibly_extinct_in_the_wild`: Filter by possibly extinct in the wild (boolean). + * `scope_code`: Filter by scope code (integer). +* **Get taxa by scientific name:** + * Endpoint: `GET /api/v4/taxa/scientific_name` + * Parameters (query parameters): + * `genus_name`: The genus name (string, required). + * `species_name`: The species name (string, required). + * `infra_name`: The infra-name (string, optional). + * `subpopulation_name`: The subpopulation name (string, optional). +* **Get assessments by kingdom name:** + * Endpoint: `GET /api/v4/taxa/kingdom/{kingdom_name}` (replace `{kingdom_name}` with the kingdom name, e.g., `Animalia`) + * Parameters (query parameters): + * `page`: Page number (integer). + * `year_published`: Filter by year published (integer). + * `latest`: Filter by latest (boolean). + * `scope_code`: Filter by scope code (integer). + +**4. Request Example (using cURL):** + +```bash +curl -H "Authorization: Bearer YOUR_API_TOKEN" "https://apiv4.iucnredlist.org/api/v4/biogeographical_realms/NT?page=1" +``` + +**5. Response Format:** + +* The API returns JSON responses. + +**Important Notes:** + +* Replace `YOUR_API_TOKEN` with your actual token. +* Refer to the official API documentation for a complete list of endpoints and parameters. +* The API documentation will also provide example responses, which will help you understand the returned data. diff --git a/client/src/lib/api.ts b/client/src/lib/api.ts index 00bf51b..3b5a095 100644 --- a/client/src/lib/api.ts +++ b/client/src/lib/api.ts @@ -13,10 +13,10 @@ export const IUCN_API_ENDPOINTS = { BASE_URL: "https://apiv4.iucnredlist.org/api/v4", VERSION: "version", TAXA: "taxa", - TAXA_BY_SCIENTIFIC_NAME: "taxa/scientific_name", - THREATS_BY_TAXON_ID: "threats/species/id", - HABITATS_BY_TAXON_ID: "habitats/species/id", - MEASURES_BY_TAXON_ID: "measures/species/id" + TAXA_BY_SCIENTIFIC_NAME: "taxa/scientific_name", // GET with params: genus_name and species_name + THREATS: "threats", // GET with params: taxonid + HABITATS: "habitats", // GET with params: taxonid + MEASURES: "measures" // GET with params: taxonid }; // API types