foliolib.folio.api.sharedIndex.Sharedindex

class foliolib.folio.api.sharedIndex.Sharedindex(tenant: str)

Bases: foliolib.folio.FolioApi

Shared Index

Base class of the Folio API

Parameters

tenant (str) – Tenant id

Methods

deleteconfigmatchkey(id_)

Delete match key configuration

deleteglobalrecords()

Delete global records.

deletesource(id_)

Delete source.

getcluster(clusterId)

Get cluster by identifier

getclusters()

Get clusters with matchkeyid.

getconfigmatchkey(id_)

Get match key configuration

getconfigmatchkeys(**kwargs)

Get match key configurations

getglobalrecord(globalId)

Get record with global identifier.

getglobalrecords()

Get records that satisfy CQL query with fields localId, sourceId, globalId.

getsource(id_)

Get source.

getsources(**kwargs)

Get sources.

ingestjobfinish(id_, **kwargs)

Finish ingest job with either rollback of commit.

ingestjobinfo(id_)

Get ingest job information.

ingestjobrecord(ingestRecordChunk, id_)

Put records for job.

initializematchkey(id_)

Recalculate match key across all records.

oaiservice()

OAI service

postconfigmatchkey(matchKey)

Create match key

postingestjob(ingestJobRequest)

Create ingest job

postsource(source)

Create source.

putconfigmatchkey(matchKey, id_)

Update match key configuration.

putglobalrecords(ingestRecordRequest)

Create or update records.

deleteconfigmatchkey(id_)

Delete match key configuration

DELETE /shared-index/config/matchkeys/{id}

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Internal error

deleteglobalrecords()

Delete global records.

DELETE /shared-index/records

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestFatalError – Internal error

deletesource(id_)

Delete source.

DELETE /shared-index/config/sources/{id}

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Internal error

getcluster(clusterId)

Get cluster by identifier

GET /shared-index/clusters/{clusterId}

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "cluster",
    "type": "object",
    "properties": {
        "clusterId": {
            "type": "string",
            "description": "Cluster identifier",
            "format": "uuid"
        },
        "datestamp": {
            "type": "string",
            "description": "date time of modification",
            "format": "date"
        },
        "records": {
            "description": "List of records",
            "type": "array",
            "items": {
                "description": "Global record",
                "type": "object",
                "properties": {
                    "globalId": {
                        "type": "string",
                        "description": "Global identifier",
                        "format": "uuid"
                    },
                    "localId": {
                        "type": "string",
                        "description": "Local identifier"
                    },
                    "sourceId": {
                        "type": "string",
                        "description": "Source identifier",
                        "format": "uuid"
                    },
                    "marcPayload": {
                        "type": "object",
                        "description": "MARC payload in JSON"
                    },
                    "inventoryPayload": {
                        "type": "object",
                        "description": "inventory payload"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "globalId",
                    "localId",
                    "sourceId"
                ]
            }
        },
        "matchKeys": {
            "description": "Match keys values",
            "type": "array",
            "items": {
                "type": "string"
            }
        }
    },
    "additionalProperties": false,
    "required": [
        "clusterId",
        "records"
    ]
}
getclusters()

Get clusters with matchkeyid. CQL query with matchValue, clusterId fields

