From 15698662c960a7b99d2bfcf8bf1de76df4ecc7c2 Mon Sep 17 00:00:00 2001 From: Magnus-SmariSma <20734986-Magnus-SmariSma@users.noreply.replit.com> Date: Thu, 20 Mar 2025 23:37:21 +0000 Subject: [PATCH] Update IUCN API requests to use query parameters for authentication and taxon ID. Replit-Commit-Author: Agent Replit-Commit-Session-Id: e931b5ab-041b-42e7-baf1-50017869cef6 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/e19c6a51-7e4c-4bb8-a6a6-46dc00f0ec99/0999f8cc-1cbe-4d49-9b15-f22b9302278f.jpg --- server/routes.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/server/routes.ts b/server/routes.ts index 2843140..57e2ca7 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -497,11 +497,9 @@ export async function registerRoutes(app: Express): Promise { const taxonId = taxaResponse.data.result[0].taxonid; // Now retrieve the threats using the taxon ID - const threatsResponse = await axios.get(`https://apiv4.iucnredlist.org/api/v4/threats`, { - headers: { - "Authorization": `Bearer ${iucnToken}` - }, + const threatsResponse = await axios.get(`https://api.iucnredlist.org/api/v4/threats`, { params: { + token: iucnToken, taxonid: taxonId } }); @@ -595,11 +593,9 @@ export async function registerRoutes(app: Express): Promise { const taxonId = taxaResponse.data.result[0].taxonid; // Now retrieve the habitats using the taxon ID - const habitatsResponse = await axios.get(`https://apiv4.iucnredlist.org/api/v4/habitats`, { - headers: { - "Authorization": `Bearer ${iucnToken}` - }, + const habitatsResponse = await axios.get(`https://api.iucnredlist.org/api/v4/habitats`, { params: { + token: iucnToken, taxonid: taxonId } }); @@ -693,11 +689,9 @@ export async function registerRoutes(app: Express): Promise { const taxonId = taxaResponse.data.result[0].taxonid; // Now retrieve the conservation measures using the taxon ID - const measuresResponse = await axios.get(`https://apiv4.iucnredlist.org/api/v4/measures`, { - headers: { - "Authorization": `Bearer ${iucnToken}` - }, + const measuresResponse = await axios.get(`https://api.iucnredlist.org/api/v4/measures`, { params: { + token: iucnToken, taxonid: taxonId } });