Counter Reports (v1)

http://localhost/mod-erm-usage

Table of contents

mod-erm-usage API

This documents the API calls that can be made to query and manage counter reports

Counter Reports

Collection of counter-report items.

GET /counter-reports

Get all reports

GET /counter-reports
Query Parameters
  • tiny: (boolean - default: false)
  • query: (string)

    A query expressed as a CQL string (see 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
    
    active=true sortBy username
    
  • orderBy: (string)

    Order by field: field A, field B

  • order: (one of desc, asc - default: desc)

    Order

  • offset: (integer - default: 0 - minimum: 0 - maximum: 2147483647)

    Skip over a number of elements by specifying an offset value for the query

    Example:

    0
  • limit: (integer - default: 10 - minimum: 0 - maximum: 2147483647)

    Limit the number of elements returned in the response

    Example:

    10
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 200

Returns a list of counter-report items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "counterReports": {
      "type": "array",
      "id": "counterReportData",
      "items": {
        "type": "object",
        "$ref": "counterreport.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    }
  },
  "required": [
    "counterReports",
    "totalRecords"
  ]
}

Example:

{
  "counterReports": [
    {
    	"id": "8c6b1c02-e153-4413-970b-1b1a3eca1328",
    	"downloadTime": "2018-09-13T12:57:01.414+0000",
    	"creationTime": "2018-09-13T12:57:01.414+0000",
    	"release": "4",
    	"reportName": "JR1",
    	"yearMonth": "2018-07",
    	"customerId": "Customer123Id",
    	"vendorId": "5fb03fb5-56c0-4a6e-9f4e-194d1b540140",
    	"platformId": "19b535aa-7007-435a-96da-a390853e6666",
    	"format": "xml",
    	"report": "<?xml version='1.0' encoding='UTF-8'?><cs:ReportResponse>...</cs:ReportResponse>"
    },
    {
    	"id": "8c6b1c02-e153-4413-970b-1b1a3eca1330",
    	"downloadTime": "2018-09-13T12:57:01.414+0000",
    	"creationTime": "2018-09-13T12:57:01.414+0000",
    	"release": "5",
    	"reportName": "TR_J1",
    	"yearMonth": "2018-07",
    	"customerId": "Customer123Id",
    	"vendorId": "5fb03fb5-56c0-4a6e-9f4e-194d1b540140",
    	"platformId": "19b535aa-7007-435a-96da-a390853e6666",
    	"format": "json",
    	"report": "{
                  "Report_Header": {
                 	  ...
                 	}
                 }"
    }
  ],
  "totalRecords": 2
}

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

unable to list counter-reports -- malformed parameter 'query', syntax error at column 6

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to list counter-reports -- unauthorized

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

POST /counter-reports

Post new report

POST /counter-reports
Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Counter Report Schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "downloadTime": {
      "type": "string",
      "format": "date-time"
    },
    "failedAttempts": {
      "type": "integer"
    },
    "release": {
      "type": "string"
    },
    "reportName": {
      "type": "string"
    },
    "yearMonth": {
      "type": "string",
      "format": "date-month"
    },
    "customerId": {
      "type": "string"
    },
    "vendorId": {
      "type": "string"
    },
    "platformId": {
      "type": "string"
    },
    "providerId": {
      "type": "string"
    },
    "format": {
      "type": "string"
    },
    "report": {
      "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": [
    "downloadTime",
    "release",
    "reportName",
    "yearMonth",
    "customerId",
    "vendorId",
    "platformId"
  ],
  "additionalProperties": true
}

Example:

{
	"id": "8c6b1c02-e153-4413-970b-1b1a3eca1328",
	"downloadTime": "2018-09-13T12:57:01.414+0000",
	"creationTime": "2018-09-13T12:57:01.414+0000",
	"release": "4",
	"reportName": "JR1",
	"yearMonth": "2018-07",
	"customerId": "Customer123Id",
	"vendorId": "5fb03fb5-56c0-4a6e-9f4e-194d1b540140",
	"platformId": "19b535aa-7007-435a-96da-a390853e6666",
	"format": "xml",
	"report": "<?xml version='1.0' encoding='UTF-8'?><cs:ReportResponse>...</cs:ReportResponse>"
}

Response 201

Returns a newly created item, with server-controlled fields like 'id' populated

Headers
  • Location: required (string)

    URI to the created counter-report item

Body

Media type: application/json

Type: any

