OAI-PMH API (v3)

https://github.com/folio-org/mod-oai-pmh

Table of contents

Set API

API for managing sets and filtering conditions that is used as part of metadata harvesting protocol implementation

Set

CRUD API for managing set items

POST /oai-pmh/set

Creates the set item

POST /oai-pmh/set
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Set DTO Schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": {
      "description": "UUID",
      "$ref": "../common/uuid.json"
    },
    "name": {
      "description": "Corresponding snapshot id, which is the same as jobExecutionId",
      "type": "string"
    },
    "description": {
      "description": "Represents relations with another matched records, necessary for saving the history of applying changes for inventory/holding/etc records",
      "type": "string"
    },
    "setSpec": {
      "description": "Generation from the last record with the same matchedId incremented by 1. Starts from 0.",
      "type": "string"
    },
    "filteringConditions" : {
      "description": "list of filtering conditions",
      "ref": "filteringConditionCollection.json"
    },
    "createdDate": {
      "description": "Date and time when the record was created",
      "type": "string",
      "format": "date-time"
    },
    "createdByUserId": {
      "description": "ID of the user who created the record",
      "$ref": "../common/uuid.json"
    },
    "updatedDate": {
      "description": "Date and time when the record was last updated",
      "type": "string",
      "format": "date-time"
    },
    "updatedByUserId": {
      "description": "ID of the user who last updated the record",
      "$ref": "../common/uuid.json"
    }
  },
  "required": [
    "name",
    "setSpec"
  ]
}

Example:

{
  "id" : "88dfac11-1caf-4470-9ad1-d533f6360bdd",
  "name" : "example set",
  "description" : "example description",
  "setSpec" : "EXAMPLE:SET:SPEC"
  "createdDate" : "2020-07-27T11:19:58.293+0000",
  "createdByUserId" : "ba332b37-1e74-4e95-b61f-a220401ef0bb"
  "updatedDate" : "2020-08-02T12:23:57.298+0000",
  "updatedByUserId" : "ba332b37-1e74-4e95-b61f-a220401ef0bb"
}

Response 201

Returns a newly created set item, with server-controlled fields like 'id' populated

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Set DTO Schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": {
      "description": "UUID",
      "$ref": "../common/uuid.json"
    },
    "name": {
      "description": "Corresponding snapshot id, which is the same as jobExecutionId",
      "type": "string"
    },
    "description": {
      "description": "Represents relations with another matched records, necessary for saving the history of applying changes for inventory/holding/etc records",
      "type": "string"
    },
    "setSpec": {
      "description": "Generation from the last record with the same matchedId incremented by 1. Starts from 0.",
      "type": "string"
    },
    "filteringConditions" : {
      "description": "list of filtering conditions",
      "ref": "filteringConditionCollection.json"
    },
    "createdDate": {
      "description": "Date and time when the record was created",
      "type": "string",
      "format": "date-time"
    },
    "createdByUserId": {
      "description": "ID of the user who created the record",
      "$ref": "../common/uuid.json"
    },
    "updatedDate": {
      "description": "Date and time when the record was last updated",
      "type": "string",
      "format": "date-time"
    },
    "updatedByUserId": {
      "description": "ID of the user who last updated the record",
      "$ref": "../common/uuid.json"
    }
  },
  "required": [
    "name",
    "setSpec"
  ]
}

Response 400

Returns a newly created set item, with server-controlled fields like 'id' populated

Body

Media type: text/plain

Type: any

Example:

Set item with specified id already exists

PUT /oai-pmh/set/{id}

Update set item with given {setId}

PUT /oai-pmh/set/{id}
URI Parameters
  • id: required (string)
Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Set DTO Schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": {
      "description": "UUID",
      "$ref": "../common/uuid.json"
    },
    "name": {
      "description": "Corresponding snapshot id, which is the same as jobExecutionId",
      "type": "string"
    },
    "description": {
      "description": "Represents relations with another matched records, necessary for saving the history of applying changes for inventory/holding/etc records",
      "type": "string"
    },
    "setSpec": {
      "description": "Generation from the last record with the same matchedId incremented by 1. Starts from 0.",
      "type": "string"
    },
    "filteringConditions" : {
      "description": "list of filtering conditions",
      "ref": "filteringConditionCollection.json"
    },
    "createdDate": {
      "description": "Date and time when the record was created",
      "type": "string",
      "format": "date-time"
    },
    "createdByUserId": {
      "description": "ID of the user who created the record",
      "$ref": "../common/uuid.json"
    },
    "updatedDate": {
      "description": "Date and time when the record was last updated",
      "type": "string",
      "format": "date-time"
    },
    "updatedByUserId": {
      "description": "ID of the user who last updated the record",
      "$ref": "../common/uuid.json"
    }
  },
  "required": [
    "name",
    "setSpec"
  ]
}

Example:

{
  "id" : "88dfac11-1caf-4470-9ad1-d533f6360bdd",
  "name" : "example set",
  "description" : "example description",
  "setSpec" : "EXAMPLE:SET:SPEC"
  "createdDate" : "2020-07-27T11:19:58.293+0000",
  "createdByUserId" : "ba332b37-1e74-4e95-b61f-a220401ef0bb"
  "updatedDate" : "2020-08-02T12:23:57.298+0000",
  "updatedByUserId" : "ba332b37-1e74-4e95-b61f-a220401ef0bb"
}

Response 204

Item successfully updated

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 update set -- malformed JSON at 13:4"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"set not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "errors": {
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "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/set/{id}

Retrieve set item with given {setId}

GET /oai-pmh/set/{id}
URI Parameters
  • id: required (string)
Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

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": "Set DTO Schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": {
      "description": "UUID",
      "$ref": "../common/uuid.json"
    },
    "name": {
      "description": "Corresponding snapshot id, which is the same as jobExecutionId",
      "type": "string"
    },
    "description": {
      "description": "Represents relations with another matched records, necessary for saving the history of applying changes for inventory/holding/etc records",
      "type": "string"
    },
    "setSpec": {
      "description": "Generation from the last record with the same matchedId incremented by 1. Starts from 0.",
      "type": "string"
    },
    "filteringConditions" : {
      "description": "list of filtering conditions",
      "ref": "filteringConditionCollection.json"
    },
    "createdDate": {
      "description": "Date and time when the record was created",
      "type": "string",
      "format": "date-time"
    },
    "createdByUserId": {
      "description": "ID of the user who created the record",
      "$ref": "../common/uuid.json"
    },
    "updatedDate": {
      "description": "Date and time when the record was last updated",
      "type": "string",
      "format": "date-time"
    },
    "updatedByUserId": {
      "description": "ID of the user who last updated the record",
      "$ref": "../common/uuid.json"
    }
  },
  "required": [
    "name",
    "setSpec"
  ]
}

Example:

{
  "id" : "88dfac11-1caf-4470-9ad1-d533f6360bdd",
  "name" : "example set",
  "description" : "example description",
  "setSpec" : "EXAMPLE:SET:SPEC"
  "createdDate" : "2020-07-27T11:19:58.293+0000",
  "createdByUserId" : "ba332b37-1e74-4e95-b61f-a220401ef0bb"
  "updatedDate" : "2020-08-02T12:23:57.298+0000",
  "updatedByUserId" : "ba332b37-1e74-4e95-b61f-a220401ef0bb"
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"set not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

DELETE /oai-pmh/set/{id}

Delete set item with given {setId}

DELETE /oai-pmh/set/{id}
URI Parameters
  • id: required (string)
Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 204

Item deleted successfully

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 delete set -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"set not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator