Inventory Storage OAI-PMH view API (v1.1)

http://github.com/org/folio/mod-inventory-storage

Table of contents

OAI-PMH view API

This documents the streaming API for the data needed for OAI-PMH

/oai-pmh-view

GET /oai-pmh-view/instances

Stream data for oai-pmh

GET /oai-pmh-view/instances
Query Parameters
  • startDate: (string)

    Lower bound for filtering instances by instances, items and holdings metadata update date. Accepted format YYYY-MM-DD or YYYY-MM-DDThh:mm:ssZ

  • endDate: (string)

    Upper bound for filtering instances by instances, items and holdings metadata update date

  • deletedRecordSupport: (boolean - default: true)

    Returns deleted records

  • skipSuppressedFromDiscoveryRecords: (boolean - default: true)

    Configuration param which defines if discovery suppressed instance records should be skipped or not

Response 200

Returns item with a given ID

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Response schema for oai-pmh view",
  "type": "object",
  "properties": {
    "instance": {
      "description": "OAI-PMH instances",
      "type": "array",
      "items": {
        "lastUpdatedDate": {
          "description": "The last updated date or deleted date of an instance or it's items and holdings",
          "format": "date-time"
        },
        "deleted": {
          "description": "Indicates if an instance was deleted in inventory",
          "type": "boolean"
        },
        "itemAndHoldingFields": {
          "description": "Aggregated item and holding fields",
          "type": "array",
          "items": {
            "type": "object",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "description": "Oai pmh view response schema",
            "properties": {
              "items": {
                "type": "array",
                "description": "item fields",
                "items": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "description": "itemId",
                        "type": "string"
                      },
                      "volume": {
                        "description": "Item volume",
                        "type": "string"
                      },
                      "location": {
                        "description": "Item effective location",
                        "type": "object",
                        "properties": {
                          "location": {
                            "type": "object",
                            "description": "location",
                            "properties": {
                              "campusId": {
                                "description": "campus Id",
                                "type": "string"
                              },
                              "libraryId": {
                                "description": "library Id",
                                "type": "string"
                              },
                              "campusName": {
                                "description": "campus name",
                                "type": "string"
                              },
                              "libraryName": {
                                "description": "library name",
                                "type": "string"
                              },
                              "institutionId": {
                                "description": "institution id",
                                "type": "string"
                              },
                              "institutionName": {
                                "description": "institution name",
                                "type": "string"
                              }
                            },
                            "required": [
                              "campusId",
                              "libraryId",
                              "campusName",
                              "libraryName",
                              "institutionId",
                              "institutionName"
                            ]
                          }
                        },
                        "required": [
                          "location"
                        ]
                      },
                      "callNumber": {
                        "description": "Item call number components",
                        "type": "object",
                        "properties": {
                          "prefix": {
                            "description": "prefix",
                            "type": "string"
                          },
                          "suffix": {
                            "description": "suffix",
                            "type": "string"
                          },
                          "typeId": {
                            "description": "type id",
                            "type": "string"
                          },
                          "callNumber": {
                            "description": "item call number",
                            "type": "string"
                          }
                        },
                        "required": [
                          "prefix",
                          "suffix",
                          "typeId",
                          "callNumber"
                        ]
                      },
                      "enumeration": {
                        "description": "item enumeration",
                        "type": "string"
                      },
                      "materialType": {
                        "description": "item material type name",
                        "type": "string"
                      },
                      "electronicAccess": {
                        "description": "Aggregated electronic access from items and holdings",
                        "type": "array",
                        "items": [
                          {
                            "type": "object",
                            "properties": {
                              "uri": {
                                "description": "electronic access URI",
                                "type": "string"
                              },
                              "name": {
                                "description": "electronic access name",
                                "type": "string"
                              },
                              "linkText": {
                                "description": "electronic access link text",
                                "type": "string"
                              },
                              "publicNote": {
                                "description": "electronic access public note",
                                "type": "string"
                              },
                              "relationshipId": {
                                "description": "electronic access relationship id",
                                "type": "string"
                              },
                              "materialsSpecification": {
                                "description": "electronic access materials specification",
                                "type": "string"
                              }
                            },
                            "required": [
                              "uri",
                              "name",
                              "linkText",
                              "publicNote",
                              "relationshipId",
                              "materialsSpecification"
                            ]
                          }
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "volume",
                      "location",
                      "callNumber",
                      "enumeration",
                      "materialType",
                      "electronicAccess"
                    ]
                  }
                ]
              },
              "instanceid": {
                "description": "Folio instance identifier",
                "type": "string"
              }
            },
            "required": [
              "items",
              "instanceid"
            ],
            "additionalProperties": false
          }
        }
      }
    }
  },
  "additionalProperties": false
}

Example:

{
  "lastUpdatedDate": "2020-11-26",
  "deleted": false,
  "items": [
    {
      "id": "7212ba6a-8dcf-45a1-be9a-ffaa847c4423",
      "volume": null,
      "location": {
        "location": {
          "campusId": "62cf76b7-cca5-4d33-9217-edf42ce1a848",
          "libraryId": "5d78803e-ca04-4b4a-aeae-2c63b924518b",
          "campusName": "City Campus",
          "libraryName": "Datalogisk Institut",
          "institutionId": "40ee00ca-a518-4b49-be01-0638d0a4ac57",
          "institutionName": "Københavns Universitet"
        }
      },
      "callNumber": {
        "prefix": null,
        "suffix": null,
        "typeId": "512173a7-bd09-490e-b773-17d83f2b63fe",
        "callNumber": "TK5105.88815 . A58 2004 FT MEADE"
      },
      "enumeration": "",
      "materialType": "book",
      "electronicAccess": [
        {
          "uri": "http://www.loc.gov/catdir/toc/ecip0718/2007020429.html",
          "name": "Version of resource",
          "linkText": "Links available",
          "publicNote": "Table of contents only",
          "relationshipId": "3b430592-2e09-4b48-9a0c-0636d66b9fb3",
          "materialsSpecification": "Table of contents"
        }
      ]
    },
    {
      "id": "100d10bf-2f06-4aa0-be15-0b95b2d9f9e3",
      "volume": null,
      "location": {
        "location": {
          "campusId": "62cf76b7-cca5-4d33-9217-edf42ce1a848",
          "libraryId": "5d78803e-ca04-4b4a-aeae-2c63b924518b",
          "campusName": "City Campus",
          "libraryName": "Datalogisk Institut",
          "institutionId": "40ee00ca-a518-4b49-be01-0638d0a4ac57",
          "institutionName": "Københavns Universitet"
        }
      },
      "callNumber": {
        "prefix": null,
        "suffix": null,
        "typeId": "512173a7-bd09-490e-b773-17d83f2b63fe",
        "callNumber": "TK5105.88815 . A58 2004 FT MEADE"
      },
      "enumeration": "",
      "materialType": "book",
      "electronicAccess": [
        {
          "uri": "http://www.loc.gov/catdir/toc/ecip0718/2007020429.html",
          "name": "Version of resource",
          "linkText": "Links available",
          "publicNote": "Table of contents only",
          "relationshipId": "3b430592-2e09-4b48-9a0c-0636d66b9fb3",
          "materialsSpecification": "Table of contents"
        }
      ]
    }
  ],
  "instanceid": "5bf370e0-8cca-4d9c-82e4-5170ab2a0a39"
}

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

"unable to list instances -- malformed parameter 'query', syntax error at column 6"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

"unable to list instances -- unauthorized"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"instance not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "errors.schema",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "id": "error.schema",
        "description": "An error",
        "properties": {
          "message": {
            "type": "string",
            "description": "Error message text"
          },
          "type": {
            "type": "string",
            "description": "Error message type"
          },
          "code": {
            "type": "string",
            "description": "Error message code"
          },
          "parameters": {
            "description": "Error message parameters",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "parameters.schema",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              }
            }
          }
        },
        "required": [
          "message"
        ]
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

GET /oai-pmh-view/updatedInstanceIds

Stream updated instances ids for oai-pmh

GET /oai-pmh-view/updatedInstanceIds
Query Parameters
  • startDate: (string)

    Lower bound for filtering instances by instances, items and holdings metadata update date

  • endDate: (string)

    Upper bound for filtering instances by instances, items and holdings metadata update date

  • deletedRecordSupport: (boolean - default: true)

    return deleted records

  • skipSuppressedFromDiscoveryRecords: (boolean - default: true)

    Configuration param which defines if discovery suppressed instance records should be skipped or not

Response 200