Example:

{
	"id": "8c6b1c02-e153-4413-970b-1b1a3eca1328",
	"downloadTime": "2018-09-13T12:57:01.414+0000",
	"creationTime": "2018-09-13T12:57:01.414+0000",
	"release": "4",
	"reportName": "JR1",
	"yearMonth": "2018-07",
	"customerId": "Customer123Id",
	"vendorId": "5fb03fb5-56c0-4a6e-9f4e-194d1b540140",
	"platformId": "19b535aa-7007-435a-96da-a390853e6666",
	"format": "xml",
	"report": "<?xml version='1.0' encoding='UTF-8'?><cs:ReportResponse>...</cs:ReportResponse>"
}

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

"unable to add counter-report -- malformed JSON at 13:3"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create counter-reports -- unauthorized

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "errors": {
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

GET /counter-reports/{id}

Get one report identified by id

GET /counter-reports/{id}
URI Parameters
  • id: required (string)
Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 200

Returns item with a given ID

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Counter Report Schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "downloadTime": {
      "type": "string",
      "format": "date-time"
    },
    "failedAttempts": {
      "type": "integer"
    },
    "release": {
      "type": "string"
    },
    "reportName": {
      "type": "string"
    },
    "yearMonth": {
      "type": "string",
      "format": "date-month"
    },
    "customerId": {
      "type": "string"
    },
    "vendorId": {
      "type": "string"
    },
    "platformId": {
      "type": "string"
    },
    "providerId": {
      "type": "string"
    },
    "format": {
      "type": "string"
    },
    "report": {
      "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": [
    "downloadTime",
    "release",
    "reportName",
    "yearMonth",
    "customerId",
    "vendorId",
    "platformId"
  ],
  "additionalProperties": true
}

Example:

{
	"id": "8c6b1c02-e153-4413-970b-1b1a3eca1328",
	"downloadTime": "2018-09-13T12:57:01.414+0000",
	"creationTime": "2018-09-13T12:57:01.414+0000",
	"release": "4",
	"reportName": "JR1",
	"yearMonth": "2018-07",
	"customerId": "Customer123Id",
	"vendorId": "5fb03fb5-56c0-4a6e-9f4e-194d1b540140",
	"platformId": "19b535aa-7007-435a-96da-a390853e6666",
	"format": "xml",
	"report": "<?xml version='1.0' encoding='UTF-8'?><cs:ReportResponse>...</cs:ReportResponse>"
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"counter-report not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

DELETE /counter-reports/{id}

Delete report identified by id

DELETE /counter-reports/{id}
URI Parameters
  • id: required (string)
Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 204

Item deleted successfully

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

"unable to delete counter-report -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"counter-report not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

PUT /counter-reports/{id}

Put report identified by id

PUT /counter-reports/{id}
URI Parameters
  • id: required (string)
Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Counter Report Schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "downloadTime": {
      "type": "string",
      "format": "date-time"
    },
    "failedAttempts": {
      "type": "integer"
    },
    "release": {
      "type": "string"
    },
    "reportName": {
      "type": "string"
    },
    "yearMonth": {
      "type": "string",
      "format": "date-month"
    },
    "customerId": {
      "type": "string"
    },
    "vendorId": {
      "type": "string"
    },
    "platformId": {
      "type": "string"
    },
    "providerId": {
      "type": "string"
    },
    "format": {
      "type": "string"
    },
    "report": {
      "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": [
    "downloadTime",
    "release",
    "reportName",
    "yearMonth",
    "customerId",
    "vendorId",
    "platformId"
  ],
  "additionalProperties": true
}

Example:

{
	"id": "8c6b1c02-e153-4413-970b-1b1a3eca1328",
	"downloadTime": "2018-09-13T12:57:01.414+0000",
	"creationTime": "2018-09-13T12:57:01.414+0000",
	"release": "4",
	"reportName": "JR1",
	"yearMonth": "2018-07",
	"customerId": "Customer123Id",
	"vendorId": "5fb03fb5-56c0-4a6e-9f4e-194d1b540140",
	"platformId": "19b535aa-7007-435a-96da-a390853e6666",
	"format": "xml",
	"report": "<?xml version='1.0' encoding='UTF-8'?><cs:ReportResponse>...</cs:ReportResponse>"
}

Response 204

Item successfully updated

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

"unable to update counter-report -- malformed JSON at 13:4"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"counter-report not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator