Items¶
API endpoint for manage items.
Data management¶
/api/items
¶
-
GET
/storekeeper/api/items
¶ List items
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
Example request:
GET /storekeeper/api/items HTTP/1.1 Host: localhost:8000 Content-Type: application/json
Example response:
HTTP/1.0 200 OK Content-Type: application/json [ { "article_number": "SK132465", "id": 1, "location": "A12/12", "name": "Spray", "purchase_price": 60.4, "quantity": 0.0, "unit": { "id": 2, "unit": "pcs" }, "vendor": { "id": 1, "name": "Heavy Duty Ltd." }, "warning_quantity": 4.0 }, { "article_number": "FO213546", "id": 2, "location": "B02/01", "name": "Pipe", "purchase_price": 0.0, "quantity": 0.0, "unit": { "id": 1, "unit": "m" }, "vendor": { "id": 2, "name": "Star Shop Ltd." }, "warning_quantity": 0.0 } ]
-
POST
/storekeeper/api/items
¶ Create item
Status Codes: - 201 Created – no error
- 401 Unauthorized – user was not logged in
- 422 Unprocessable Entity – there is wrong type / missing field
Example request:
POST /storekeeper/api/items HTTP/1.1 Host: localhost:8000 Content-Type: application/json { "article_number": "sk132465", "location": "A12/12", "name": "Spray", "purchase_price": 60.4, "unit": { "id": 2, "unit": "pcs" }, "vendor": { "id": 1, "name": "Heavy Duty Ltd." }, "warning_quantity": 4.0 }
Example response:
HTTP/1.0 201 CREATED Content-Type: application/json { "article_number": "SK132465", "id": 1, "location": "A12/12", "name": "Spray", "purchase_price": 60.4, "quantity": 0.0, "unit": { "id": 2, "unit": "pcs" }, "vendor": { "id": 1, "name": "Heavy Duty Ltd." }, "warning_quantity": 4.0 }
/api/items/search
¶
-
GET
/storekeeper/api/items/search
¶ Search in items and barcodes
Parameters: - barcodes – Filter for master barcodes [0=False (default), 1=True]
- expression – Query string (search in barcode, item name, article number)
- items – Filter for items [0=False (default), 1=True]
- limit – Limit of result set [default: 6]
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
Example request:
GET /storekeeper/api/items/search?expression=sk&limit=6&barcodes=1&items=1 HTTP/1.1 Host: localhost:8000 Content-Type: application/json
Example response:
HTTP/1.0 200 OK Content-Type: application/json [ { "barcode": "SK586936", "item_id": 326, "quantity": 1, "type": "barcode" }, { "article_number": "SE180826", "item_id": 309, "name": "Skate", "type": "item", "vendor": "Import" } ]
/api/items/<id>
¶
-
GET
/storekeeper/api/items/
(int: id)¶ Get item
Parameters: - id – ID of selected item for get
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no item
Example request:
GET /storekeeper/api/items/1 HTTP/1.1 Host: localhost:8000 Content-Type: application/json
Example response:
HTTP/1.0 200 OK Content-Type: application/json { "article_number": "SK132465", "id": 1, "location": "A12/12", "name": "Spray", "purchase_price": 60.4, "quantity": 0.0, "unit": { "id": 2, "unit": "pcs" }, "vendor": { "id": 1, "name": "Heavy Duty Ltd." }, "warning_quantity": 4.0 }
-
PUT
/storekeeper/api/items/
(int: id)¶ Update item
Parameters: - id – ID of selected item for put
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no item
- 422 Unprocessable Entity – there is wrong type / missing field
Example request:
PUT /storekeeper/api/items/1 HTTP/1.1 Host: localhost:8000 Content-Type: application/json { "article_number": "sk132465", "location": "A12/12", "name": "Spray", "purchase_price": 60.4, "unit": { "id": 2, "unit": "pcs" }, "vendor": { "id": 1, "name": "Heavy Duty Ltd." }, "warning_quantity": 4.0 }
Example response:
HTTP/1.0 200 OK Content-Type: application/json { "article_number": "SK132465", "id": 1, "location": "A12/12", "name": "Spray", "purchase_price": 60.4, "quantity": 0.0, "unit": { "id": 2, "unit": "pcs" }, "vendor": { "id": 1, "name": "Heavy Duty Ltd." }, "warning_quantity": 4.0 }
-
DELETE
/storekeeper/api/items/
(int: id)¶ Delete item
Parameters: - id – ID of selected item for delete
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no item
Example request:
DELETE /storekeeper/api/items/1 HTTP/1.1 Host: localhost:8000 Content-Type: application/json
Example response:
HTTP/1.0 200 OK Content-Type: application/json null
/api/items/<id>/barcodes
¶
-
GET
/storekeeper/api/items/
(int: id)/barcodes
¶ List barcodes.
Parameters: - id – ID of item
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no item
Example request:
GET /storekeeper/api/items/1/barcodes HTTP/1.1 Host: localhost:8000 Content-Type: application/json
Example response:
HTTP/1.0 200 OK Content-Type: application/json [ { "barcode": "SKT01742", "id": 1, "main": true, "master": true, "quantity": 32.7 }, { "barcode": "9843-184125", "id": 2, "main": false, "master": false, "quantity": 1.5 } ]
-
POST
/storekeeper/api/items/
(int: id)/barcodes
¶ Create barcode (if missing
barcode
then server will generate one)Parameters: - id – ID of item
Status Codes: - 201 Created – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no item
- 422 Unprocessable Entity – there is wrong type / missing field / can not add one barcode twice / can not generate unique new barcode / can not set non-main barcode as master barcode / can not set more than one master barcode to an item
Example request:
POST /storekeeper/api/items/1/barcodes HTTP/1.1 Host: localhost:8000 Content-Type: application/json { "barcode": "SKT01742", "master": true, "quantity": 32.7 }
Example response:
HTTP/1.0 201 CREATED Content-Type: application/json { "barcode": "SKT01742", "id": 1, "main": true, "master": true, "quantity": 32.7 }
/api/items/<id>/barcodes/<id>
¶
-
GET
/storekeeper/api/items/
(int: item_id)/barcodes/
(int: id)¶ Get barcode
Parameters: - id – ID of selected barcode for get
- item_id – ID of item
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no barcode
Example request:
GET /storekeeper/api/items/1/barcodes/1 HTTP/1.1 Host: localhost:8000 Content-Type: application/json
Example response:
HTTP/1.0 200 OK Content-Type: application/json { "barcode": "SKT01742", "id": 1, "main": true, "master": true, "quantity": 32.7 }
-
PUT
/storekeeper/api/items/
(int: item_id)/barcodes/
(int: id)¶ Update barcode
Parameters: - id – ID of selected barcode for put
- item_id – ID of item
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no barcode
- 422 Unprocessable Entity – there is wrong type / missing field / can not add one barcode twice / can not set non-main barcode as master barcode / can not set more than one master barcode to an item
Example request:
PUT /storekeeper/api/items/1/barcodes/1 HTTP/1.1 Host: localhost:8000 Content-Type: application/json { "barcode": "SKT01742", "master": true, "quantity": 32.7 }
Example response:
HTTP/1.0 200 OK Content-Type: application/json { "barcode": "SKT01742", "id": 1, "main": true, "master": true, "quantity": 32.7 }
-
DELETE
/storekeeper/api/items/
(int: item_id)/barcodes/
(int: id)¶ Delete barcode
Parameters: - id – ID of selected barcode for delete
- item_id – ID of item
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no barcode
Example request:
DELETE /storekeeper/api/items/1/barcodes/1 HTTP/1.1 Host: localhost:8000 Content-Type: application/json
Example response:
HTTP/1.0 200 OK Content-Type: application/json null
Commands¶
/api/items/<id>/barcodes/<id>/print
¶
-
GET
/storekeeper/api/items/
(int: item_id)/barcodes/
(int: id)/print
¶ Generate barcode label to PDF with some details, and starts downloading that.
Parameters: - id – ID of selected barcode for get
- item_id – ID of item
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no barcode
Example request:
GET /storekeeper/api/items/1/barcodes/1/print HTTP/1.1 Host: localhost:8000 Content-Type: application/json
Example response:
HTTP/1.0 200 OK Content-Type: application/pdf Content-Disposition: attachment; filename=label__SK642031__4f0ff51c73703295643a325e55bc7ed2d94aa03d.pdf Content-Length: 11234 <file content>
-
PUT
/storekeeper/api/items/
(int: item_id)/barcodes/
(int: id)/print
¶ Print barcode label with some details
Parameters: - id – ID of selected barcode for get
- item_id – ID of item
Status Codes: - 200 OK – no error
- 400 Bad Request – missing pycups python3 module
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no barcode
- 422 Unprocessable Entity – there is wrong type / missing field
Example request:
PUT /storekeeper/api/items/1/barcodes/1/print HTTP/1.1 Host: localhost:8000 Content-Type: application/json { "copies": 3 }
Example response:
HTTP/1.0 200 OK Content-Type: application/json null