foliolib.folio.api.ermUsage.Usagedataproviders

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

Bases: foliolib.folio.FolioApi

mod-erm-usage API

This documents the API calls that can be made to query and manage usage data providers

Parameters
  • tenant (str) – Tenant id

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

Methods

delete_usageDataProvider(usageDataProvidersId)

Delete an usage data provider identified by id

get_usageDataProvider(usageDataProvidersId)

Get one usage data provider identified by id

get_usageDataProviders(**kwargs)

Get all usage data providers

modify_usageDataProvider(...)

Put an usage data provider identified by id

set_usageDataProvider(usageDataProvider)

Post new usage data providers

delete_usageDataProvider(usageDataProvidersId: str)

Delete an usage data provider identified by id

DELETE /usage-data-providers/{usageDataProvidersId}

Parameters

usageDataProvidersId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

get_usageDataProvider(usageDataProvidersId: str)

Get one usage data provider identified by id

GET /usage-data-providers/{usageDataProvidersId}

Parameters

usageDataProvidersId (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": "Usage Data Provider Schema",
  "title": "Usage Data Provider Schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "label": {
      "description": "Usage Data Provider name",
      "type": "string"
    },
    "description": {
      "description": "Usage Data Provider description",
      "type": "string"
    },
    "harvestingConfig": {
      "type": "object",
      "description": "Specifies harvesting configuration",
      "properties": {
        "harvestingStatus": {
          "description": "Enables or disables automatic harvesting for this provider",
          "type": "string",
          "enum": [
            "active",
            "inactive"
          ]
        },
        "harvestVia": {
          "type": "string",
          "description": "Specifies how to harvest usage data, from an aggregator or directly from a provider via Sushi.",
          "enum": [
            "aggregator",
            "sushi"
          ]
        },
        "sushiConfig": {
          "description": "SUSHI service properties",
          "type": "object",
          "properties": {
            "serviceType": {
              "type": "string",
              "description": "Type of SUSHI service (i.e. cs41 for Counter-Sushi 4.1) for direct harvesting (see /erm-usage-harvester/impl)."
            },
            "serviceUrl": {
              "type": "string",
              "description": "SUSHI service URL to access provider's SUSHI service."
            }
          }
        },
        "aggregator": {
          "type": "object",
          "description": "Links to aggregator, if statistic shall be harvested via aggregator",
          "properties": {
            "id": {
              "type": "string",
              "description": "Id of aggregator, linking of an aggregator predefined by an admin in the app settings"
            },
            "name": {
              "type": "string",
              "description": "Name of the linked aggregator"
            },
            "vendorCode": {
              "type": "string",
              "description": "Code used by the aggregator to identify the vendor (e. g. platform parameter at National Statistic Server)"
            }
          },
          "required": [
            "id"
          ]
        },
        "reportRelease": {
          "type": "integer",
          "description": "Specifies the counter report version."
        },
        "requestedReports": {
          "description": "Report types that are harvested. Note, types differ between counter 4 and counter 5.",
          "type": "array",
          "minItems": 0,
          "items": {
            "type": "string"
          }
        },
        "harvestingStart": {
          "description": "First month getting harvested",
          "type": "string",
          "format": "date-month"
        },
        "harvestingEnd": {
          "description": "Last month getting harvested",
          "type": "string",
          "format": "date-month"
        }
      },
      "required": [
        "harvestingStatus"
      ]
    },
    "sushiCredentials": {
      "type": "object",
      "description": "Defines credentials to access SUSHI service of usage data provider",
      "properties": {
        "customerId": {
          "description": "Customer identifier",
          "type": "string"
        },
        "requestorId": {
          "description": "Requestor identifier",
          "type": "string"
        },
        "apiKey": {
          "description": "API Key",
          "type": "string"
        },
        "platform": {
          "description": "Name of the Platform the usage is being requested for",
          "type": "string"
        },
        "requestorName": {
          "description": "Requestor name",
          "type": "string"
        },
        "requestorMail": {
          "description": "Requestor mail",
          "type": "string"
        }
      }
    },
    "latestReport": {
      "description": "Newest report available for provider",
      "type": "string"
    },
    "earliestReport": {
      "description": "Oldest report available for provider",
      "type": "string"
    },
    "hasFailedReport": {
      "description": "Indicator if this provider has a failed report",
      "type": "string",
      "enum": [
        "yes",
        "no"
      ],
      "default": "no"
    },
    "reportErrorCodes": {
      "description": "Counter error codes of reports",
      "type": "array",
      "minItems": 0,
      "items": {
        "type": "string"
      }
    },
    "reportTypes": {
      "description": "Counter report types of existent reports associated with this UDP",
      "type": "array",
      "minItems": 0,
      "items": {
        "type": "string"
      }
    },
    "harvestingDate": {
      "description": "Date and time of the last harvesting attempt",
      "type": "string",
      "format": "date-time"
    },
    "notes": {
      "description": "Notes for provider",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "../raml-util/schemas/metadata.schema"
    },
    "tags": {
      "type": "object",
      "$ref": "../raml-util/schemas/tags.schema"
    }
  },
  "required": [
    "label",
    "harvestingConfig"
  ],
  "additionalProperties": true
}
get_usageDataProviders(**kwargs)