GET /shared-index/clusters

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "cluster records",
    "type": "object",
    "properties": {
        "items": {
            "description": "List of clusters",
            "type": "array",
            "items": {
                "description": "cluster",
                "type": "object",
                "properties": {
                    "clusterId": {
                        "type": "string",
                        "description": "Cluster identifier",
                        "format": "uuid"
                    },
                    "datestamp": {
                        "type": "string",
                        "description": "date time of modification",
                        "format": "date"
                    },
                    "records": {
                        "description": "List of records",
                        "type": "array",
                        "items": {
                            "description": "Global record",
                            "type": "object",
                            "properties": {
                                "globalId": {
                                    "type": "string",
                                    "description": "Global identifier",
                                    "format": "uuid"
                                },
                                "localId": {
                                    "type": "string",
                                    "description": "Local identifier"
                                },
                                "sourceId": {
                                    "type": "string",
                                    "description": "Source identifier",
                                    "format": "uuid"
                                },
                                "marcPayload": {
                                    "type": "object",
                                    "description": "MARC payload in JSON"
                                },
                                "inventoryPayload": {
                                    "type": "object",
                                    "description": "inventory payload"
                                }
                            },
                            "additionalProperties": false,
                            "required": [
                                "globalId",
                                "localId",
                                "sourceId"
                            ]
                        }
                    },
                    "matchKeys": {
                        "description": "Match keys values",
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "additionalProperties": false,
                "required": [
                    "clusterId",
                    "records"
                ]
            }
        },
        "resultInfo": {
            "description": "Common result set information for streaming response",
            "type": "object",
            "properties": {
                "totalRecords": {
                    "description": "Total number of entries in response",
                    "type": "integer"
                },
                "diagnostics": {
                    "description": "Diagnostics for response",
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "message": {
                                "description": "single diagnostic message",
                                "type": "string"
                            }
                        }
                    }
                },
                "facets": {
                    "type": "array",
                    "description": "Array of facets",
                    "items": {
                        "type": "object",
                        "description": "A facet",
                        "properties": {
                            "facetValues": {
                                "type": "array",
                                "description": "Array of facet values",
                                "items": {
                                    "type": "object",
                                    "description": "A facet value",
                                    "properties": {
                                        "count": {
                                            "type": "integer",
                                            "description": "Count of facet values"
                                        },
                                        "value": {
                                            "description": "Value Object"
                                        }
                                    }
                                }
                            },
                            "type": {
                                "type": "string",
                                "description": "Type of facet"
                            }
                        }
                    }
                }
            },
            "additionalProperties": false
        }
    },
    "additionalProperties": false,
    "required": [
        "items"
    ]
}
getconfigmatchkey(id_)

Get match key configuration

GET /shared-index/config/matchkeys/{id}

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "shared index match key",
    "type": "object",
    "properties": {
        "id": {
            "type": "string",
            "description": "match key identifier"
        },
        "method": {
            "type": "string",
            "description": "method"
        },
        "params": {
            "type": "object",
            "description": "parameter references"
        },
        "update": {
            "type": "string",
            "enum": [
                "ingest",
                "manual"
            ],
            "description": "ingest: update when records are ingested, manual: update only when initialize is called"
        }
    },
    "additionalProperties": false,
    "required": [
        "id",
        "method",
        "params"
    ]
}
getconfigmatchkeys(**kwargs)

Get match key configurations

GET /shared-index/config/matchkeys

Keyword Arguments
  • limit (int) – Limit the number of elements returned in the response (default: 10, minimum: 0)

  • query (str) – CQL query

  • offset (int) – Skip over number of elements (default is first element) (default: 0, minimum: 0)

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "match keys",
    "type": "object",
    "properties": {
        "matchKeys": {
            "description": "List of match keys",
            "type": "array",
            "items": {
                "description": "shared index match key",
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "match key identifier"
                    },
                    "method": {
                        "type": "string",
                        "description": "method"
                    },
                    "params": {
                        "type": "object",
                        "description": "parameter references"
                    },
                    "update": {
                        "type": "string",
                        "enum": [
                            "ingest",
                            "manual"
                        ],
                        "description": "ingest: update when records are ingested, manual: update only when initialize is called"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "id",
                    "method",
                    "params"
                ]
            }
        },
        "resultInfo": {
            "description": "Common result set information for streaming response",
            "type": "object",
            "properties": {
                "totalRecords": {
                    "description": "Total number of entries in response",
                    "type": "integer"
                },
                "diagnostics": {
                    "description": "Diagnostics for response",
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "message": {
                                "description": "single diagnostic message",
                                "type": "string"
                            }
                        }
                    }
                },
                "facets": {
                    "type": "array",
                    "description": "Array of facets",
                    "items": {
                        "type": "object",
                        "description": "A facet",
                        "properties": {
                            "facetValues": {
                                "type": "array",
                                "description": "Array of facet values",
                                "items": {
                                    "type": "object",
                                    "description": "A facet value",
                                    "properties": {
                                        "count": {
                                            "type": "integer",
                                            "description": "Count of facet values"
                                        },
                                        "value": {
                                            "description": "Value Object"
                                        }
                                    }
                                }
                            },
                            "type": {
                                "type": "string",
                                "description": "Type of facet"
                            }
                        }
                    }
                }
            },
            "additionalProperties": false
        }
    },
    "additionalProperties": false,
    "required": [
        "matchKeys"
    ]
}
getglobalrecord(globalId)

