Acquisitions¶
API endpoint for manage acquisitions.
Data management¶
/api/acquisitions
¶
-
GET
/storekeeper/api/acquisitions
¶ List acquisitions
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
Example request:
GET /storekeeper/api/acquisitions HTTP/1.1 Host: localhost:8000 Content-Type: application/json
Example response:
HTTP/1.0 200 OK Content-Type: application/json [ { "comment": "Maybe missing some items", "id": 1, "timestamp": "2016-03-18T07:57:54.971876+00:00" }, { "comment": null, "id": 2, "timestamp": "2016-03-18T07:57:54.971967+00:00" } ]
-
POST
/storekeeper/api/acquisitions
¶ Create acquisition
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/acquisitions HTTP/1.1 Host: localhost:8000 Content-Type: application/json { "comment": "Maybe missing some items" }
Example response:
HTTP/1.0 201 CREATED Content-Type: application/json { "comment": "Maybe missing some items", "id": 1, "timestamp": "2016-03-18T07:57:54.971876+00:00" }
/api/acquisitions/<id>
¶
-
GET
/storekeeper/api/acquisitions/
(int: id)¶ Get acquisition
Parameters: - id – ID of selected acquisition for get
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no acquisition
Example request:
GET /storekeeper/api/acquisitions/1 HTTP/1.1 Host: localhost:8000 Content-Type: application/json
Example response:
HTTP/1.0 200 OK Content-Type: application/json { "comment": "Maybe missing some items", "id": 1, "timestamp": "2016-03-18T07:57:54.971876+00:00" }
-
PUT
/storekeeper/api/acquisitions/
(int: id)¶ Update acquisition
Parameters: - id – ID of selected acquisition for put
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no acquisition
- 422 Unprocessable Entity – there is wrong type / missing field
Example request:
PUT /storekeeper/api/acquisitions/1 HTTP/1.1 Host: localhost:8000 Content-Type: application/json { "comment": "A box has been damaged" }
Example response:
HTTP/1.0 200 OK Content-Type: application/json { "comment": "A box has been damaged", "id": 1, "timestamp": "2016-03-18T07:57:54.971876+00:00" }
-
DELETE
/storekeeper/api/acquisitions/
(int: id)¶ Delete acquisition
Parameters: - id – ID of selected acquisition for delete
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no acquisition
Example request:
DELETE /storekeeper/api/acquisitions/1 HTTP/1.1 Host: localhost:8000 Content-Type: application/json
Example response:
HTTP/1.0 200 OK Content-Type: application/json null
/api/acquisitions/<id>/items
¶
-
GET
/storekeeper/api/acquisitions/
(int: id)/items
¶ List acquisition items
Parameters: - id – ID of acquisition
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/acquisitions/1/items HTTP/1.1 Host: localhost:8000 Content-Type: application/json
Example response:
HTTP/1.0 200 OK Content-Type: application/json [ { "id": 1, "item": { "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 }, "quantity": 132.4 }, { "id": 2, "item": { "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 }, "quantity": 32.1 } ]
-
POST
/storekeeper/api/acquisitions/
(int: id)/items
¶ Create acquisition item
Parameters: - id – ID of acquisition
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 item twice
Example request:
POST /storekeeper/api/acquisitions/1/items HTTP/1.1 Host: localhost:8000 Content-Type: application/json { "item": { "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 }, "quantity": 132.4 }
Example response:
HTTP/1.0 201 CREATED Content-Type: application/json { "id": 1, "item": { "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 }, "quantity": 132.4 }
/api/acquisitions/<id>/items/<item_id>
¶
-
GET
/storekeeper/api/acquisitions/
(int: id)/items/
(int: item_id)¶ Get acquisition item
Parameters: - id – ID of acquisition
- item_id – ID of selected acquisition item for get
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no acquisition item
Example request:
GET /storekeeper/api/acquisitions/1/items/1 HTTP/1.1 Host: localhost:8000 Content-Type: application/json
Example response:
HTTP/1.0 200 OK Content-Type: application/json { "id": 1, "item": { "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 }, "quantity": 132.4 }
-
PUT
/storekeeper/api/acquisitions/
(int: id)/items/
(int: item_id)¶ Update acquisition item
Parameters: - id – ID of acquisition
- item_id – ID of selected acquisition item for get
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no acquisition item
- 422 Unprocessable Entity – there is wrong type / missing field / can not add one item twice
Example request:
PUT /storekeeper/api/acquisitions/1/items/1 HTTP/1.1 Host: localhost:8000 Content-Type: application/json { "item": { "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 }, "quantity": 132.4 }
Example response:
HTTP/1.0 200 OK Content-Type: application/json { "id": 1, "item": { "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 }, "quantity": 132.4 }
-
DELETE
/storekeeper/api/acquisitions/
(int: id)/items/
(int: item_id)¶ Delete acquisition item
Parameters: - id – ID of acquisition
- item_id – ID of selected acquisition item for get
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no acquisition item
Example request:
DELETE /storekeeper/api/acquisitions/1/items/1 HTTP/1.1 Host: localhost:8000 Content-Type: application/json
Example response:
HTTP/1.0 200 OK Content-Type: application/json null