CONTENTdm API for Ruby

Build Status

Ruby bindings for the CONTENTdm API.


Add this line to your application's Gemfile:

gem 'contentdm_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install contentdm_api

Include the library in your code:

require 'contentdm_api'

Quick Start

Retrieve Item Metadata Along With Its Compound Object Info (If it Exists) '', collection: 'p16022coll39', id: 446).

CompoundItem has been added as a convenience. It is a wrapper around the CONTENTdmAPI::RequestBatch feature (see below).

Call a CONTENTdm API function directoy

The following shows the default keyword arguments for the Service class. Please refer to the CONTENTdm API for details on each API function and corresponding parameters. Parameters must be passed as an array in the order specified in the CONTENTdm API instructions.

service = 'wsAPIDescribe', params: [], format: 'json')

response = '', service: service).fetch

Request multiple CONTENTdm functions/endpoints at once

service_configs = [{function: 'dmGetItemInfo', params: ['p16022coll39', 446]},
                   {function: 'dmGetCompoundObjectInfo', params: ['p16022coll39', 446]}]

responses = '', service_configs: service_configs).fetch

You may also use the Response class to parse and handle API inconsistencies (e.g. calls for non-existent collections result in non-JSON HTML responses): { |resp| resp[:value]).parsed }


After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to


Bug reports and pull requests are welcome on GitHub at This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.