Skip to content

SUL Pub API Documentation

Peter Mangiafico edited this page Nov 16, 2021 · 16 revisions

(until openapi spec available - see #1413)

BibJSON Schema

The "pub_hash" data structure is the BibJSON response for a publication. It's schema is shown here: https://github.com/sul-dlss/sul_pub/blob/main/pub_hash_schema.yml

Older API documentation

https://github.com/sul-dlss/sul_pub/tree/prefer-pubmed/app/views/pages https://github.com/sul-dlss/sul_pub/tree/prefer-pubmed/app/views/pages/schemas https://github.com/sul-dlss/sul_pub/tree/prefer-pubmed/app/views/pages/api_samples

Available Endpoints

Force an immediate harvest of a given author

POST /authors/:cap_profile_id/harvest.json

Create or update an authorship record, i.e. an association between an existing publication and an existing author.

The POST operation will create or update an existing record. Authors can be identified using cap_profile_id or sul_author_id (primary key on our author table). Publications can be identified using sul_pub_id (primary key on our publications table), pmid, sw_id, or wos_uid. At least one author identifier and one publication identifier are required. Example JSON shown below with allowed values for the attributes.

POST /authorship.json
{"cap_profile_id":"cap_profile_id","featured":[true|false],"status":"[approved|denied]","visibility":"[public|private]","sul_pub_id":"sul_pub_id"}

Update an authorship record, i.e. an association between an existing publication and an existing author.

The PATCH request option allows partial (or full) attribute updates on an existing contribution (association between a publication and an author). It will not create any new authors, publication or contributions. You send a PATCH request with JSON data. It requires a sul_pub_id (primary key on our publication table) to identify an existing publication (it does not accept a 'pmid' or 'sw_id'). It accepts sul_author_id (primary key on our author table) or cap_profile_id to identify an existing author. If it can find an existing contribution for the given author and publication, it will update any of the contribution attributes: featured, status, or visibility. Any or all of these can be included in the JSON payload. Any attributes that are not given should not be changed. It thus allows partial updating for an existing contribution record. Example JSON shown below with allowed values for the attributes.

PATCH /authorship.json
{"cap_profile_id":"cap_profile_id","featured":[true|false],"status":"[approved|denied]","visibility":"[public|private]","sul_pub_id":"sul_pub_id"}

Return Publications

Retrieve publications:

GET /publications.json                                       

Available query string parameters:

  • capProfileId=X - the cap_profile_id of the author to restrict publications to
  • page=X - the page number of results to return (defaults to 1)
  • per=X - the number of results per page to return (defaults to 1000)
  • capActive=true - restrict to only active CAP authors
  • changedSince=YYYY-MM-DD - restrict to only publications created/updated since that date

For example:

GET /publications.json?capProfileId=1&changedSince=2018-01-01 # publications on cap_profile_id 1 since Jan 1, 2018

Returns an array of publication BibJSON (see top of page).

Return a single specific publication

GET /publications/:sul_pub_id

Returns publication BibJSON (see top of page).

Create a new manual publication by posting BibJSON

POST /publications

Update a publication metadata by putting BibJSON (see top of page)

PUT /publications/:sul_pub_id

Mark a publication as deleted

NOTE: There is not a current use case for this.

DELETE /publications/:sul_pub_id

Look up publications by Title, DOI or PMID

Used to search for publications, either currently in sul-pub or at the Web of Science or Pubmed Central. Pass in a title, a DOI or a PMID. Returns an array of BibJSON (see top of page).

Search by title:

GET /publications/sourcelookup.json?title=TITLE

Search by DOI:

GET /publications/sourcelookup.json?doi=DOI

Search by PMID:

GET /publications/sourcelookup.json?pmid=PMID