Get all usage data providers

GET /usage-data-providers

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments
  • 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.

    Example

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

    • ((label=”Journal*” or vendor=”Journal*” or platform=”Journal*” or harvestingConfig.aggregator.name=”Journal*”) and harvestingConfig.harvestingStatus=”active” and harvestingConfig.harvestVia=”sushi” and hasFailedReport=”no”) sortby label

  • orderBy (str) – Order by field: label, harvestingConfig.harvestingStatus, latestReport, harvestingConfig.aggregator.name

  • order (str (desc|asc) – ): (default=desc) Order

  • 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

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "List of Usage Data Providers",
  "properties": {
    "usageDataProviders": {
      "type": "array",
      "description": "Entries",
      "id": "udProvidersData",
      "items": {
        "type": "object",
        "$ref": "udprovider.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    }
  },
  "required": [
    "usageDataProviders",
    "totalRecords"
  ]
}
modify_usageDataProvider(usageDataProvidersId: str, usageDataProvider: dict)

Put an usage data provider identified by id

PUT /usage-data-providers/{usageDataProvidersId}

Parameters
  • usageDataProvidersId (str) –

  • usageDataProvider (dict) – See Schema below

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Usage Data Provider Schema",
  "title": "Usage Data Provider Schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "label": {
      "description": "Usage Data Provider name",
      "type": "string"
    },
    "description": {
      "description": "Usage Data Provider description",
      "type": "string"
    },
    "harvestingConfig": {
      "type": "object",
      "description": "Specifies harvesting configuration",
      "properties": {
        "harvestingStatus": {
          "description": "Enables or disables automatic harvesting for this provider",
          "type": "string",
          "enum": [
            "active",
            "inactive"
          ]
        },
        "harvestVia": {
          "type": "string",
          "description": "Specifies how to harvest usage data, from an aggregator or directly from a provider via Sushi.",
          "enum": [
            "aggregator",
            "sushi"
          ]
        },
        "sushiConfig": {
          "description": "SUSHI service properties",
          "type": "object",
          "properties": {
            "serviceType": {
              "type": "string",
              "description": "Type of SUSHI service (i.e. cs41 for Counter-Sushi 4.1) for direct harvesting (see /erm-usage-harvester/impl)."
            },
            "serviceUrl": {
              "type": "string",
              "description": "SUSHI service URL to access provider's SUSHI service."
            }
          }
        },
        "aggregator": {
          "type": "object",
          "description": "Links to aggregator, if statistic shall be harvested via aggregator",
          "properties": {
            "id": {
              "type": "string",
              "description": "Id of aggregator, linking of an aggregator predefined by an admin in the app settings"
            },
            "name": {
              "type": "string",
              "description": "Name of the linked aggregator"
            },
            "vendorCode": {
              "type": "string",
              "description": "Code used by the aggregator to identify the vendor (e. g. platform parameter at National Statistic Server)"
            }
          },
          "required": [
            "id"
          ]
        },
        "reportRelease": {
          "type": "integer",
          "description": "Specifies the counter report version."
        },
        "requestedReports": {
          "description": "Report types that are harvested. Note, types differ between counter 4 and counter 5.",
          "type": "array",
          "minItems": 0,
          "items": {
            "type": "string"
          }
        },
        "harvestingStart": {
          "description": "First month getting harvested",
          "type": "string",
          "format": "date-month"
        },
        "harvestingEnd": {
          "description": "Last month getting harvested",
          "type": "string",
          "format": "date-month"
        }
      },
      "required": [
        "harvestingStatus"
      ]
    },
    "sushiCredentials": {
      "type": "object",
      "description": "Defines credentials to access SUSHI service of usage data provider",
      "properties": {
        "customerId": {
          "description": "Customer identifier",
          "type": "string"
        },
        "requestorId": {
          "description": "Requestor identifier",
          "type": "string"
        },
        "apiKey": {
          "description": "API Key",
          "type": "string"
        },
        "platform": {
          "description": "Name of the Platform the usage is being requested for",
          "type": "string"
        },
        "requestorName": {
          "description": "Requestor name",
          "type": "string"
        },
        "requestorMail": {
          "description": "Requestor mail",
          "type": "string"
        }
      }
    },
    "latestReport": {
      "description": "Newest report available for provider",
      "type": "string"
    },
    "earliestReport": {
      "description": "Oldest report available for provider",
      "type": "string"
    },
    "hasFailedReport": {
      "description": "Indicator if this provider has a failed report",
      "type": "string",
      "enum": [
        "yes",
        "no"
      ],
      "default": "no"
    },
    "reportErrorCodes": {
      "description": "Counter error codes of reports",
      "type": "array",
      "minItems": 0,
      "items": {
        "type": "string"
      }
    },
    "reportTypes": {
      "description": "Counter report types of existent reports associated with this UDP",
      "type": "array",
      "minItems": 0,
      "items": {
        "type": "string"
      }
    },
    "harvestingDate": {
      "description": "Date and time of the last harvesting attempt",
      "type": "string",
      "format": "date-time"
    },
    "notes": {
      "description": "Notes for provider",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "../raml-util/schemas/metadata.schema"
    },
    "tags": {
      "type": "object",
      "$ref": "../raml-util/schemas/tags.schema"
    }
  },
  "required": [
    "label",
    "harvestingConfig"
  ],
  "additionalProperties": true
}
set_usageDataProvider(usageDataProvider: dict)

