[][src]Crate crossref

This crate provides a client for interacting with the crossref-api

Crossref API docs Crossref - Crossref search API. The Crossref crate provides methods matching Crossref API routes:

  • works - /works route
  • members - /members route
  • prefixes - /prefixes route
  • funders - /funders route
  • journals - /journals route
  • types - /types route
  • agency - /works/{doi}/agency get DOI minting agency


Create a Crossref client:

This code runs with edition 2018
let client = Crossref::builder().build()?;

If you have an Authorization token for Crossref's Plus service:

This code runs with edition 2018
let client = Crossref::builder()

Encouraged to use the The Polite Pool:

Good manners = more reliable service

To get into Crossref's polite pool include a email address

This code runs with edition 2018
let client = Crossref::builder()
    .token("your token")

Constructing Queries

Not all components support queries and there are custom available parameters for each route that supports querying. For each resource components that supports querying there exist a Query struct: WorksQuery, MembersQuery, FundersQuery. The WorksQuery also differs from the others by supporting deep paging with cursors and field queries.

Otherwise creating queries works the same for all resource components:

This code runs with edition 2018
let query = WorksQuery::new()
.query("Machine Learning")
// field queries supported for `Works`
.field_query(FieldQuery::author("Some Author"))
// filters are specific for each resource component

Get Records

See this table for a detailed overview of the major components.

There are 3 available targets:

  • standalone resource components: /works, /members, etc. that return a list list of the corresponding items and can be specified with queries
  • Resource component with identifiers: /works/{doi}?<query>,/members/{member_id}?<query>, etc. that returns a single item if found.
  • combined with the works route: The works component can be appended to other resources: /members/{member_id}/works?<query> etc. that returns a list of matching Work items.

This resembles in the enums of the resource components, eg. for Members:

This code runs with edition 2018
pub enum Members {
    /// target a specific member at `/members/{id}`
    /// target all members that match the query at `/members?query...`
    /// target a `Work` for a specific member at `/members/{id}/works?query..`

All options are supported by the client:

Single Item by DOI (ID)

Analogous methods exist for all resource components

This code runs with edition 2018
let work = client.work("10.1037/0003-066X.59.1.29")?;

let agency = client.work_agency("10.1037/0003-066X.59.1.29")?;

let funder = client.funder("funder_id")?;

let member = client.member("member_id")?;


This code runs with edition 2018
let query = WorksQuery::new().query("Machine Learning");

// one page of the matching results
let works = client.works(query)?;

Convenience method for Work Items by terms

This code runs with edition 2018
let works = client.query_works("Machine Learning")?;

Combining Routes with the Works route

For each resource component other than Works there exist methods to append a WorksQuery with the ID option /members/{member_id}/works?<query>?

let works = client.member_works_query("member_id", WorksQuery::new()
.query("machine learning")

Convenience method to append works query term:

This code runs with edition 2018
let works = client.member_works("member id", "Machine Learning")?;

Deep paging for Works

This code runs with edition 2018
use crossref::{Crossref, WorksQuery, WorksFilter};
let client = Crossref::builder().build()?;

// request a next-cursor first
let query = WorksQuery::new()
    .query("Machine Learning")

let works = client.works(query.clone())?;


pub use self::query::Funders;
pub use self::query::Journals;
pub use self::query::Members;
pub use self::query::Prefixes;
pub use self::query::Type;
pub use self::query::Types;
pub use self::response::CrossrefType;
pub use self::response::Funder;
pub use self::response::FunderList;
pub use self::response::Journal;
pub use self::response::JournalList;
pub use self::response::Member;
pub use self::response::MemberList;
pub use self::response::TypeList;
pub use self::response::Work;
pub use self::response::WorkAgency;
pub use self::response::WorkList;



content negotiation


provides types to construct a specific query


provides the response types of the crossref api


textual data mining



Struct for Crossref search API methods


A CrossrefBuilder can be used to create Crossref with additional config.


An error that can occur while interacting with a crossref index.


Field queries are available on the /works route and allow for queries that match only particular fields of metadata.


Target Works as secondary resource component


Used to construct a query that targets crossref Works elements



Determines how results should be sorted


Results from a list response can be sorted by applying the sort and order parameters.


limits from where and how many Work items should be returned


Retrieve a publication by DOI


Filters allow you to narrow queries. All filter results are lists



root level trait to construct full crossref api request urls


represents elements that constructs parts of the crossref request url

Type Definitions


A type alias for handling errors throughout crossref.