Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test beta Rogue Scholar API #872

Open
maelle opened this issue Oct 17, 2024 · 5 comments · May be fixed by #876
Open

test beta Rogue Scholar API #872

maelle opened this issue Oct 17, 2024 · 5 comments · May be fixed by #876
Assignees

Comments

@maelle
Copy link
Member

maelle commented Oct 17, 2024

No description provided.

@maelle maelle self-assigned this Oct 17, 2024
@maelle
Copy link
Member Author

maelle commented Oct 18, 2024

@mfenner

What we use now is https://api.rogue-scholar.org/blogs/ropensci: we match each post with the records in that API listing using the URL. If there's a match we use the DOI. If there's no match we use the general URL of rOpenSci on Rogue Scholar as fallback. Here's the code: https://github.com/ropensci/roweb3/blob/main/themes/ropensci/layouts/partials/blogs/doi.html

https://beta.rogue-scholar.org/api/communities/ropensci/records is different. As you noted, there's no URL so I am not sure how to match posts. Furthermore, there seems to be a limit on the number of posts, maybe a limit parameter? I'd need to get all posts. Lastly, the DOI doesn't start with doi.org

@mfenner
Copy link

mfenner commented Oct 18, 2024

I would strongly recommend to use the id/guid of the post as defined in the Atom/RSS/JSON Feed spec (e.g. https://www.w3schools.com/xml/rss_tag_guid.asp). This guid is globally unique and is not supposed to change when you change the URL of the post, e.g. move to a different host. In practical terms and with Hugo the guid and URL are often the same. A good example where they are different is blogs powered by databases such as Wordpress.

To find the guid (or URL) in the InvenioRDM API you have to look at the identifiers metadata, and I added the guid and url yesterday (and also the uuid, an internal identifier given by Rogue Scholar). Either parse the metadata.identifiers field in the https://beta.rogue-scholar.org/api/communities/ropensci/records response, or query the API for a specific post, e.g. https://beta.rogue-scholar.org/api/records?q=metadata.identifiers.identifier:%22https://ropensci.org/blog/2024/10/10/czi-latam-grant/%22 (no need to use the communities API endpoint). Not all InvenioRDM records are already updated to contain these metadata, but all records in the ropensi community should. Use double quotes (or %22) for an exact match of the query string.

You find the DOI at pids.doi.identifier.

You can control the number of records returned with the size parameter (defaults to 10): https://inveniordm.docs.cern.ch/reference/rest_api_drafts_records/#search-records. You can also do pagination, or limit the query with a date range, e.g. to see all records from posts published in the 6 months.

Parsing the API calls is a little bit more convoluted than with the current API, but would work on any InvenioRDM API, including Zenodo. Zenodo is slightly different for legacy reasons with their old API, they switched to InvenioRDM 12 months ago.

@maelle
Copy link
Member Author

maelle commented Oct 18, 2024

Thank you, this is very helpful!!

@maelle
Copy link
Member Author

maelle commented Oct 18, 2024

@mfenner are there docs for the parameters of https://beta.rogue-scholar.org/api/records?q=metadata.identifiers.identifier:%22https://ropensci.org/blog/2024/10/10/czi-latam-grant/%22? I'm seeing some differences in the browser vs in the console and am exploring what I'm doing wrong.

@mfenner
Copy link

mfenner commented Oct 18, 2024

The InvenioRDM API documentation is at https://inveniordm.docs.cern.ch/reference/rest_api_drafts_records/. This of course doesn't include the customizations for Rogue Scholar, e.g. the uuid and guid identifiers. I need to think about specific documentation for Rogue Scholar for the 5-10% that are different.

@maelle maelle linked a pull request Oct 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants