Vendors¶
API endpoint for manage vendors.
Data management¶
/api/vendors
¶
-
GET
/storekeeper/api/vendors
¶ List vendors
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
Example request:
GET /storekeeper/api/vendors HTTP/1.1 Host: localhost:8000 Content-Type: application/json
Example response:
HTTP/1.0 200 OK Content-Type: application/json [ { "id": 1, "name": "Heavy Duty Ltd." }, { "id": 2, "name": "Star Shop Ltd." } ]
-
POST
/storekeeper/api/vendors
¶ Create vendor
Status Codes: - 201 Created – no error
- 401 Unauthorized – user was not logged in
- 422 Unprocessable Entity – {original} / vendor is already exist
Example request:
POST /storekeeper/api/vendors HTTP/1.1 Host: localhost:8000 Content-Type: application/json { "name": "Heavy Duty Ltd." }
Example response:
HTTP/1.0 201 CREATED Content-Type: application/json { "id": 1, "name": "Heavy Duty Ltd." }
/api/vendors/<id>
¶
-
GET
/storekeeper/api/vendors/
(int: id)¶ Get vendor
Parameters: - id – ID of selected vendor for get
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no vendor
Example request:
GET /storekeeper/api/vendors/1 HTTP/1.1 Host: localhost:8000 Content-Type: application/json
Example response:
HTTP/1.0 200 OK Content-Type: application/json { "id": 1, "name": "Heavy Duty Ltd." }
-
PUT
/storekeeper/api/vendors/
(int: id)¶ Update vendor
Parameters: - id – ID of selected vendor for put
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no vendor
- 422 Unprocessable Entity – {original} / vendor is already exist
Example request:
PUT /storekeeper/api/vendors/1 HTTP/1.1 Host: localhost:8000 Content-Type: application/json { "name": "new_foo" }
Example response:
HTTP/1.0 200 OK Content-Type: application/json { "id": 1, "name": "new_foo" }
-
DELETE
/storekeeper/api/vendors/
(int: id)¶ Delete vendor
Parameters: - id – ID of selected vendor for delete
Status Codes: - 200 OK – no error
- 401 Unauthorized – user was not logged in
- 404 Not Found – there is no vendor
Example request:
DELETE /storekeeper/api/vendors/1 HTTP/1.1 Host: localhost:8000 Content-Type: application/json
Example response:
HTTP/1.0 200 OK Content-Type: application/json null