foliolib.folio.api.ermUsageHarvester.Harvester

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

Bases: foliolib.folio.FolioApi

mod-erm-usage-harvester API

This documents the API calls that can be made to mod-erm-usage-harvester

Parameters
  • tenant (str) – Tenant id

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

Methods

get_impls(**kwargs)

Get available service implementations

get_jobs(**kwargs)

Get harvesting jobs

get_start(startId)

Start harvesting for tenant - process a specific usage data provider only

get_starts()

Start harvesting for tenant - process all defined usage data providers

set_cleanup()

Perform cleanup tasks on harvesting jobs

set_purgefinished(**kwargs)

Purge finished harvesting jobs

set_purgestale()

Purge stale jobs

get_impls(**kwargs)

Get available service implementations

GET /erm-usage-harvester/impl

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments

aggregator (str) – Filter by ‘isAggregator’ property (true or false)

Raises
  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

get_jobs(**kwargs)

Get harvesting jobs

GET /erm-usage-harvester/jobs

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments
  • timestamp (long) –

    Only return jobs created at or before this timestamp

    Example

    • 1641020400000

  • providerId (str) –

    Only return jobs with this providerId

    Example

    • 6697f576-78d4-4712-ae18-2612ccdcd66d

  • query (str) –

    A query expressed as a CQL string (see [dev.folio.org/reference/glossary#cql](https://dev.folio.org/reference/glossary#cql)) using valid searchable fields. The first example below shows the general form of a full CQL query, but those fields might not be relevant in this context.

    CQL string

    Example

    • (username==”ab*” or personal.firstName==”ab*” or personal.lastName==”ab*”) and active==”true” sortby personal.lastName personal.firstName barcode

    • type==provider

  • 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

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A collection of JobInfo objects",
  "type": "object",
  "properties": {
    "jobInfos": {
      "description": "List of JobInfo",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "jobInfo.json"
      }
    },
    "totalRecords": {
      "description": "Total number of JobInfo objects",
      "type": "integer"
    }
  },
  "required": [
    "jobInfos",
    "totalRecords"
  ]
}
get_start(startId: str)

Start harvesting for tenant - process a specific usage data provider only

GET /erm-usage-harvester/start/{startId}

Parameters

startId (str) –

Raises
  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

get_starts()

Start harvesting for tenant - process all defined usage data providers

GET /erm-usage-harvester/start

Raises
  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

set_cleanup()

Perform cleanup tasks on harvesting jobs

POST /erm-usage-harvester/jobs/cleanup

Raises
  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

set_purgefinished(**kwargs)

Purge finished harvesting jobs

POST /erm-usage-harvester/jobs/purgefinished

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments

timestamp (long) –

Only purge jobs having a timestamp less than or equal to this value

Example

  • 1641020400000

Raises
  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

set_purgestale()

Purge stale jobs

POST /erm-usage-harvester/jobs/purgestale

Raises
  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error