DataCite REST API Python client library

Hey folks, just wondered if there’s a comprehensive client library for accessing the DataCite REST API from Python. Making API calls manually is fine but a bit repetitive and requires some boilerplate (especially when paging results). I found a couple of entries on PyPI but they’re very focused on the basic individual DOI CRUD use cases, so don’t cover, for example, fetching Repository information or querying/filtering existing DOIs.

Cheers,
Jez

Hi @jezcope I don’t know of any libraries for getting organization/repository info, but I know that some DataCite consortium leads have written scripts that they use for various tasks. Maybe @KellyStathis or @carly.robinson know of something? Otherwise, I’d be interested to hear more about your use case - maybe I can help to write some example scripts.

1 Like

@lizkrz @jezcope - unfortunately, I’m not aware of anything that would help. From our developer: most of the libraries we’ve written focused around single DOI CRUD operations. At this point we haven’t really had a use-case for pagination or query usage with DataCite.

1 Like

@jezcope @lizkrz I am not aware of any libraries, but I’m happy to share some example scripts if that is helpful! We have one for exporting metadata for consortium organizations and repositories, which we mainly use to grab contact information.

Thanks @KellyStathis - sounds like your scripts would be a good start. Would be great if you could share!

1 Like

I made our script more generic and uploaded it to GitHub: GitHub - KellyStathis/datacite_consortium_data: Exports data for a DataCite consortium's organizations and their repositories.

Please let me know if you run into any problems! :slight_smile:

1 Like

Hi @jezcope, @kelvinlyy from GigaScience has been recently working on a new python library for the REST API. If you provide XML files, it will convert to a JSON file and post it with REST API. Feel free to use it and let us know what you think about it.

1 Like

Thanks folks, this is all really helpful! :slight_smile:

I’m currently working on a workflow to do a bulk update on a batch of DOIs, and documenting it in a Jupyter Notebook so that my team can learn from and adapt it in future, so I’ll share it here too if that would be useful?

At some point when I’ve got more time (ha ha…) I’ll look into abstracting some stuff into a reusable library.

1 Like

Quick update: I’ve done what I needed to do this week with the API, and I’m just waiting to check where I can share the resulting notebook with you all. I don’t think there’s a question of whether I can share it, but of course IP considerations may dictate how

My code is now here: GitHub - britishlibrary/datacite-automation: Examples of automating tasks with DataCite and related APIs

In particular, see:

NB. Currently no license there, so default copyright rules apply: I’ll update this as soon as I get a chance

2 Likes

That’s awesome! Thanks for sharing. @Mary_Hirsch Maybe we could add a page listing code examples like this to the support site?

1 Like

Yep. Sounds good. I think it would really helpful to share these great examples :grinning:

New code examples support doc is live!

If you have DataCite-related code to share, we encourage you to tag your repository with the topic datacite, so it’s easy to find, ex datacite · GitHub Topics · GitHub . For instructions, see Classifying your repository with topics .

@jezcope @KellyStathis Would you mind tagging your repos with the topic datacite?

1 Like