Returns item with a given ID

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Response schema for oai-pmh updated instances ids view",
  "type": "object",
  "properties": {
    "instanceId": {
      "description": "OAI-PMH updated instances ids",
      "type": "string",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
    },
    "updatedDate": {
      "description": "The last updated date or deleted date of an instance or it's items and holdings",
      "type": "string",
      "format": "date-time"
    },
    "suppressFromDiscovery": {
      "description": "Indicates if instance is suppressed from discovery",
      "type": "boolean"
    },
    "deleted": {
      "description": "Indicates if an instance was deleted in inventory",
      "type": "boolean"
    }
  },
  "additionalProperties": false
}

Example:

{
  "instanceId": "5bf370e0-8cca-4d9c-82e4-5170ab2a0a39",
  "updatedDate": "2020-06-23T12:00:00Z",
  "suppressFromDiscovery": false,
  "deleted": false
}

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

"unable to list updatedInstanceIds -- malformed parameter 'query', syntax error at column 6"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

"unable to list updatedInstanceIds -- unauthorized"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"updatedInstanceId not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "errors.schema",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "id": "error.schema",
        "description": "An error",
        "properties": {
          "message": {
            "type": "string",
            "description": "Error message text"
          },
          "type": {
            "type": "string",
            "description": "Error message type"
          },
          "code": {
            "type": "string",
            "description": "Error message code"
          },
          "parameters": {
            "description": "Error message parameters",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "parameters.schema",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              }
            }
          }
        },
        "required": [
          "message"
        ]
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

POST /oai-pmh-view/enrichedInstances

Stream instances view data for oai-pmh

POST /oai-pmh-view/enrichedInstances
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Define format of request data with instances ids",
  "type": "object",
  "properties": {
    "instanceIds": {
      "description": "OAI-PMH instances identifiers",
      "type": "array",
      "items": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "A universally unique identifier (UUID), this is a 128-bit number used to identify a record and is shown in hex with dashes, for example 6312d172-f0cf-40f6-b27d-9fa8feaf332f; the UUID version must be from 1-5; see https://dev.folio.org/guides/uuids/",
        "type": "string",
        "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
      }
    },
    "skipSuppressedFromDiscoveryRecords": {
      "description": "Configuration param which defines if discovery suppressed items and holdings records should be skipped or not",
      "type": "boolean"
    }
  },
  "required": [
    "instanceIds",
    "skipSuppressedFromDiscoveryRecords"
  ],
  "additionalProperties": false
}

Example:

{
  "instanceIds": [
    "5bf370e0-8cca-4d9c-82e4-5170ab2a0a39",
    "7212ba6a-8dcf-45a1-be9a-ffaa847c4423",
    "100d10bf-2f06-4aa0-be15-0b95b2d9f9e3",
    "0aaef1ea-69eb-4f6e-a077-cea159317ce3",
    "1b74ab75-9f41-4837-8662-a1d99118008d"
  ],
  "skipSuppressedFromDiscoveryRecords": false
}

