Files
arbeitszeitmessung/Docker/arbeitszeitmessung.json

458 lines
13 KiB
JSON

{
"openapi": "3.0.3",
"info": {
"title": "Arbeitszeitmessung - OpenAPI 3.0",
"description": "This demos the API for the Arbeitszeitmessung Project ",
"version": "0.1.0"
},
"externalDocs": {
"description": "Git-Repository",
"url": "https://git.letsstein.de/tom/arbeitszeitmessung"
},
"servers": [
{
"url": "http://localhost:8000",
"description": "Docker Server"
},
{
"url": "http://localhost:8080",
"description": "Local Development"
}
],
"tags": [
{
"name": "booking",
"description": "all Bookings"
}
],
"paths": {
"/time": {
"get": {
"tags": ["booking"],
"summary": "Gets all the bookings from one card_uid",
"description": "Returns all the bookings optionally filtered with cardID",
"operationId": "getBooking",
"parameters": [
{
"name": "card_uid",
"in": "query",
"description": "CardID to filter for",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "time_from",
"in": "query",
"description": "Timestamp since when all bookings are shown (default=1 month ago)",
"required": false,
"schema": {
"type": "string",
"example": "2025-02-28"
}
},
{
"name": "time_to",
"in": "query",
"description": "Timestamp till when all bookings are shown (default=today)",
"required": false,
"schema": {
"type": "string",
"example": "2025-02-28"
}
}
],
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"day": {
"type": "string",
"format": "date"
},
"bookings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"counter_id": {
"type": "integer",
"format": "int64",
"example": 100
},
"card_uid": {
"type": "string",
"example": "test_card"
},
"geraet_id": {
"type": "string",
"example": "test_reader"
},
"check_in_out": {
"type": "integer",
"example": 1,
"enum": [1, 2, 254]
},
"timestamp": {
"type": "string",
"format": "date-time",
"example": "2024-09-05T08:51:12.670Z"
}
},
"xml": {
"name": "booking"
}
}
}
}
}
}
}
}
},
"400": {
"description": "Invalid cardID"
}
}
}
},
"/time/new": {
"put": {
"tags": ["booking"],
"summary": "Create new Booking",
"description": "Creates a new booking with the supplied parameters",
"operationId": "pcreateBooking",
"parameters": [
{
"in": "header",
"name": "Authorization",
"description": "Predefined API Key to authorize access",
"schema": {
"type": "string"
}
},
{
"name": "card_uid",
"in": "query",
"description": "id of the RFID card scanned",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "geraet_id",
"in": "query",
"description": "id of the RFID reader scanning the card",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "check_in_out",
"in": "query",
"description": "booking Type",
"required": true,
"schema": {
"type": "integer",
"enum": [1, 2, 254]
}
}
],
"responses": {
"200": {
"description": "successfully created booking",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"counter_id": {
"type": "integer",
"format": "int64",
"example": 100
},
"card_uid": {
"type": "string",
"example": "test_card"
},
"geraet_id": {
"type": "string",
"example": "test_reader"
},
"check_in_out": {
"type": "integer",
"example": 1,
"enum": [1, 2, 254]
},
"timestamp": {
"type": "string",
"format": "date-time",
"example": "2024-09-05T08:51:12.670Z"
}
},
"xml": {
"name": "booking"
}
}
}
}
},
"409": {
"description": "Same booking type as last booking"
}
}
},
"get": {
"tags": ["booking"],
"summary": "Create new Booking",
"description": "Creates a new booking with the supplied parameters",
"operationId": "gcreateBooking",
"parameters": [
{
"in": "header",
"name": "Authorization",
"description": "Predefined API Key to authorize access",
"schema": {
"type": "string"
}
},
{
"in": "query",
"name": "api_key",
"description": "Predefined API Key to authorize access",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "card_uid",
"in": "query",
"description": "id of the RFID card scanned",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "geraet_id",
"in": "query",
"description": "id of the RFID reader scanning the card",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "check_in_out",
"in": "query",
"description": "booking Type",
"required": true,
"schema": {
"type": "integer",
"enum": [1, 2, 254]
}
}
],
"responses": {
"200": {
"description": "successfully created booking",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"counter_id": {
"type": "integer",
"format": "int64",
"example": 100
},
"card_uid": {
"type": "string",
"example": "test_card"
},
"geraet_id": {
"type": "string",
"example": "test_reader"
},
"check_in_out": {
"type": "integer",
"example": 1,
"enum": [1, 2, 254]
},
"timestamp": {
"type": "string",
"format": "date-time",
"example": "2024-09-05T08:51:12.670Z"
}
},
"xml": {
"name": "booking"
}
}
}
}
},
"401": {
"description": "none or wrong api key provided!"
},
"409": {
"description": "Same booking type as last booking"
}
}
}
},
"/logout": {
"get": {
"tags": ["booking"],
"summary": "Logs out all logged in users",
"description": "With this call all actively logged in users (last booking today has check_in_out=1) will be logged out automaticly (check_in_out=254)",
"operationId": "autoLogout",
"responses": {
"200": {
"description": "Succesful",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"card_uid": {
"type": "string",
"example": "test_card"
},
"name": {
"type": "string",
"example": "Mustermann"
},
"vorname": {
"type": "string",
"example": "Max"
},
"hauptbeschäftigungsort": {
"type": "integer",
"format": "int8",
"example": 1
}
}
}
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"BookingGrouped": {
"type": "object",
"properties": {
"day": {
"type": "string",
"format": "date"
},
"bookings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"counter_id": {
"type": "integer",
"format": "int64",
"example": 100
},
"card_uid": {
"type": "string",
"example": "test_card"
},
"geraet_id": {
"type": "string",
"example": "test_reader"
},
"check_in_out": {
"type": "integer",
"example": 1,
"enum": [1, 2, 254]
},
"timestamp": {
"type": "string",
"format": "date-time",
"example": "2024-09-05T08:51:12.670Z"
}
},
"xml": {
"name": "booking"
}
}
}
}
},
"Booking": {
"type": "object",
"properties": {
"counter_id": {
"type": "integer",
"format": "int64",
"example": 100
},
"card_uid": {
"type": "string",
"example": "test_card"
},
"geraet_id": {
"type": "string",
"example": "test_reader"
},
"check_in_out": {
"type": "integer",
"example": 1,
"enum": [1, 2, 254]
},
"timestamp": {
"type": "string",
"format": "date-time",
"example": "2024-09-05T08:51:12.670Z"
}
},
"xml": {
"name": "booking"
}
},
"User": {
"type": "object",
"properties": {
"card_uid": {
"type": "string",
"example": "test_card"
},
"name": {
"type": "string",
"example": "Mustermann"
},
"vorname": {
"type": "string",
"example": "Max"
},
"hauptbeschäftigungsort": {
"type": "integer",
"format": "int8",
"example": 1
}
}
}
}
}
}