Get record with global identifier.

GET /shared-index/records/{globalId}

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "Global record",
    "type": "object",
    "properties": {
        "globalId": {
            "type": "string",
            "description": "Global identifier",
            "format": "uuid"
        },
        "localId": {
            "type": "string",
            "description": "Local identifier"
        },
        "sourceId": {
            "type": "string",
            "description": "Source identifier",
            "format": "uuid"
        },
        "marcPayload": {
            "type": "object",
            "description": "MARC payload in JSON"
        },
        "inventoryPayload": {
            "type": "object",
            "description": "inventory payload"
        }
    },
    "additionalProperties": false,
    "required": [
        "globalId",
        "localId",
        "sourceId"
    ]
}
getglobalrecords()

Get records that satisfy CQL query with fields localId, sourceId, globalId.

GET /shared-index/records

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "Global records",
    "type": "object",
    "properties": {
        "items": {
            "description": "List of records",
            "type": "array",
            "items": {
                "description": "Global record",
                "type": "object",
                "properties": {
                    "globalId": {
                        "type": "string",
                        "description": "Global identifier",
                        "format": "uuid"
                    },
                    "localId": {
                        "type": "string",
                        "description": "Local identifier"
                    },
                    "sourceId": {
                        "type": "string",
                        "description": "Source identifier",
                        "format": "uuid"
                    },
                    "marcPayload": {
                        "type": "object",
                        "description": "MARC payload in JSON"
                    },
                    "inventoryPayload": {
                        "type": "object",
                        "description": "inventory payload"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "globalId",
                    "localId",
                    "sourceId"
                ]
            }
        },
        "resultInfo": {
            "description": "Common result set information for streaming response",
            "type": "object",
            "properties": {
                "totalRecords": {
                    "description": "Total number of entries in response",
                    "type": "integer"
                },
                "diagnostics": {
                    "description": "Diagnostics for response",
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "message": {
                                "description": "single diagnostic message",
                                "type": "string"
                            }
                        }
                    }
                },
                "facets": {
                    "type": "array",
                    "description": "Array of facets",
                    "items": {
                        "type": "object",
                        "description": "A facet",
                        "properties": {
                            "facetValues": {
                                "type": "array",
                                "description": "Array of facet values",
                                "items": {
                                    "type": "object",
                                    "description": "A facet value",
                                    "properties": {
                                        "count": {
                                            "type": "integer",
                                            "description": "Count of facet values"
                                        },
                                        "value": {
                                            "description": "Value Object"
                                        }
                                    }
                                }
                            },
                            "type": {
                                "type": "string",
                                "description": "Type of facet"
                            }
                        }
                    }
                }
            },
            "additionalProperties": false
        }
    },
    "additionalProperties": false,
    "required": [
        "items"
    ]
}
getsource(id_)

Get source.

GET /shared-index/config/sources/{id}

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "shared index match key",
    "type": "object",
    "properties": {
        "id": {
            "type": "string",
            "description": "match key identifier"
        },
        "method": {
            "type": "string",
            "description": "method"
        },
        "params": {
            "type": "object",
            "description": "parameter references"
        },
        "update": {
            "type": "string",
            "enum": [
                "ingest",
                "manual"
            ],
            "description": "ingest: update when records are ingested, manual: update only when initialize is called"
        }
    },
    "additionalProperties": false,
    "required": [
        "id",
        "method",
        "params"
    ]
}
getsources(**kwargs)

