build Coverage Status MIT license Gem Version Inline docs

What is it?

This gem provides Ruby client connectivity to Datacite's Metadata store (MDS). The MDS is a service for data publishers to mint DOIs and register associated metadata. It is aimed mainly at scientific and research data publishers. This gem allows for simple and seamless interaction with the MDS service.


Add this line to your application's Gemfile:

gem 'datacite_mds'

And then execute:

$ bundle

Or install it yourself as:

$ gem install datacite_mds


Require the gem

require 'datacite_mds'

Object creation

create an Mds object (explicit authorization)

mds = authorize: {usr: "joe bloggs", pwd: "password"}

create an Mds object (implicit authorization via DATACITE_USR, DATACITE_PWD environment variables)

mds = 

create an Mds object for testing (implicit authorization)

mds = testing: true    

Metadata operations

upload metadata

res = mds.'metadata.xml')
p res # => <Net::HTTPCreated 201 Created readbody=true>

delete metadata

res = mds. '10.5072/existing-doi'
p res # => <Net::HTTPOK 200 OK readbody=true> 

get metadata for existing DOI

res = mds. '10.5072/existing-doi'
if res.instance_of? Net::HTTPOK
    p res.body # shows the xml metadata

check if metadata is valid XML for for Datacite Schema (

unless Datacite::Mds.()
    Datacite::Mds.validation_errors.each do |error|
        p "Validation error: #{error}"  

DOI operations

resolve a DOI

res = mds.resolve '10.5072/existing-doi'
p res # => <Net::HTTPOK 200 OK readbody=true

get all DOIs for datacentre

res = mds.get_all_dois
if res.instance_of? Net::HTTPOK
    p res.body.split # show all DOIs

mint a DOI

Note: before minting a DOI, ensure you have uploaded metadata for that DOI, by using the #upload_metadata method.

res = '10.5072/non-existing-doi', '<an-existing-uuid>'
p res # => <Net::HTTPCreated 201 Created readbody=true> 

update dataset for existing DOI

res = '10.5072/existing-doi', '<new-uuid>'    
p res # => <Net::HTTPCreated 201 Created readbody=true> 


Minitest is used for testing. To run all tests, you must set the DATACITE_USR, DATACITE_PWD environment variables and then:

$ rake test

Note: Some of the tests use DOIs and URLs issued to the Bodleian Libraries and can be accessed only by using the Bodleian datacentre authorisation credentials. It is recommended that you substitute these constant variables' values in the test file, with your own datacentre's DOIs and URLs.


The gem is available as open source under the terms of the MIT License, c/o The Chancellor Masters and Scholars of the University of Oxford.


  1. Fork the repository
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request