foliolib.folio.api.ermUsage.Customreports

class foliolib.folio.api.ermUsage.Customreports(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 custom reports

Parameters
  • tenant (str) – Tenant id

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

Methods

delete_customReport(customReportsId)

Delete report identified by id

get_customReport(customReportsId)

Get one report identified by id

get_customReports(**kwargs)

Get all reports.

modify_customReport(customReportsId, ...)

Put report identified by id

set_customReport(customReport)

Post new report

delete_customReport(customReportsId: str)

Delete report identified by id

DELETE /custom-reports/{customReportsId}

Parameters

customReportsId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

get_customReport(customReportsId: str)

Get one report identified by id

GET /custom-reports/{customReportsId}

Parameters

customReportsId (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": "Custom Report and Metadata",
  "title": "Custom Report Schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "year": {
      "type": "integer",
      "description": "The year the report is valid. The report may not cover a whole year. You can add multiple reports with the same year. Then please specify the accurate reporting period in the notes."
    },
    "note": {
      "type": "string",
      "description": "Field to give additional information, e.g. month the report covers."
    },
    "fileId": {
      "type": "string",
      "description": "UUID of the binary file (which is uploaded before this custom report document)."
    },
    "fileName": {
      "type": "string",
      "description": "The file's filename."
    },
    "fileSize": {
      "type": "number",
      "description": "Size of file in kb."
    },
    "providerId": {
      "description": "Id of associated usage data provider",
      "type": "string"
    },
    "linkUrl": {
      "description": "Link to an external resource",
      "type": "string"
    },
    "metadata": {
      "description": "Metadata about creation and changes, provided by the server (client should not provide)",
      "type": "object",
      "$ref": "../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "year",
    "providerId"
  ],
  "additionalProperties": false
}
get_customReports(**kwargs)

Get all reports.

GET /custom-reports

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

    • year=2018

  • orderBy (str) – Order by field:

  • 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#",
  "description": "List of CustomReports",
  "type": "object",
  "properties": {
    "customReports": {
      "type": "array",
      "description": "Entries",
      "id": "customReportData",
      "items": {
        "type": "object",
        "$ref": "customreport.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    }
  },
  "required": [
    "customReports",
    "totalRecords"
  ]
}
modify_customReport(customReportsId: str, customReport: dict)

Put report identified by id

PUT /custom-reports/{customReportsId}

Parameters
  • customReportsId (str) –

  • customReport (dict) – See Schema below

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Custom Report and Metadata",
  "title": "Custom Report Schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "year": {
      "type": "integer",
      "description": "The year the report is valid. The report may not cover a whole year. You can add multiple reports with the same year. Then please specify the accurate reporting period in the notes."
    },
    "note": {
      "type": "string",
      "description": "Field to give additional information, e.g. month the report covers."
    },
    "fileId": {
      "type": "string",
      "description": "UUID of the binary file (which is uploaded before this custom report document)."
    },
    "fileName": {
      "type": "string",
      "description": "The file's filename."
    },
    "fileSize": {
      "type": "number",
      "description": "Size of file in kb."
    },
    "providerId": {
      "description": "Id of associated usage data provider",
      "type": "string"
    },
    "linkUrl": {
      "description": "Link to an external resource",
      "type": "string"
    },
    "metadata": {
      "description": "Metadata about creation and changes, provided by the server (client should not provide)",
      "type": "object",
      "$ref": "../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "year",
    "providerId"
  ],
  "additionalProperties": false
}
set_customReport(customReport: dict)

Post new report

POST /custom-reports

Parameters

customReport (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Headers

  • Location - URI to the created customReport item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Custom Report and Metadata",
  "title": "Custom Report Schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "year": {
      "type": "integer",
      "description": "The year the report is valid. The report may not cover a whole year. You can add multiple reports with the same year. Then please specify the accurate reporting period in the notes."
    },
    "note": {
      "type": "string",
      "description": "Field to give additional information, e.g. month the report covers."
    },
    "fileId": {
      "type": "string",
      "description": "UUID of the binary file (which is uploaded before this custom report document)."
    },
    "fileName": {
      "type": "string",
      "description": "The file's filename."
    },
    "fileSize": {
      "type": "number",
      "description": "Size of file in kb."
    },
    "providerId": {
      "description": "Id of associated usage data provider",
      "type": "string"
    },
    "linkUrl": {
      "description": "Link to an external resource",
      "type": "string"
    },
    "metadata": {
      "description": "Metadata about creation and changes, provided by the server (client should not provide)",
      "type": "object",
      "$ref": "../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "year",
    "providerId"
  ],
  "additionalProperties": false
}