Response 200

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Response schema for oai-pmh enriched instances view",
  "type": "object",
  "properties": {
    "instanceId": {
      "description": "OAI-PMH enriched instance id",
      "type": "string",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
    },
    "itemsAndHoldingsFields": {
      "description": "Aggregated item and holding fields",
      "type": "object",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "properties": {
        "items": {
          "type": "array",
          "description": "item fields",
          "items": [
            {
              "type": "object",
              "properties": {
                "id": {
                  "description": "itemId",
                  "type": "string"
                },
                "volume": {
                  "description": "Item volume",
                  "type": "string"
                },
                "location": {
                  "description": "Item effective location",
                  "type": "object",
                  "properties": {
                    "location": {
                      "type": "object",
                      "description": "location",
                      "properties": {
                        "campusId": {
                          "description": "campus Id",
                          "type": "string"
                        },
                        "libraryId": {
                          "description": "library Id",
                          "type": "string"
                        },
                        "campusName": {
                          "description": "campus name",
                          "type": "string"
                        },
                        "libraryName": {
                          "description": "library name",
                          "type": "string"
                        },
                        "institutionId": {
                          "description": "institution id",
                          "type": "string"
                        },
                        "institutionName": {
                          "description": "institution name",
                          "type": "string"
                        }
                      },
                      "required": [
                        "campusId",
                        "libraryId",
                        "campusName",
                        "libraryName",
                        "institutionId",
                        "institutionName"
                      ]
                    }
                  },
                  "required": [
                    "location"
                  ]
                },
                "callNumber": {
                  "description": "Item call number components",
                  "type": "object",
                  "properties": {
                    "prefix": {
                      "description": "prefix",
                      "type": "string"
                    },
                    "suffix": {
                      "description": "suffix",
                      "type": "string"
                    },
                    "typeId": {
                      "description": "type id",
                      "type": "string"
                    },
                    "callNumber": {
                      "description": "item call number",
                      "type": "string"
                    }
                  },
                  "required": [
                    "prefix",
                    "suffix",
                    "typeId",
                    "callNumber"
                  ]
                },
                "enumeration": {
                  "description": "item enumeration",
                  "type": "string"
                },
                "materialType": {
                  "description": "item material type name",
                  "type": "string"
                },
                "electronicAccess": {
                  "description": "Aggregated electronic access from items and holdings",
                  "type": "array",
                  "items": [
                    {
                      "type": "object",
                      "properties": {
                        "uri": {
                          "description": "electronic access URI",
                          "type": "string"
                        },
                        "name": {
                          "description": "electronic access name",
                          "type": "string"
                        },
                        "linkText": {
                          "description": "electronic access link text",
                          "type": "string"
                        },
                        "publicNote": {
                          "description": "electronic access public note",
                          "type": "string"
                        },
                        "relationshipId": {
                          "description": "electronic access relationship id",
                          "type": "string"
                        },
                        "materialsSpecification": {
                          "description": "electronic access materials specification",
                          "type": "string"
                        }
                      },
                      "required": [
                        "uri",
                        "name",
                        "linkText",
                        "publicNote",
                        "relationshipId",
                        "materialsSpecification"
                      ]
                    }
                  ]
                }
              },
              "required": [
                "id",
                "volume",
                "location",
                "callNumber",
                "enumeration",
                "materialType",
                "electronicAccess"
              ]
            }
          ]
        },
        "instanceid": {
          "description": "Folio instance identifier",
          "type": "string"
        }
      },
      "required": [
        "items",
        "instanceid"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "instanceId",
    "itemsAndHoldingsFields"
  ],
  "additionalProperties": false
}

Example:

{
  "instanceId": "1b74ab75-9f41-4837-8662-a1d99118008d",
  "itemsAndHoldingsFields": {
    "items": [
      {
        "id": "0aaef1ea-69eb-4f6e-a077-cea159317ce3",
        "volume": "volume",
        "location": {
          "location": {
            "campusId": "470ff1dd-937a-4195-bf9e-06bcfcd135df",
            "libraryId": "c2549bb4-19c7-4fcc-8b52-39e612fb7dbe",
            "campusName": "Online",
            "libraryName": "Online",
            "institutionId": "40ee00ca-a518-4b49-be01-0638d0a4ac57",
            "institutionName": "Københavns Universitet"
          }
        },
        "callNumber": {
          "prefix": "prefix",
          "suffix": "suffix",
          "typeId": "512173a7-bd09-490e-b773-17d83f2b63fe",
          "callNumber": "TK5105.88815 . A58 2004 FT MEADE"
        },
        "enumeration": "enum",
        "materialType": "sound recording",
        "electronicAccess": [
          {
            "uri": "holding uri",
            "name": "No information provided",
            "linkText": "holding link text",
            "publicNote": "holding public note",
            "relationshipId": "f50c90c9-bae0-4add-9cd0-db9092dbc9dd",
            "materialsSpecification": "holding mats"
          },
          {
            "uri": "item uri",
            "name": "Related resource",
            "linkText": "item link text",
            "publicNote": "item public note",
            "relationshipId": "5bfe1b7b-f151-4501-8cfa-23b321d5cd1e",
            "materialsSpecification": "item mast"
          }
        ]
      }
    ],
    "instanceid": "1b74ab75-9f41-4837-8662-a1d99118008d"
  }
}

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "errors.schema",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "id": "error.schema",
        "description": "An error",
        "properties": {
          "message": {
            "type": "string",
            "description": "Error message text"
          },
          "type": {
            "type": "string",
            "description": "Error message type"
          },
          "code": {
            "type": "string",
            "description": "Error message code"
          },
          "parameters": {
            "description": "Error message parameters",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "parameters.schema",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              }
            }
          }
        },
        "required": [
          "message"
        ]
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}