{ "openapi": "3.0.2", "info": { "title": "Barcode Buddy", "version": "1.0.2", "description": "BarcodeBuddy API", "license": { "name": "GNU GPLv3", "url": "https://www.gnu.org/licenses/gpl.txt" } }, "paths": { "/system/info": { "get": { "tags": [ "system" ], "responses": { "200": { "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "object", "properties": { "version": { "type": "string" }, "version_int": { "type": "string" } } }, "result": { "type": "object", "properties": { "result": { "type": "string" }, "http_code": { "format": "int32", "type": "integer" } } } } }, "example": { "data": { "version": "1.4.1.1", "version_int": "1411" }, "result": { "result": "OK", "http_code": 200 } } } }, "description": "Response" } }, "security": [ { "apikey": [] } ], "summary": "Returns version number" } }, "/system/barcodes": { "get": { "tags": [ "system" ], "responses": { "200": { "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "object", "properties": { "BARCODE_C": { "type": "string" }, "BARCODE_CS": { "type": "string" }, "BARCODE_P": { "type": "string" }, "BARCODE_O": { "type": "string" }, "BARCODE_GS": { "type": "string" }, "BARCODE_Q": { "type": "string" }, "BARCODE_AS": { "type": "string" }, "BARCODE_CA": { "type": "string" } } }, "result": { "type": "object", "properties": { "result": { "type": "string" }, "http_code": { "format": "int32", "type": "integer" } } } }, "example": { "data": { "BARCODE_C": "BBUDDY-C", "BARCODE_CS": "BBUDDY-CS", "BARCODE_P": "BBUDDY-P", "BARCODE_O": "BBUDDY-O", "BARCODE_GS": "BBUDDY-I", "BARCODE_Q": "BBUDDY-Q-", "BARCODE_AS": "BBUDDY-AS", "BARCODE_CA": "BBUDDY-CA" }, "result": { "result": "OK", "http_code": 200 } } } } }, "description": "Response" } }, "security": [ { "apikey": [] } ], "summary": "Returns all special barcodes" } }, "/state/getmode": { "description": "STATE_CONSUME = 0;\nSTATE_CONSUME_SPOILED = 1;\nSTATE_PURCHASE = 2;\nSTATE_OPEN = 3;\nSTATE_GETSTOCK = 4;\nSTATE_ADD_SL = 5;", "get": { "tags": [ "state" ], "responses": { "200": { "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "object", "properties": { "mode": { "format": "int32", "type": "integer" } } }, "result": { "type": "object", "properties": { "result": { "type": "string" }, "http_code": { "format": "int32", "type": "integer" } } } }, "example": { "data": { "mode": 0 }, "result": { "result": "OK", "http_code": 200 } } } } }, "description": "STATE_CONSUME = 0; \nSTATE_CONSUME_SPOILED = 1; \nSTATE_PURCHASE = 2; \nSTATE_OPEN = 3;\nSTATE_GETSTOCK = 4; \nSTATE_ADD_SL = 5; \nSTATE_CONSUME_ALL = 6;" } }, "security": [ { "apikey": [] } ], "summary": "Returns current mode" } }, "/state/setmode": { "post": { "requestBody": { "content": { "application/x-www-form-urlencoded": { "schema": { "type": "object", "properties": { "state": { "description": "STATE_CONSUME = 0; \nSTATE_CONSUME_SPOILED = 1; \nSTATE_PURCHASE = 2; \nSTATE_OPEN = 3;\nSTATE_GETSTOCK = 4; \nSTATE_ADD_SL = 5; \nSTATE_CONSUME_ALL = 6;", "type": "integer" } }, "required": [ "state" ] }, "examples": { "Set_Consume": { "value": 0 } } } }, "required": true }, "tags": [ "state" ], "responses": { "200": { "description": "Mode set successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "string" }, "result": { "type": "object", "properties": { "result": { "type": "string" }, "http_code": { "format": "int32", "type": "integer" } } } }, "example": { "data": null, "result": { "result": "OK", "http_code": 200 } } } } } }, "400": { "description": "Error if invalid state int supplied", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "object" }, "result": { "type": "object", "properties": { "result": { "type": "string" }, "http_code": { "format": "int32", "type": "integer" } } } }, "example": { "data": null, "result": { "result": "Invalid state provided", "http_code": 400 } } } } } } }, "security": [ { "apikey": [] } ], "summary": "Sets current mode" } }, "/action/scan": { "post": { "tags": [ "action" ], "requestBody": { "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "barcode": { "type": "string" }, "price": { "type": "number" }, "bestBeforeInDays": { "type": "integer", "description": "The amount of days from today until the item expires" } }, "required": [ "barcode" ] }, "examples": { "Send_123456": { "value": "123456" } } } }, "required": true }, "responses": { "200": { "description": "Scan successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "object", "properties": { "result": { "type": "string" } } }, "result": { "type": "object", "properties": { "result": { "type": "string" }, "http_code": { "format": "int32", "type": "integer" } } } }, "example": { "data": { "result": "Unknown barcode looked up, found name: Olive Oil. Barcode: 123456789" }, "result": { "result": "OK", "http_code": 200 } } } } } }, "400": { "description": "Error if no barcode supplied", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "object" }, "result": { "type": "object", "properties": { "result": { "type": "string" }, "http_code": { "format": "int32", "type": "integer" } } } }, "example": { "data": null, "result": { "result": "No barcode supplied", "http_code": 400 } } } } } } }, "security": [ { "apikey": [] } ], "summary": "Passes a barcode to Barcode Buddy" } } }, "components": { "securitySchemes": { "apikey": { "type": "apiKey", "description": "API key provided by UI", "name": "BBUDDY-API-KEY", "in": "header" } } }, "security": [ { "apikey": [] } ], "tags": [ { "name": "system", "description": "" }, { "name": "action", "description": "" }, { "name": "state", "description": "" } ], "servers": [ { "url": "/api/", "description": "Target server" } ] }