This repository has been archived by the owner on Mar 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(api-spec): add report-api spec (#11)
closes #11, closes #5 Co-authored-by: Sebastian <[email protected]>
- Loading branch information
1 parent
9e5f387
commit 5192d5d
Showing
3 changed files
with
294 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,252 @@ | ||
openapi: 3.0.3 | ||
info: | ||
title: Aam Digital - Reporting API | ||
description: |- | ||
API to manage reports that provide data calculated based on any entities of the Aam Digital system. | ||
version: 1.0.0-alpha.1 | ||
servers: | ||
- url: https://{customerId}.aam-digital.net/api/v1/reporting | ||
description: Developer Instance for testing | ||
variables: | ||
customerId: | ||
default: dev | ||
description: Customer ID assigned by the service provider | ||
tags: | ||
- name: report | ||
|
||
paths: | ||
/report: | ||
get: | ||
security: | ||
- development: | ||
- reports_read | ||
tags: | ||
- report | ||
summary: Return list of available Reports | ||
responses: | ||
200: | ||
description: List of all available Reports the requester has access permissions to, empty array if no reports are available | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/Report' | ||
401: | ||
description: If no valid access token | ||
|
||
/report/{reportId}: | ||
get: | ||
security: | ||
- development: | ||
- reports_read | ||
tags: | ||
- report | ||
summary: Return report metadata by ID | ||
parameters: | ||
- in: path | ||
name: reportId | ||
schema: | ||
type: string | ||
required: true | ||
responses: | ||
200: | ||
description: Get details of a report, including details of the data structure (schema) this specific report's data has | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Report' | ||
404: | ||
description: If the Report does not exist | ||
401: | ||
description: If the access token does not grant permission to this Report | ||
|
||
/report-calculation/report/{reportId}: | ||
get: | ||
security: | ||
- development: | ||
- reports_read | ||
tags: | ||
- report | ||
summary: Return all report calculations for a report | ||
parameters: | ||
- in: path | ||
name: reportId | ||
schema: | ||
type: string | ||
required: true | ||
responses: | ||
200: | ||
description: List of metadata of all calculations triggered by any user (pending and completed) | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ReportCalculation' | ||
401: | ||
description: If the access token does not grant permission to this Report | ||
404: | ||
description: If report does not exist | ||
|
||
post: | ||
security: | ||
- development: | ||
- reports_write | ||
tags: | ||
- report | ||
summary: Trigger a new report calculation run. | ||
description: Trigger a new report calculation run. Check status of the asynchronous calculation via the /report-calculation endpoint | ||
(CURRENTLY UNDER DEVELOPMENT) optionally receive status updates via a webhook if that has been set up for the authorized client | ||
parameters: | ||
- in: path | ||
name: reportId | ||
schema: | ||
type: string | ||
required: true | ||
- in: query | ||
name: from | ||
description: start date for report period | ||
schema: | ||
type: string | ||
format: date | ||
- in: query | ||
name: to | ||
description: end date for report period | ||
schema: | ||
type: string | ||
format: date | ||
responses: | ||
200: | ||
description: Return calculation identifier, to be used to check status and result data | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
format: uuid | ||
401: | ||
description: If the access token does not grant permission to this Report | ||
|
||
/report-calculation/{calculationId}: | ||
get: | ||
security: | ||
- development: | ||
- reports_read | ||
tags: | ||
- report | ||
summary: Return metadata for a report calculation | ||
parameters: | ||
- in: path | ||
name: calculationId | ||
schema: | ||
type: string | ||
required: true | ||
responses: | ||
200: | ||
description: Status and details of the given report calculation run | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/ReportCalculation' | ||
401: | ||
description: If the access token does not grant permission to this Report | ||
404: | ||
description: If the calculation identifier does not exist | ||
|
||
/report-calculation/{calculationId}/data: | ||
get: | ||
security: | ||
- development: | ||
- reports_read | ||
tags: | ||
- report | ||
summary: Fetch actual report data for a specific calculation | ||
parameters: | ||
- in: path | ||
name: calculationId | ||
schema: | ||
type: string | ||
required: true | ||
responses: | ||
200: | ||
description: The actual data that has been calculated by the calculation run. This matches the schema defined in the /report/id | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ReportData' | ||
application/xml: | ||
schema: | ||
$ref: '#/components/schemas/ReportData' | ||
404: | ||
description: report data is not available yet (when either the calculation id is not valid or the calculation is still running) | ||
401: | ||
description: If the access token does not grant permission to this Report | ||
|
||
components: | ||
schemas: | ||
Report: | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
format: uuid | ||
name: | ||
type: string | ||
example: report_all_course_members | ||
calculationPending: | ||
type: boolean | ||
schema: | ||
$ref: '#/components/schemas/ReportSchema' | ||
|
||
ReportSchema: | ||
type: object | ||
properties: | ||
fields: | ||
type: array | ||
items: | ||
type: object | ||
|
||
ReportCalculation: | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
format: uuid | ||
start_date: | ||
type: string | ||
example: date | ||
end_date: | ||
type: string | ||
example: date | ||
nullable: true | ||
status: | ||
type: string | ||
description: Current status of the run | ||
enum: | ||
- PENDING | ||
- RUNNING | ||
- FINISHED_SUCCESS | ||
- FINISHED_ERROR | ||
|
||
ReportData: | ||
type: object | ||
properties: | ||
reportId: | ||
type: string | ||
format: uuid | ||
data: | ||
type: object | ||
|
||
securitySchemes: | ||
development: | ||
type: oauth2 | ||
description: This API uses OAuth2 with the Client Credentials Flow | ||
flows: | ||
clientCredentials: | ||
tokenUrl: https://keycloak.aam-digital.net/realms/TolaData/protocol/openid-connect/token | ||
scopes: | ||
reports_read: Read Report and ReportCalculation | ||
reports_write: Trigger new ReportCalculation |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.