rredlist icon indicating copy to clipboard operation
rredlist copied to clipboard

Can't generate API token

Open marcelxelo opened this issue 2 years ago • 33 comments

Hi there,

I'm trying to get the IUCN categories for some species. For that you need a key, which one should be able to generate here: https://apiv3.iucnredlist.org/api/v3/token

Nonetheless, the link doesn't work, and therefore I cannot retrieve any kind of information form rredlist.

Cheers, Marcel

marcelxelo avatar Sep 08 '23 11:09 marcelxelo

It looks like the red list API is currently down, as you've identified. Unfortunately, I'm not affiliated with IUCN, so there's not much I can do on my end. Hopefully the issue will be resolved soon.

willgearty avatar Sep 08 '23 12:09 willgearty

I reached out to the Red List team, and unfortunately, I received the following reply:

Thank you for your email and apologies for this issue. The API token request system is currently down. Unfortunately we don't have a timescale on when it might be possible to get it running again, and there is no other way to generate a token.

willgearty avatar Oct 03 '23 19:10 willgearty

In case it helps in the meantime, GBIF looks like it has a recent (May 2023) snapshot of the IUCN Red List dataset -- including threat status: https://www.gbif.org/dataset/19491596-35ae-4a91-9a98-85cf505f1bd3

You might be able to sub in something from rgbif for now to cover some rredlist options -- e.g.:

iucn_check <- name_lookup("Echinus esculentus", datasetKey = "19491596-35ae-4a91-9a98-85cf505f1bd3")

iucn_check$data[,c("speciesKey", "scientificName", "threatStatuses")]

# # A tibble: 1 × 3
#    speciesKey   scientificName                      threatStatuses 
#         <int>   <chr>                               <chr>          
#  1  176596789   Echinus esculentus Linnaeus, 1758   NEAR_THREATENED

magpiedin avatar Oct 03 '23 22:10 magpiedin

I also reached out to the Red List team last week, no response. Looks like the API route is dead for now with no outlook on a solution. Anyone have some ideas on other ways to get access to historical IUCN Red List dataset to look at changes over time?

martijnvandepol avatar Oct 25 '23 00:10 martijnvandepol

maybe on CD (at least for older versions...)

klausriede avatar Oct 25 '23 13:10 klausriede

I found a fairly simple way to access it. On the page they have several examples of the outputs. Just by copying the API of the example (visible in the url) it is possible to access the dataset.

malmagrok avatar Dec 06 '23 17:12 malmagrok

Hi Everyone, I'm Simon and I'm the Conservation Informatics Manager at the IUCN. As you've rightly identified, we're having some issues with the v3 API at the moment - we had to turn off token generation while we work to understand a few technical issues with this aging system. We've ended up getting a little sidetracked with this work as we've been pulled away to work on the 2023-1 Red List update, so fixing the API token system has, unfortunately, fallen by the wayside. I apologise that this hasn't been communicated more clearly.

As @malmagrok points out you could, for now, use the example API token on the understanding that you are allowed to use IUCN Red List data as per the terms and conditions i.e. for non-commercial purposes

Now to the good news. We're actively working on a "next-gen" API (v4) and we hope to have a beta version ready in Q1 2024 (but this might spill over into early Q2 2024) @willgearty Would you be the best person to contact nearer release about updating rredlist with the new endpoints? We will be looking to deprecate the v3 API before the end of 2024.

Cheers!

simon-tarr avatar Dec 11 '23 13:12 simon-tarr

Thanks for the information @simon-tarr, and it's great news that you're working on a new API. Yes, please reach out to me closer to the release so I can update rredlist!

willgearty avatar Dec 11 '23 14:12 willgearty

Great! I'll be in touch soon.

simon-tarr avatar Dec 11 '23 14:12 simon-tarr

It will be nice to have the iucn api functioning again!

benscarlson avatar Jan 29 '24 18:01 benscarlson

Hello, It can't generate a token on my side neither. And I don't see the examples mentioned by @malmagrok on the webpages. Is there any other solution? Best

mcauchoix avatar Feb 13 '24 02:02 mcauchoix

@mcauchoix the examples are here. For example, to get the count of species in the API, you could go here. That latter link has the example token that you can use, provided you are using it for non-commercial purposes as described above.

willgearty avatar Feb 13 '24 14:02 willgearty

@simon-tarr Hi Simon, it appears that the API is still down?

ToleranceTrading avatar Mar 24 '24 09:03 ToleranceTrading

Dear All, this is to let you know that you can now sign up for the new v4 API here: https://api.iucnredlist.org/users/sign_up

Note that the new API is still in beta so things may change from time to time until we're out of the beta phase. Also, to the best of my knowledge, none of the community R packages that query the v3 API have been updated to query the v4 API so, until this work can happen, you will have to develop your own methods for extracting data from the API e.g with httr2.

simon-tarr avatar Jun 17 '24 15:06 simon-tarr

Good news!

Andresmrv3 avatar Jun 17 '24 15:06 Andresmrv3

My plan is to update the rredlist package before the end of the summer. Feel free to reply here with anything you see in the new API that you'd like to see included in the new version of the package!

willgearty avatar Jun 17 '24 15:06 willgearty

Does the api support python? Error 401 using requests, forbidden. I can access it on the website but not in python.

Andresmrv3 avatar Jun 17 '24 15:06 Andresmrv3

I'm not sure why you're getting the 401 error @Andresmrv3 - the API is language agnostic as it's just a regular old OpenAPI spec API. Have you signed up to the new v4 API and provided your v4 token (displayed in your user area after signing up)

simon-tarr avatar Jun 17 '24 15:06 simon-tarr

@simon-tarr Fixed. I was using bearer authorization, that was the problem. I can't wait to explore! Thank you so much!