Get sources.

GET /shared-index/sources

Keyword Arguments
  • limit (int) – Limit the number of elements returned in the response (default: 10, minimum: 0)

  • query (str) – CQL query

  • offset (int) – Skip over number of elements (default is first element) (default: 0, minimum: 0)

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "Sources",
    "type": "object",
    "properties": {
        "sources": {
            "description": "List of sources",
            "type": "array",
            "items": {
                "description": "Shared Source",
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "source identifier",
                        "format": "uuid"
                    },
                    "name": {
                        "type": "string",
                        "description": "method"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "id"
                ]
            }
        },
        "resultInfo": {
            "description": "Common result set information for streaming response",
            "type": "object",
            "properties": {
                "totalRecords": {
                    "description": "Total number of entries in response",
                    "type": "integer"
                },
                "diagnostics": {
                    "description": "Diagnostics for response",
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "message": {
                                "description": "single diagnostic message",
                                "type": "string"
                            }
                        }
                    }
                },
                "facets": {
                    "type": "array",
                    "description": "Array of facets",
                    "items": {
                        "type": "object",
                        "description": "A facet",
                        "properties": {
                            "facetValues": {
                                "type": "array",
                                "description": "Array of facet values",
                                "items": {
                                    "type": "object",
                                    "description": "A facet value",
                                    "properties": {
                                        "count": {
                                            "type": "integer",
                                            "description": "Count of facet values"
                                        },
                                        "value": {
                                            "description": "Value Object"
                                        }
                                    }
                                }
                            },
                            "type": {
                                "type": "string",
                                "description": "Type of facet"
                            }
                        }
                    }
                }
            },
            "additionalProperties": false
        }
    },
    "additionalProperties": false,
    "required": [
        "sources"
    ]
}
ingestjobfinish(id_, **kwargs)

Finish ingest job with either rollback of commit.

DELETE /shared-index/shared-index/ingest-jobs/{id}

Keyword Arguments

commit (bool) – whether to commit (default: False)

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Internal error

ingestjobinfo(id_)

Get ingest job information.

GET /shared-index/shared-index/ingest-jobs/{id}

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "Ingest job info",
    "type": "object",
    "properties": {
        "autoRollBackTimeout": {
            "type": "integer",
            "description": "Timeout in seconds"
        }
    },
    "additionalProperties": false
}
ingestjobrecord(ingestRecordChunk, id_)

Put records for job.

PUT /shared-index/shared-index/ingest-jobs/{id}

Parameters

ingestRecordChunk (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "Ingest job records chunk",
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "localId": {
                "type": "string",
                "description": "Local identifier"
            },
            "delete": {
                "type": "boolean",
                "description": "If true, record is deleted. Default: false"
            },
            "marcPayload": {
                "type": "object"
            },
            "inventoryPayload": {
                "type": "object"
            }
        },
        "additionalProperties": false,
        "required": [
            "localId"
        ]
    }
}
{
    "description": "Ingest job records response",
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "globalId": {
                "type": "string",
                "description": "Global identifier",
                "format": "uuid"
            },
            "matchKeys": {
                "description": "Match keys for these records. Normally not provided for performance reasons, but client can ask for them",
                "type": "object"
            }
        },
        "additionalProperties": false,
        "required": [
            "globalId"
        ]
    }
}
initializematchkey(id_)

Recalculate match key across all records.

