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
This commit is contained in:
Magnus-SmariSma
2025-03-20 23:37:21 +00:00
parent 119c3b2f7c
commit 15698662c9

View File

@ -497,11 +497,9 @@ export async function registerRoutes(app: Express): Promise<Server> {
const taxonId = taxaResponse.data.result[0].taxonid; const taxonId = taxaResponse.data.result[0].taxonid;
// Now retrieve the threats using the taxon ID // Now retrieve the threats using the taxon ID
const threatsResponse = await axios.get(`https://apiv4.iucnredlist.org/api/v4/threats`, { const threatsResponse = await axios.get(`https://api.iucnredlist.org/api/v4/threats`, {
headers: {
"Authorization": `Bearer ${iucnToken}`
},
params: { params: {
token: iucnToken,
taxonid: taxonId taxonid: taxonId
} }
}); });
@ -595,11 +593,9 @@ export async function registerRoutes(app: Express): Promise<Server> {
const taxonId = taxaResponse.data.result[0].taxonid; const taxonId = taxaResponse.data.result[0].taxonid;
// Now retrieve the habitats using the taxon ID // Now retrieve the habitats using the taxon ID
const habitatsResponse = await axios.get(`https://apiv4.iucnredlist.org/api/v4/habitats`, { const habitatsResponse = await axios.get(`https://api.iucnredlist.org/api/v4/habitats`, {
headers: {
"Authorization": `Bearer ${iucnToken}`
},
params: { params: {
token: iucnToken,
taxonid: taxonId taxonid: taxonId
} }
}); });
@ -693,11 +689,9 @@ export async function registerRoutes(app: Express): Promise<Server> {
const taxonId = taxaResponse.data.result[0].taxonid; const taxonId = taxaResponse.data.result[0].taxonid;
// Now retrieve the conservation measures using the taxon ID // Now retrieve the conservation measures using the taxon ID
const measuresResponse = await axios.get(`https://apiv4.iucnredlist.org/api/v4/measures`, { const measuresResponse = await axios.get(`https://api.iucnredlist.org/api/v4/measures`, {
headers: {
"Authorization": `Bearer ${iucnToken}`
},
params: { params: {
token: iucnToken,
taxonid: taxonId taxonid: taxonId
} }
}); });