Source Record Storage Batch API (v0.1)

http://localhost

Table of contents

Source Record Storage Batch API

Batch API for managing records

/source-storage/batch

POST /source-storage/batch/records

Creates records from a record collection. It returns both saved records and error messages for records that were not saved.

POST /source-storage/batch/records
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Collection of record DTO",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "records": {
      "description": "List of records",
      "type": "array",
      "id": "recordList",
      "items": {
        "type": "object",
        "$ref": "record.json"
      }
    },
    "totalRecords": {
      "description": "Total number of records",
      "type": "integer"
    }
  },
  "excludedFromEqualsAndHashCode": [
    "totalRecords"
  ],
  "required": [
    "records",
    "totalRecords"
  ]
}

Response 201

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Response schema for Records batch requests",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "records": {
      "description": "List of successfully processed records",
      "type": "array",
      "id": "recordList",
      "items": {
        "type": "object",
        "$ref": "record.json"
      }
    },
    "errorMessages": {
      "description": "List of error messages",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "totalRecords": {
      "description": "Total number of records",
      "type": "integer"
    }
  },
  "excludedFromEqualsAndHashCode": [
    "totalRecords"
  ],
  "required": [
    "records",
    "totalRecords"
  ]
}

Response 400

Bad request

Body

Media type: text/plain

Type: any

Example:

Bad request

Response 422

Unprocessable Entity

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of 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

Body

Media type: text/plain

Type: any

Example:

Internal server error

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Response schema for Records batch requests",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "records": {
      "description": "List of successfully processed records",
      "type": "array",
      "id": "recordList",
      "items": {
        "type": "object",
        "$ref": "record.json"
      }
    },
    "errorMessages": {
      "description": "List of error messages",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "totalRecords": {
      "description": "Total number of records",
      "type": "integer"
    }
  },
  "excludedFromEqualsAndHashCode": [
    "totalRecords"
  ],
  "required": [
    "records",
    "totalRecords"
  ]
}

PUT /source-storage/batch/parsed-records

Updates parsed records from a collection. It returns both updated records and error messages for records that were not updated.

PUT /source-storage/batch/parsed-records
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Collection of parsed records",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "recordType": {
      "description": "Type of parsed records, e.g. MARC",
      "type": "string",
      "$ref": "recordType.json"
    },
    "parsedRecords": {
      "description": "List of parsed records",
      "type": "array",
      "id": "parsedRecordList",
      "items": {
        "type": "object",
        "$ref": "parsedRecord.json"
      }
    },
    "totalRecords": {
      "description": "Total number of parsed records",
      "type": "integer"
    }
  },
  "excludedFromEqualsAndHashCode": [
    "totalRecords"
  ],
  "required": [
    "recordType",
    "parsedRecords",
    "totalRecords"
  ]
}

Response 200

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Response schema for Parsed Records batch requests",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "parsedRecords": {
      "description": "List of successfully processed parsed records",
      "type": "array",
      "id": "recordList",
      "items": {
        "type": "object",
        "$ref": "../mod-source-record-storage/parsedRecord.json"
      }
    },
    "errorMessages": {
      "description": "List of error messages",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "totalRecords": {
      "description": "Total number of parsed records",
      "type": "integer"
    }
  },
  "excludedFromEqualsAndHashCode": [
    "totalRecords"
  ],
  "required": [
    "parsedRecords",
    "totalRecords"
  ]
}

Response 400

Bad request

Body

Media type: text/plain

Type: any

Example:

Bad request

Response 422

Unprocessable Entity

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of 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

Body

Media type: text/plain

Type: any

Example:

Internal server error

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Response schema for Parsed Records batch requests",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "parsedRecords": {
      "description": "List of successfully processed parsed records",
      "type": "array",
      "id": "recordList",
      "items": {
        "type": "object",
        "$ref": "../mod-source-record-storage/parsedRecord.json"
      }
    },
    "errorMessages": {
      "description": "List of error messages",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "totalRecords": {
      "description": "Total number of parsed records",
      "type": "integer"
    }
  },
  "excludedFromEqualsAndHashCode": [
    "totalRecords"
  ],
  "required": [
    "parsedRecords",
    "totalRecords"
  ]
}