Andresmrv3 avatar Jun 17 '24 16:06 Andresmrv3

Dear All, this is to let you know that you can now sign up for the new v4 API here: https://api.iucnredlist.org/users/sign_up./

Note that the new API is still in beta so things may change from time to time until we're out of the beta phase. Also, to the best of my knowledge, none of the community R packages that query the v3 API have been updated to query the v4 API so, until this work can happen, you will have to develop your own methods for extracting data from the API e.g with httr2.

This link does not work, as the package and the rest of all. It's a shame that accessing the information has become so difficult. So much research halted because we cannot access the information properly.

karolazvdo avatar Jun 24 '24 07:06 karolazvdo

Dear All, this is to let you know that you can now sign up for the new v4 API here: https://api.iucnredlist.org/users/sign_up./ Note that the new API is still in beta so things may change from time to time until we're out of the beta phase. Also, to the best of my knowledge, none of the community R packages that query the v3 API have been updated to query the v4 API so, until this work can happen, you will have to develop your own methods for extracting data from the API e.g with httr2.

This link does not work, as the package and the rest of all. It's a shame that accessing the information has become so difficult. So much research halted because we cannot access the information properly.

Apologies, there was a typo in the URL - somehow a full stop crept into the end of the string. The correct link is https://api.iucnredlist.org/users/sign_up

simon-tarr avatar Jun 24 '24 08:06 simon-tarr

Thank you for the quick response, and sorry if I seemed rude. But I have been trying to get this data for a few days. I can generate the key, but it still doesn't work with the package and I cannot access the information. It always shows "invalid token." I have a certain deadline for this article due to the guidelines of the institution where I am doing my PhD.

Em seg., 24 de jun. de 2024 às 10:10, Simon @.***> escreveu:

Dear All, this is to let you know that you can now sign up for the new v4 API here: https://api.iucnredlist.org/users/sign_up./ Note that the new API is still in beta so things may change from time to time until we're out of the beta phase. Also, to the best of my knowledge, none of the community R packages that query the v3 API have been updated to query the v4 API so, until this work can happen, you will have to develop your own methods for extracting data from the API e.g with httr2.

This link does not work, as the package and the rest of all. It's a shame that accessing the information has become so difficult. So much research halted because we cannot access the information properly.

Apologies, there was a typo in the URL - somehow a full stop crept into the end of the string. The correct link is https://api.iucnredlist.org/users/sign_up

— Reply to this email directly, view it on GitHub https://github.com/ropensci/rredlist/issues/52#issuecomment-2185877896, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYFXEPUGOTQRJDJ7V5DW223ZI7H7JAVCNFSM6AAAAAA4QIIGJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBVHA3TOOBZGY . You are receiving this because you commented.Message ID: @.***>

-- Karoline Azevedo, M.Sc. Biologist Phone: +55 (82) 99905-1210 Lattes/C.V. (Pt): http://lattes.cnpq.br/5407395559226556 ORCID ID (En): https://orcid.org/0000-0002-6302-4187

karolazvdo avatar Jun 24 '24 09:06 karolazvdo

Unfortunately the open source community hasn't had the time yet to update their packages to account for the new structure of the v4 API - until this happens, you won't be able to use rredlist (or other pkgs) to get data out of the v4 API. If your work is urgent, you may use the public v3 API token, as per my comment last december: https://github.com/ropensci/rredlist/issues/52#issuecomment-1850115827. Alternatively, you can write your own methods to query and process the v4 API using, for example, httr2 and dplyr. This would be quite involved and perhaps not an ideal solution if you're on a tight deadline.

Remember, you can always download the data as CSVs from the Red List website. If you specify a query on the Advanced Search page, there's a "Download" button that will let you get the data as .csv files:

image

simon-tarr avatar Jun 24 '24 12:06 simon-tarr

@simon-tarr Fixed. I was using bearer authorization, that was the problem. I can't wait to explore! Thank you so much!

What authorization method did you use instead of bearer authorization? I thought that was what you were supposed to use. I am using JavaScript/Node.Js for my queries, but when I enter my API key in my headers, I get the error: Unauthorized when I sent a request.

omerome83 avatar Jun 25 '24 20:06 omerome83

My plan is to update the rredlist package before the end of the summer. Feel free to reply here with anything you see in the new API that you'd like to see included in the new version of the package!

How can we help you!? I would really like to access the API, but maybe even with the API I may not find the data I need.

DanielIAvila avatar Jul 09 '24 13:07 DanielIAvila

You can use the current version of rredlist by following the instructions in this comment: https://github.com/ropensci/rredlist/issues/52#issuecomment-1850115827. Essentially, you can use the API key from the examples on the old API's website.

willgearty avatar Jul 09 '24 20:07 willgearty

That is no longer possible unless I am doing it wrong. If you access the API, the default landing is v4, and the examples from v3 have been removed. Further, if using your KEY here , it is possible to retrieve some data in json, but the Request URL does not have a section on where to write down the KEY so the process can be automated. Right?

DanielIAvila avatar Jul 10 '24 00:07 DanielIAvila

I'll take a look this upcoming week. If necessary , I can release a quick patch until the new full version is done.

willgearty avatar Jul 12 '24 14:07 willgearty

The examples for v3 of the API are still hosted here: https://apiv3.iucnredlist.org/api/v3/docs.

You can take the API token from any of those examples and use that with rredlist.

willgearty avatar Jul 12 '24 14:07 willgearty

I just confirmed that the rredlist package works just fine using v3 of the API and the API token from the examples on this page. Please open a separate issue if the current functionality of the package does not cover what you are looking for (e.g., #48, #55).

willgearty avatar Jul 14 '24 18:07 willgearty