Post new usage data providers

POST /usage-data-providers

Parameters

usageDataProvider (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Headers

  • Location - URI to the created usageDataProvider item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Usage Data Provider Schema",
  "title": "Usage Data Provider Schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "label": {
      "description": "Usage Data Provider name",
      "type": "string"
    },
    "description": {
      "description": "Usage Data Provider description",
      "type": "string"
    },
    "harvestingConfig": {
      "type": "object",
      "description": "Specifies harvesting configuration",
      "properties": {
        "harvestingStatus": {
          "description": "Enables or disables automatic harvesting for this provider",
          "type": "string",
          "enum": [
            "active",
            "inactive"
          ]
        },
        "harvestVia": {
          "type": "string",
          "description": "Specifies how to harvest usage data, from an aggregator or directly from a provider via Sushi.",
          "enum": [
            "aggregator",
            "sushi"
          ]
        },
        "sushiConfig": {
          "description": "SUSHI service properties",
          "type": "object",
          "properties": {
            "serviceType": {
              "type": "string",
              "description": "Type of SUSHI service (i.e. cs41 for Counter-Sushi 4.1) for direct harvesting (see /erm-usage-harvester/impl)."
            },
            "serviceUrl": {
              "type": "string",
              "description": "SUSHI service URL to access provider's SUSHI service."
            }
          }
        },
        "aggregator": {
          "type": "object",
          "description": "Links to aggregator, if statistic shall be harvested via aggregator",
          "properties": {
            "id": {
              "type": "string",
              "description": "Id of aggregator, linking of an aggregator predefined by an admin in the app settings"
            },
            "name": {
              "type": "string",
              "description": "Name of the linked aggregator"
            },
            "vendorCode": {
              "type": "string",
              "description": "Code used by the aggregator to identify the vendor (e. g. platform parameter at National Statistic Server)"
            }
          },
          "required": [
            "id"
          ]
        },
        "reportRelease": {
          "type": "integer",
          "description": "Specifies the counter report version."
        },
        "requestedReports": {
          "description": "Report types that are harvested. Note, types differ between counter 4 and counter 5.",
          "type": "array",
          "minItems": 0,
          "items": {
            "type": "string"
          }
        },
        "harvestingStart": {
          "description": "First month getting harvested",
          "type": "string",
          "format": "date-month"
        },
        "harvestingEnd": {
          "description": "Last month getting harvested",
          "type": "string",
          "format": "date-month"
        }
      },
      "required": [
        "harvestingStatus"
      ]
    },
    "sushiCredentials": {
      "type": "object",
      "description": "Defines credentials to access SUSHI service of usage data provider",
      "properties": {
        "customerId": {
          "description": "Customer identifier",
          "type": "string"
        },
        "requestorId": {
          "description": "Requestor identifier",
          "type": "string"
        },
        "apiKey": {
          "description": "API Key",
          "type": "string"
        },
        "platform": {
          "description": "Name of the Platform the usage is being requested for",
          "type": "string"
        },
        "requestorName": {
          "description": "Requestor name",
          "type": "string"
        },
        "requestorMail": {
          "description": "Requestor mail",
          "type": "string"
        }
      }
    },
    "latestReport": {
      "description": "Newest report available for provider",
      "type": "string"
    },
    "earliestReport": {
      "description": "Oldest report available for provider",
      "type": "string"
    },
    "hasFailedReport": {
      "description": "Indicator if this provider has a failed report",
      "type": "string",
      "enum": [
        "yes",
        "no"
      ],
      "default": "no"
    },
    "reportErrorCodes": {
      "description": "Counter error codes of reports",
      "type": "array",
      "minItems": 0,
      "items": {
        "type": "string"
      }
    },
    "reportTypes": {
      "description": "Counter report types of existent reports associated with this UDP",
      "type": "array",
      "minItems": 0,
      "items": {
        "type": "string"
      }
    },
    "harvestingDate": {
      "description": "Date and time of the last harvesting attempt",
      "type": "string",
      "format": "date-time"
    },
    "notes": {
      "description": "Notes for provider",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "../raml-util/schemas/metadata.schema"
    },
    "tags": {
      "type": "object",
      "$ref": "../raml-util/schemas/tags.schema"
    }
  },
  "required": [
    "label",
    "harvestingConfig"
  ],
  "additionalProperties": true
}