OAI-PMH API (v3.1)

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

Sets

CRUD API for managing set items

POST /oai-pmh/sets

Create a new set item.

POST /oai-pmh/sets
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Set DTO Schema",
  "type": "object",
  "additionalProperties": false,
  "javaType": "org.folio.rest.jaxrs.model.FolioSet",
  "properties": {
    "id": {
      "description": "UUID",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    },
    "name": {
      "description": "set name",
      "type": "string"
    },
    "description": {
      "description": "set description",
      "type": "string"
    },
    "setSpec": {
      "description": "set 'set spec' value based on included filtering-conditions",
      "type": "string"
    },
    "filteringConditions": {
      "description": "list of filtering conditions",
      "type": "array",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "Filtering condition DTO Schema",
        "additionalProperties": false,
        "properties": {
          "name": {
            "description": "Filtering condition name",
            "type": "string"
          },
          "value": {
            "description": "Filtering condition value",
            "type": "string"
          },
          "setSpec": {
            "description": "Set of spec",
            "type": "string"
          }
        },
        "required": [
          "name",
          "value",
          "setSpec"
        ]
      },
      "ref": "filteringConditionCollection.json"
    },
    "createdDate": {
      "description": "Date and time when the set was created",
      "type": "string",
      "format": "date-time"
    },
    "createdByUserId": {
      "description": "ID of the user who set the record",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    },
    "updatedDate": {
      "description": "Date and time when the set was last updated",
      "type": "string",
      "format": "date-time"
    },
    "updatedByUserId": {
      "description": "ID of the user who last updated the set",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    }
  },
  "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 item, with server-controlled fields like 'id' populated

Headers
  • Location: required (string)

    URI to the created set item

Body

Media type: application/json

Type: any

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 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 add set -- malformed JSON at 13:3"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create sets -- unauthorized

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/sets

Retrieve a list of set items.

GET /oai-pmh/sets
Query Parameters
  • totalRecords: (string - default: auto - pattern: exact|estimated|none|auto)

    How to calculate the totalRecords property. "exact" for the correct number, "estimated" for an estimation, "auto" to automatically select "exact" or "estimated", "none" for suppressing the totalRecords property. For details see https://github.com/folio-org/raml-module-builder#estimated-totalrecords

    Example:

    none
  • offset: (integer - default: 0 - minimum: 0 - maximum: 2147483647)

    Skip over a number of elements by specifying an offset value for the query

    Example:

    0
  • limit: (integer - default: 10 - minimum: 0 - maximum: 2147483647)

    Limit the number of elements returned in the response. Using limit=0 will return totalRecords with the exact value. For details about totalRecords see https://github.com/folio-org/raml-module-builder#estimated-totalrecords

    Example:

    10

Response 200

Returns a list of set items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Filtering condition DTO Schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "sets": {
      "description": "list of folio sets",
      "type": "array",
      "id": "folioSetList",
      "items": {
        "javaType": "org.folio.rest.jaxrs.model.FolioSet",
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "Set DTO Schema",
        "additionalProperties": false,
        "properties": {
          "id": {
            "description": "UUID",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "type": "string",
            "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
          },
          "name": {
            "description": "set name",
            "type": "string"
          },
          "description": {
            "description": "set description",
            "type": "string"
          },
          "setSpec": {
            "description": "set 'set spec' value based on included filtering-conditions",
            "type": "string"
          },
          "filteringConditions": {
            "description": "list of filtering conditions",
            "type": "array",
            "items": {
              "type": "object",
              "$schema": "http://json-schema.org/draft-04/schema#",
              "description": "Filtering condition DTO Schema",
              "additionalProperties": false,
              "properties": {
                "name": {
                  "description": "Filtering condition name",
                  "type": "string"
                },
                "value": {
                  "description": "Filtering condition value",
                  "type": "string"
                },
                "setSpec": {
                  "description": "Set of spec",
                  "type": "string"
                }
              },
              "required": [
                "name",
                "value",
                "setSpec"
              ]
            },
            "ref": "filteringConditionCollection.json"
          },
          "createdDate": {
            "description": "Date and time when the set was created",
            "type": "string",
            "format": "date-time"
          },
          "createdByUserId": {
            "description": "ID of the user who set the record",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "type": "string",
            "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
          },
          "updatedDate": {
            "description": "Date and time when the set was last updated",
            "type": "string",
            "format": "date-time"
          },
          "updatedByUserId": {
            "description": "ID of the user who last updated the set",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "type": "string",
            "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
          }
        },
        "required": [
          "name",
          "setSpec"
        ]
      }
    },
    "totalRecords": {
      "type": "integer",
      "description": "Total number of records"
    }
  },
  "required": [
    "precedingSucceedingTitles",
    "totalRecords"
  ]
}

Example:

{
  "sets": [
    {
      "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"
    },
    {
      "id" : "40009db5-d330-46d0-ae0b-a0a08bdffb6d",
      "name" : "example set 2",
      "description" : "example description 2",
      "setSpec" : "EXAMPLE:SET:SPEC:2",
      "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 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 sets -- 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 sets -- unauthorized

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

PUT /oai-pmh/sets/{id}

Update set item with given {setId}

PUT /oai-pmh/sets/{id}
URI Parameters
  • id: required (string)
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Set DTO Schema",
  "type": "object",
  "additionalProperties": false,
  "javaType": "org.folio.rest.jaxrs.model.FolioSet",
  "properties": {
    "id": {
      "description": "UUID",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    },
    "name": {
      "description": "set name",
      "type": "string"
    },
    "description": {
      "description": "set description",
      "type": "string"
    },
    "setSpec": {
      "description": "set 'set spec' value based on included filtering-conditions",
      "type": "string"
    },
    "filteringConditions": {
      "description": "list of filtering conditions",
      "type": "array",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "Filtering condition DTO Schema",
        "additionalProperties": false,
        "properties": {
          "name": {
            "description": "Filtering condition name",
            "type": "string"
          },
          "value": {
            "description": "Filtering condition value",
            "type": "string"
          },
          "setSpec": {
            "description": "Set of spec",
            "type": "string"
          }
        },
        "required": [
          "name",
          "value",
          "setSpec"
        ]
      },
      "ref": "filteringConditionCollection.json"
    },
    "createdDate": {
      "description": "Date and time when the set was created",
      "type": "string",
      "format": "date-time"
    },
    "createdByUserId": {
      "description": "ID of the user who set the record",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    },
    "updatedDate": {
      "description": "Date and time when the set was last updated",
      "type": "string",
      "format": "date-time"
    },
    "updatedByUserId": {
      "description": "ID of the user who last updated the set",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    }
  },
  "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 409

Optimistic locking version conflict

Body

Media type: text/plain

Type: any

Example:

version conflict

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/sets/{id}

Retrieve set item with given {setId}

GET /oai-pmh/sets/{id}
URI Parameters
  • id: required (string)

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,
  "javaType": "org.folio.rest.jaxrs.model.FolioSet",
  "properties": {
    "id": {
      "description": "UUID",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    },
    "name": {
      "description": "set name",
      "type": "string"
    },
    "description": {
      "description": "set description",
      "type": "string"
    },
    "setSpec": {
      "description": "set 'set spec' value based on included filtering-conditions",
      "type": "string"
    },
    "filteringConditions": {
      "description": "list of filtering conditions",
      "type": "array",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "Filtering condition DTO Schema",
        "additionalProperties": false,
        "properties": {
          "name": {
            "description": "Filtering condition name",
            "type": "string"
          },
          "value": {
            "description": "Filtering condition value",
            "type": "string"
          },
          "setSpec": {
            "description": "Set of spec",
            "type": "string"
          }
        },
        "required": [
          "name",
          "value",
          "setSpec"
        ]
      },
      "ref": "filteringConditionCollection.json"
    },
    "createdDate": {
      "description": "Date and time when the set was created",
      "type": "string",
      "format": "date-time"
    },
    "createdByUserId": {
      "description": "ID of the user who set the record",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    },
    "updatedDate": {
      "description": "Date and time when the set was last updated",
      "type": "string",
      "format": "date-time"
    },
    "updatedByUserId": {
      "description": "ID of the user who last updated the set",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    }
  },
  "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/sets/{id}

Delete set item with given {setId}

DELETE /oai-pmh/sets/{id}
URI Parameters
  • id: required (string)

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