Source Record Storage Snapshot API (v2.0)

http://localhost

Table of contents

Source Record Storage Snapshot API

API for managing snapshots

Snapshots

API for managing Snapshots

POST /source-storage/snapshots

Create a new snapshot item.

POST /source-storage/snapshots
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Snapshot Schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "jobExecutionId": {
      "description": "Corresponding jobExecution id",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "uuid.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}$"
    },
    "status": {
      "description": "Current status",
      "type": "string",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "additionalProperties": false,
      "enum": [
        "PARENT",
        "NEW",
        "FILE_UPLOADED",
        "PARSING_IN_PROGRESS",
        "PARSING_FINISHED",
        "PROCESSING_IN_PROGRESS",
        "PROCESSING_FINISHED",
        "COMMIT_IN_PROGRESS",
        "COMMITTED",
        "ERROR",
        "DISCARDED",
        "CANCELLED"
      ]
    },
    "processingStartedDate": {
      "description": "Date and time when parsing of records started, set when status is updated to PARSING_IN_PROGRESS",
      "type": "string",
      "format": "date-time"
    },
    "metadata": {
      "description": "Metadata provided by the server",
      "type": "object",
      "readonly": true,
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "metadata.schema",
      "title": "Metadata Schema",
      "properties": {
        "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 (when available)",
          "type": "string",
          "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
        },
        "createdByUsername": {
          "description": "Username of the user who created the record (when available)",
          "type": "string"
        },
        "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 (when available)",
          "type": "string",
          "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
        },
        "updatedByUsername": {
          "description": "Username of the user who last updated the record (when available)",
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "createdDate"
      ]
    }
  },
  "required": [
    "jobExecutionId",
    "status"
  ]
}

Example:

{
  "jobExecutionId": "67dfac11-1caf-4470-9ad1-d533f6360bdd",
  "status": "NEW"
}

Response 201

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

Headers
  • Location: required (string)

    URI to the created snapshot item

Body

Media type: application/json

Type: any

Example:

{
  "jobExecutionId": "67dfac11-1caf-4470-9ad1-d533f6360bdd",
  "status": "NEW"
}

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

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create snapshots -- 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 /source-storage/snapshots

Retrieve a list of snapshot items.

GET /source-storage/snapshots
Query Parameters
  • status: (string)

    Snapshot status to filter by

    Example:

    NEW
  • orderBy: (array of string)

    Sort Snapshots

    Example:

    [
      "status,ASC",
      "processingStartedDate,DESC"
    ]
  • 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

    Example:

    10

Response 200

Returns a list of snapshot items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Snapshot collection",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "snapshots": {
      "description": "List of snapshots",
      "type": "array",
      "id": "snapshotList",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "Snapshot Schema",
        "additionalProperties": false,
        "properties": {
          "jobExecutionId": {
            "description": "Corresponding jobExecution id",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "uuid.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}$"
          },
          "status": {
            "description": "Current status",
            "type": "string",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "additionalProperties": false,
            "enum": [
              "PARENT",
              "NEW",
              "FILE_UPLOADED",
              "PARSING_IN_PROGRESS",
              "PARSING_FINISHED",
              "PROCESSING_IN_PROGRESS",
              "PROCESSING_FINISHED",
              "COMMIT_IN_PROGRESS",
              "COMMITTED",
              "ERROR",
              "DISCARDED",
              "CANCELLED"
            ]
          },
          "processingStartedDate": {
            "description": "Date and time when parsing of records started, set when status is updated to PARSING_IN_PROGRESS",
            "type": "string",
            "format": "date-time"
          },
          "metadata": {
            "description": "Metadata provided by the server",
            "type": "object",
            "readonly": true,
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "metadata.schema",
            "title": "Metadata Schema",
            "properties": {
              "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 (when available)",
                "type": "string",
                "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
              },
              "createdByUsername": {
                "description": "Username of the user who created the record (when available)",
                "type": "string"
              },
              "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 (when available)",
                "type": "string",
                "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
              },
              "updatedByUsername": {
                "description": "Username of the user who last updated the record (when available)",
                "type": "string"
              }
            },
            "additionalProperties": false,
            "required": [
              "createdDate"
            ]
          }
        },
        "required": [
          "jobExecutionId",
          "status"
        ]
      }
    },
    "totalRecords": {
      "description": "Total number of snapshots",
      "type": "integer"
    }
  },
  "excludedFromEqualsAndHashCode": [
    "totalRecords"
  ],
  "required": [
    "snapshots",
    "totalRecords"
  ]
}

Example:

{
  "snapshots": [
    {
      "jobExecutionId": "67dfac11-1caf-4470-9ad1-d533f6360bdd",
      "status": "NEW"
    },
    {
      "jobExecutionId": "17dfac11-1caf-4470-9ad1-d533f6360bdd",
      "status": "PARSING_IN_PROGRESS"
    },
    {
      "jobExecutionId": "27dfac11-1caf-4470-9ad1-d533f6360bdd",
      "status": "PARSING_IN_PROGRESS"
    }
  ],
  "totalRecords": 3
}

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 snapshots -- 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 snapshots -- 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 /source-storage/snapshots/{jobExecutionId}

Update snapshot item with given {snapshotId}

PUT /source-storage/snapshots/{jobExecutionId}
URI Parameters
  • jobExecutionId: required (string)
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Snapshot Schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "jobExecutionId": {
      "description": "Corresponding jobExecution id",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "uuid.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}$"
    },
    "status": {
      "description": "Current status",
      "type": "string",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "additionalProperties": false,
      "enum": [
        "PARENT",
        "NEW",
        "FILE_UPLOADED",
        "PARSING_IN_PROGRESS",
        "PARSING_FINISHED",
        "PROCESSING_IN_PROGRESS",
        "PROCESSING_FINISHED",
        "COMMIT_IN_PROGRESS",
        "COMMITTED",
        "ERROR",
        "DISCARDED",
        "CANCELLED"
      ]
    },
    "processingStartedDate": {
      "description": "Date and time when parsing of records started, set when status is updated to PARSING_IN_PROGRESS",
      "type": "string",
      "format": "date-time"
    },
    "metadata": {
      "description": "Metadata provided by the server",
      "type": "object",
      "readonly": true,
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "metadata.schema",
      "title": "Metadata Schema",
      "properties": {
        "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 (when available)",
          "type": "string",
          "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
        },
        "createdByUsername": {
          "description": "Username of the user who created the record (when available)",
          "type": "string"
        },
        "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 (when available)",
          "type": "string",
          "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
        },
        "updatedByUsername": {
          "description": "Username of the user who last updated the record (when available)",
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "createdDate"
      ]
    }
  },
  "required": [
    "jobExecutionId",
    "status"
  ]
}

Example:

{
  "jobExecutionId": "67dfac11-1caf-4470-9ad1-d533f6360bdd",
  "status": "NEW"
}

Response 200

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Snapshot Schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "jobExecutionId": {
      "description": "Corresponding jobExecution id",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "uuid.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}$"
    },
    "status": {
      "description": "Current status",
      "type": "string",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "additionalProperties": false,
      "enum": [
        "PARENT",
        "NEW",
        "FILE_UPLOADED",
        "PARSING_IN_PROGRESS",
        "PARSING_FINISHED",
        "PROCESSING_IN_PROGRESS",
        "PROCESSING_FINISHED",
        "COMMIT_IN_PROGRESS",
        "COMMITTED",
        "ERROR",
        "DISCARDED",
        "CANCELLED"
      ]
    },
    "processingStartedDate": {
      "description": "Date and time when parsing of records started, set when status is updated to PARSING_IN_PROGRESS",
      "type": "string",
      "format": "date-time"
    },
    "metadata": {
      "description": "Metadata provided by the server",
      "type": "object",
      "readonly": true,
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "metadata.schema",
      "title": "Metadata Schema",
      "properties": {
        "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 (when available)",
          "type": "string",
          "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
        },
        "createdByUsername": {
          "description": "Username of the user who created the record (when available)",
          "type": "string"
        },
        "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 (when available)",
          "type": "string",
          "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
        },
        "updatedByUsername": {
          "description": "Username of the user who last updated the record (when available)",
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "createdDate"
      ]
    }
  },
  "required": [
    "jobExecutionId",
    "status"
  ]
}

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

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"snapshot 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

DELETE /source-storage/snapshots/{jobExecutionId}

Deletes snapshot and all related records

DELETE /source-storage/snapshots/{jobExecutionId}
URI Parameters
  • jobExecutionId: 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 snapshot -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"snapshot 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

GET /source-storage/snapshots/{jobExecutionId}

Retrieve snapshot item with given {snapshotId}

GET /source-storage/snapshots/{jobExecutionId}
URI Parameters
  • jobExecutionId: 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": "Snapshot Schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "jobExecutionId": {
      "description": "Corresponding jobExecution id",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "uuid.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}$"
    },
    "status": {
      "description": "Current status",
      "type": "string",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "additionalProperties": false,
      "enum": [
        "PARENT",
        "NEW",
        "FILE_UPLOADED",
        "PARSING_IN_PROGRESS",
        "PARSING_FINISHED",
        "PROCESSING_IN_PROGRESS",
        "PROCESSING_FINISHED",
        "COMMIT_IN_PROGRESS",
        "COMMITTED",
        "ERROR",
        "DISCARDED",
        "CANCELLED"
      ]
    },
    "processingStartedDate": {
      "description": "Date and time when parsing of records started, set when status is updated to PARSING_IN_PROGRESS",
      "type": "string",
      "format": "date-time"
    },
    "metadata": {
      "description": "Metadata provided by the server",
      "type": "object",
      "readonly": true,
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "metadata.schema",
      "title": "Metadata Schema",
      "properties": {
        "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 (when available)",
          "type": "string",
          "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
        },
        "createdByUsername": {
          "description": "Username of the user who created the record (when available)",
          "type": "string"
        },
        "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 (when available)",
          "type": "string",
          "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
        },
        "updatedByUsername": {
          "description": "Username of the user who last updated the record (when available)",
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "createdDate"
      ]
    }
  },
  "required": [
    "jobExecutionId",
    "status"
  ]
}

Example:

{
  "jobExecutionId": "67dfac11-1caf-4470-9ad1-d533f6360bdd",
  "status": "NEW"
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"snapshot 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