foliolib.folio.api.sourceRecordStorage.SourceRecordStorageSnapshots

class foliolib.folio.api.sourceRecordStorage.SourceRecordStorageSnapshots(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)

Bases: foliolib.folio.FolioApi

Source Record Storage Snapshot API

API for managing snapshots

Parameters
  • tenant (str) – Tenant id

  • okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.

Methods

delete_snapshot(jobExecutionId)

Deletes snapshot and all related records

get_snapshot(jobExecutionId)

Retrieve snapshot item with given {snapshotId}

get_snapshots(**kwargs)

Retrieve a list of snapshot items.

modify_snapshot(jobExecutionId, snapshot)

Update snapshot item with given {snapshotId}

set_snapshot(snapshot)

Create a new snapshot item.

delete_snapshot(jobExecutionId: str)

Deletes snapshot and all related records

DELETE /source-storage/snapshots/{jobExecutionId}

Parameters

jobExecutionId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

get_snapshot(jobExecutionId: str)

Retrieve snapshot item with given {snapshotId}

GET /source-storage/snapshots/{jobExecutionId}

Parameters

jobExecutionId (str) –

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Snapshot Schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "jobExecutionId": {
      "description": "Corresponding jobExecution id",
      "$ref": "../../raml-util/schemas/uuid.schema"
    },
    "status": {
      "description": "Current status",
      "type": "string",
      "$ref": "../common/status.json"
    },
    "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",
      "$ref": "../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "jobExecutionId",
    "status"
  ]
}
get_snapshots(**kwargs)

Retrieve a list of snapshot items.

GET /source-storage/snapshots

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments
  • totalRecords (str) –

    (default=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 (int) –

    (default=0) Skip over a number of elements by specifying an offset value for the query

    Example

    • 0

  • limit (int) –

    (default=10) Limit the number of elements returned in the response

    Example

    • 10

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$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",
        "$ref": "snapshot.json"
      }
    },
    "totalRecords": {
      "description": "Total number of snapshots",
      "type": "integer"
    }
  },
  "excludedFromEqualsAndHashCode": [
    "totalRecords"
  ],
  "required": [
    "snapshots",
    "totalRecords"
  ]
}
modify_snapshot(jobExecutionId: str, snapshot: dict)

Update snapshot item with given {snapshotId}

PUT /source-storage/snapshots/{jobExecutionId}

Parameters
  • jobExecutionId (str) –

  • snapshot (dict) – See Schema below

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiRequestConflict – Conflict

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Snapshot Schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "jobExecutionId": {
      "description": "Corresponding jobExecution id",
      "$ref": "../../raml-util/schemas/uuid.schema"
    },
    "status": {
      "description": "Current status",
      "type": "string",
      "$ref": "../common/status.json"
    },
    "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",
      "$ref": "../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "jobExecutionId",
    "status"
  ]
}
set_snapshot(snapshot: dict)

Create a new snapshot item.

POST /source-storage/snapshots

Parameters

snapshot (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Headers

  • Location - URI to the created snapshot item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Snapshot Schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "jobExecutionId": {
      "description": "Corresponding jobExecution id",
      "$ref": "../../raml-util/schemas/uuid.schema"
    },
    "status": {
      "description": "Current status",
      "type": "string",
      "$ref": "../common/status.json"
    },
    "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",
      "$ref": "../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "jobExecutionId",
    "status"
  ]
}