Request For Comments (RFCs)
  • Request for comments (RFC)
  • RFC 001: Matcher architecture
  • RFC 002: Archival Storage Service
  • RFC 003: Asset Access
  • RFC 004: METS Adapter
  • RFC 005: Reporting Pipeline
  • RFC 006: Reindexer architecture
  • RFC 007: Goobi Upload
  • RFC 008: API Filtering
  • RFC 009: AWS account setup
  • RFC 010: Data model
  • RFC 011: Network Architecture
  • RFC 012: API Architecture
  • RFC 013: Release & Deployment tracking
    • Deployment example
    • Version 1
  • RFC 014: Born digital workflow
  • RFC 015: How we work
    • Code Reviews
    • Shared Libraries
  • RFC 016: Holdings service
  • URL Design
  • Pipeline Tracing
  • Platform Reliability
    • CI/CD
    • Observability
    • Reliability
  • RFC 020: Locations and requesting
  • RFC 021: Data science in the pipeline
  • RFC 022: Logging
    • Logging example
  • RFC 023: Images endpoint
  • RFC 024: Library management
  • RFC 025: Tagging our Terraform resources
  • RFC 026: Relevance reporting service
  • RFC 026: Relation Embedder
  • RFC 027: Pipeline Intermediate Storage
  • RFC 029: Work state modelling
  • Pipeline merging
  • RFC 031: Relation Batcher
  • RFC 032: Calm deletion watcher
  • RFC 033: Api internal model versioning
  • RFC 034: Modelling Locations in the Catalogue API
  • RFC 035: Modelling MARC 856 "web linking entry"
  • RFC 036: Modelling holdings records
  • API faceting principles & expectations
  • Matcher versioning
  • Requesting API design
  • TEI Adapter
  • Tracking changes to the Miro data
  • How do we tell users how to find stuff?
  • Removing deleted records from (re)indexes
  • RFC 044: Tracking Patron Deletions
  • Work relationships in Sierra, part 2
    • Work relationships in Sierra
  • Born Digital in IIIF
  • Transitive hierarchies in Sierra
  • RFC 047: Changing the structure of the Catalogue API index
  • RFC 048: Concepts work plan
  • RFC 049: Changing how aggregations are retrieved by the Catalogue API
  • RFC 050: Design considerations for the concepts API
  • RFC 051: Ingesting Library of Congress concepts
  • RFC: 052: The Concepts Pipeline - phase one
  • RFC 053: Logging in Lambdas
  • RFC 054: Authoritative ids with multiple Canonical ids.
  • RFC 055: Genres as Concepts
  • RFC 055: Content API
    • Content API: articles endpoint
    • Content API: Events endpoint
    • Content API: exhibitions endpoint
    • The future of this endpoint
  • RFC 056: Prismic to Elasticsearch ETL pipeline
  • RFC 57: Relevance testing
    • Examples of rank CLI usage
  • RFC 059: Splitting the catalogue pipeline Terraform
  • RFC 060: Service health-check principles
  • RFC 060: Offsite requesting
    • Sierra locations in the Catalogue API
  • Content-api: next steps
Powered by GitBook
On this page
  • Background
  • Guiding principles
  • Proposed APIs
  • Get the status of a given item
  • Managing requests on items

Requesting API design

Background

As part of the work to add requesting, we need to add new some new APIs. In particular, these APIs should allow a user to:

  • Get the status of a given item (e.g. available, on hold)

  • Request an item

  • See a list of their current requests

Relinquishing a request is out of scope for the initial API. There's currently no automated process to do this, and we'd need to coordinate with LE&E to define such a process.

This RFC describes how these APIs will work, and provides examples of requests and responses.

It does not suggest implementation details – those can be discussed separately.

Guiding principles

  1. We should not assume requests are sent to a particular service.

    Although the initial implementation will be making requests for items in Sierra, we may add support for requesting from other systems in a future update. We should not assume the use of Sierra.

  2. We should use platform identifiers throughout.

    We may include source identifiers, but interactions with these APIs should start with platform identifiers (e.g. a222wwjt). This is a consequence of principle (1).

Proposed APIs

Get the status of a given item

We will add a new endpoint /catalogue/v2/works/{workId}/items.

  • This will return a modified version of our existing Work model.

    In particular, responses will have only two fields: id and items. The Item model will in turn only have two fields: id and status, the latter of which returns an instance of a new ItemStatus type, e.g.

    "status": {
      "id" : "available",
      "label" : "Available",
      "type": "ItemStatus"
    }
  • This will return an item for every identified item in the corresponding /works request.

    If an item cannot be requested (e.g. it is tracked in Calm, not Sierra), we will return a not-requestable status. This includes items that only have digital locations.

  • We will apply rate limiting to this endpoint, and possibly an API key (tbd).

    Requests to this endpoint will trigger requests to Sierra (and possibly other systems in future). We don't want it to be used to DDOS those systems, so we will use API keys and rate limiting.

    If this API can be called from the browser, we'll proxy requests to the Node server from the browser client, and the server can hold an API key securely.

Example request/response
GET /catalogue/v2/works/a23upgqy/items
{
  "id": "a23upgqy",
  "items": [
    {
      "id": "zv4gvvq8",
      "status": {
        "id" : "available",
        "label" : "Available",
        "type": "ItemStatus"
      },
      "type": "Item"
    },
    {
      "id": "fwsbxqp4",
      "status": {
        "id" : "not-requestable",
        "label" : "Not requestable",
        "type": "ItemStatus"
      },
      "type": "Item"
    }
  ],
  "type": "Work",
  "@context": "https://api.wellcomecollection.org/catalogue/v2/context.json"
}

Managing requests on items

The three operations are as follows:

  • To request an item, a user makes a POST request to this endpoint.

    This POST request will include a body of the following format:

    {
      "userId": "1234567",
      "workId": "a23upgqy",
      "itemId": "fwsbxqp4",
      "type": "ItemRequest"
    }

    This endpoint will return the following status codes:

    • 201 Created if the request is successful (or already exists)

    • 401 Unauthorized if the user is not authenicated

    • 403 Forbidden if the user authenticates successfully, but they are unable to place requests (e.g. at their account limit, banned account)

    • 404 Not Found if the work does not exist, or the work exists but the item is not part of this work

    • 409 Conflict if the work is already requested by another user

  • To retrieve a list of their pending requests, a user makes a GET request to this endpoint.

    This will return a list of ItemRequest objects:

    [
      "requests": [
        {
          "workId": "a23upgqy",
          "itemId": "fwsbxqp4",
          "type": "ItemRequest"
        },
        {
          "workId": "a23upgqy",
          "itemId": "fwsbxqp4",
          "type": "ItemRequest"
        }
      ],
      "type": "ItemRequestList"
    ]

Notes:

  • Because these operations modify a user's account, they must be authenticated first.

PreviousMatcher versioningNextTEI Adapter

Last updated 10 months ago

We will add a new endpoint to account.wellcomecollection.org: /users/{userId}/item-requests. This goes alongside other requests on this endpoint, as listed .

in the identity repo