openapi: 3.0.3
info:
title: Reporting API Specification
description: Reporting API Specification. All operations requires Bearer token from login-process. For more information, please visit https://bokbasen.jira.com/wiki/spaces/api/pages/2994962433/Authentication+Service+upcoming
version: 1.0.0
servers:
- url: 'https://api.bokbasen.io/reporting'
paths:
/rental/v1:
post:
summary: POST rental report
operationId: createRentalReport
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RentalReport'
required: true
responses:
'204':
description: Successfully created
'400':
description: Bad Request
/streaming/v1:
post:
summary: POST streaming report
operationId: postStreamingData
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/StreamingReport'
required: true
responses:
'204':
description: Successfully registered streaming report
'400':
description: Bad Request
/loan/tibi/v1:
post:
summary: POST TIBI loan report
operationId: postTibiLoanReport
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TibiLoanReport'
required: true
responses:
201:
description: Successfully registered streaming report
content:
application/json:
schema:
$ref: '#/components/schemas/LoanReportResponse'
400:
$ref: '#/components/responses/BadRequest'
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
RentalReport:
type: object
required:
- period
- items
properties:
period:
type: object
required:
- year
- month
properties:
year:
type: integer
example: 2023
month:
type: integer
minimum: 1
maximum: 12
example: 8
items:
type: array
x-field-extra-annotation: "@lombok.Builder.Default"
minItems: 1
items:
$ref: '#/components/schemas/RentalItem'
RentalItem:
type: object
required:
- isbn
- number
- pricePrItem
- sum
- net
properties:
isbn:
type: string
example: "9788252119695"
number:
type: integer
example: 10
pricePrItem:
type: number
example: 99.99
sum:
type: number
example: 999.9
net:
type: number
example: 949.99
StreamingReport:
type: object
required:
- items
properties:
items:
type: array
x-field-extra-annotation: "@lombok.Builder.Default"
minItems: 1
items:
$ref: '#/components/schemas/StreamingItem'
reportId:
type: string
format: uuid
description: "Used to write over existing streaming report"
StreamingItem:
type: object
required:
- isbn
- periodFrom
- periodTo
- productOwnerId
- cost
- consumption
properties:
isbn:
type: string
example: "9782123456789"
description: ISBN of the book you are reporting numbers for
periodFrom:
type: string
format: year-month
description: Start of the reporting period on the format yyyy-MM
example: "2024-05"
periodTo:
type: string
format: year-month
description: End of the reporting period on the format yyyy-MM
example: "2024-06"
productOwnerId:
type: string
example: "9999"
description: Numeric ID of the publisher who owned the rights to the book during the reporting period
cost:
$ref: '#/components/schemas/StreamingCost'
consumption:
$ref: '#/components/schemas/StreamingConsumption'
price:
$ref: '#/components/schemas/StreamingPricePerUnit'
productOwnerName:
type: string
example: "Bokbasen AS"
description: Name of the publisher who owned the rights to the book during the reporting period
currency:
type: string
example: "NOK"
description: The currency of the cost/ppu-fields
market:
type: string
example: "NO"
description: The market you are reporting for
StreamingCost:
type: object
required:
- totalCost
properties:
totalCost:
type: string
example: "600"
description: The total cost that will be billed for this ISBN
paidCost:
type: string
example: "450"
description: Can be sent in addition to totalCost if you separate between trial and subscription
trialCost:
type: string
example: "150"
description: Can be sent in addition to totalCost if you separate between trial and subscription
StreamingConsumption:
type: object
required:
- total
properties:
total:
type: string
example: "30"
description: The total amount of books read
paid:
type: string
example: "15"
description: Can be sent in addition to total if you separate between trial and subscription
trial:
type: string
example: "15"
description: Can be sent in addition to total if you separate between trial and subscription
StreamingPricePerUnit:
type: object
properties:
ppu:
type: string
example: "20"
description: The price per book read (price per unit)
paidPpu:
type: string
example: "30"
description: Can be sent in addition to ppu if you separate between trial and subscription
trialPpu:
type: string
example: "10"
description: Can be sent in addition to ppu if you separate between trial and subscription
LoanReportResponse:
type: object
required:
- id
properties:
id:
type: string
format: uuid
description: The report ID.
TibiLoanReport:
type: object
required:
- reportInfo
- items
properties:
reportInfo:
type: object
required:
- period
properties:
id:
type: string
format: uuid
description: Report id in UUID format. Can be used to update a reports content. Must exist if used.
example: "feeada9c-af12-4733-86fe-4b60fa70b669"
period:
type: string
format: year-month
description: The period the report is for in the YYYY-mm format
example: 2024-05
items:
type: array
x-field-extra-annotation: "@lombok.Builder.Default"
items:
$ref: '#/components/schemas/TibiItem'
TibiItem:
type: object
required:
- ean
- count
- libraryUnit
- adaptedVersion
properties:
ean:
type: string
example: "9782123456789"
description: EAN of the original book you are reporting numbers for
count:
type: integer
example: "55"
description: The number of loans of the ean in the given period
libraryUnit:
type: string
description: The library where the loan happened
example: "NLB"
adaptedVersion:
$ref: '#/components/schemas/TibiAdaptedVersionInfo'
TibiAdaptedVersionInfo:
type: object
required:
- format
- availableDate
- audioContent
- textContent
- brailleContent
- speechSynthesis
properties:
reference:
type: string
description: Internal reference to product. Eg. booknumber.
example: "686512"
format:
type: string
description: The format of the edition
example: "DAISY2.0"
availableDate:
type: string
format: date
description: The date the adapted version was ready for loan
example: "2024-09-01"
ean:
type: string
description: The ean of the adapted book version if any
example: "9876543212345"
audioContent:
type: boolean
description: True if the adapted version contains audio content
example: true
textContent:
type: boolean
description: True if the adapted version contains text content
example: true
brailleContent:
type: boolean
description: True if the adapted version contains braille content
example: true
speechSynthesis:
type: boolean
description: True if the adapted version contains speech synthesis
example: true
ProblemDetail:
title: An RFC 9457 problem object
type: object
properties:
type:
type: string
format: uri-reference
title:
type: string
status:
type: integer
description: HTTP status code
minimum: 100
maximum: 599
detail:
type: string
description: A human-readable explanation specific to this occurrence of the problem.
responses:
BadRequest:
description: Bad Request
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ProblemDetail'
security:
- bearerAuth: [ ] |