PUT /shared-index/config/matchkeys/{id}/initialize

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "match key statistics",
    "type": "object",
    "properties": {
        "totalRecords": {
            "type": "integer",
            "description": "total records"
        },
        "totalMatchkeysInitialized": {
            "type": "integer",
            "description": "total records initialized"
        },
        "recordsWithMatchkeyEmpty": {
            "type": "integer",
            "description": "number of records with empty match key"
        },
        "matchkeySingletons": {
            "type": "integer",
            "description": "number of records matching no other"
        }
    },
    "additionalProperties": true,
    "required": [
        "totalRecords"
    ]
}
oaiservice()

OAI service

GET /shared-index/oai

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestFatalError – Internal error

Schema

{
    "type": "string"
}
postconfigmatchkey(matchKey)

Create match key

POST /shared-index/config/matchkeys

Parameters

matchKey (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "shared index match key",
    "type": "object",
    "properties": {
        "id": {
            "type": "string",
            "description": "match key identifier"
        },
        "method": {
            "type": "string",
            "description": "method"
        },
        "params": {
            "type": "object",
            "description": "parameter references"
        },
        "update": {
            "type": "string",
            "enum": [
                "ingest",
                "manual"
            ],
            "description": "ingest: update when records are ingested, manual: update only when initialize is called"
        }
    },
    "additionalProperties": false,
    "required": [
        "id",
        "method",
        "params"
    ]
}
postingestjob(ingestJobRequest)

Create ingest job

POST /shared-index/shared-index/ingest-jobs

Parameters

ingestJobRequest (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "Ingest job request",
    "type": "object",
    "properties": {
        "sourceId": {
            "type": "string",
            "description": "Source identifier",
            "format": "uuid"
        },
        "autoRollBackTimeout": {
            "type": "integer",
            "description": "Timeout in seconds"
        }
    },
    "additionalProperties": false,
    "required": [
        "sourceId"
    ]
}
postsource(source)

Create source.

POST /shared-index/sources

Parameters

source (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "Shared Source",
    "type": "object",
    "properties": {
        "id": {
            "type": "string",
            "description": "source identifier",
            "format": "uuid"
        },
        "name": {
            "type": "string",
            "description": "method"
        }
    },
    "additionalProperties": false,
    "required": [
        "id"
    ]
}
putconfigmatchkey(matchKey, id_)

Update match key configuration.

PUT /shared-index/config/matchkeys/{id}

Parameters

matchKey (dict) – See Schema below.

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "shared index match key",
    "type": "object",
    "properties": {
        "id": {
            "type": "string",
            "description": "match key identifier"
        },
        "method": {
            "type": "string",
            "description": "method"
        },
        "params": {
            "type": "object",
            "description": "parameter references"
        },
        "update": {
            "type": "string",
            "enum": [
                "ingest",
                "manual"
            ],
            "description": "ingest: update when records are ingested, manual: update only when initialize is called"
        }
    },
    "additionalProperties": false,
    "required": [
        "id",
        "method",
        "params"
    ]
}
putglobalrecords(ingestRecordRequest)

Create or update records.

PUT /shared-index/records

Parameters

ingestRecordRequest (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestFatalError – Internal error

Schema

{
    "description": "Ingest job records request",
    "type": "object",
    "properties": {
        "sourceId": {
            "type": "string",
            "description": "Source identifier",
            "format": "uuid"
        },
        "records": {
            "description": "Ingest job records chunk",
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "localId": {
                        "type": "string",
                        "description": "Local identifier"
                    },
                    "delete": {
                        "type": "boolean",
                        "description": "If true, record is deleted. Default: false"
                    },
                    "marcPayload": {
                        "type": "object"
                    },
                    "inventoryPayload": {
                        "type": "object"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "localId"
                ]
            }
        }
    },
    "additionalProperties": false,
    "required": [
        "sourceId",
        "records"
    ]
}
{
    "description": "Ingest job records response",
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "globalId": {
                "type": "string",
                "description": "Global identifier",
                "format": "uuid"
            },
            "matchKeys": {
                "description": "Match keys for these records. Normally not provided for performance reasons, but client can ask for them",
                "type": "object"
            }
        },
        "additionalProperties": false,
        "required": [
            "globalId"
        ]
    }
}