Server based on the OpenAPI 3.1 specification. With the design first approach in mind! Improve the API in general and expose some of the new features in OAS3.
-
Stock represents the stock in the inventory. It has attributes such as stock ID, name, description, category, cost, selling price, and quantity.
-
Warehouse represents the locations where inventory stocks are stored or managed. It have attributes such as warehouse ID, name, address, description, capacity
-
Manager represents the person that manages a single warehouse.
-
Provider information about the providers(suppliers) whom products are purchased. It has attributes such as provider ID, name, contact information.
Collection Resource (/stocks) | |||||
---|---|---|---|---|---|
HTTP request (method URI) |
Operation | Description | HTTP status codes | Request sample | Respose sample |
GET /stocks | read | gets all stocks in the system |
200 (OK): The stocks was successfully acquired. 403 (Forbidden): The client doesn't have access to the stocks 404 (Not Found): Stocks not found. 410 (Gone): The stocks are no longer available 500 (Internal Server Error): The server encountered while processing the stocks. 504 (Timeout): Unable to process the stocks in time |
GET /stocks | HTTP/1.1 200 OK { [list of stocks] } |
GET /stocks/{id} | read | gets the stock with given id if exists. |
200 (OK): The stock was successfully acquired. 403 (Forbidden): The client doesn't have access to this stock 404 (Not Found): Stock with spicified id not found. 410 (Gone): The stock with spicified id are no longer available 500 (Internal Server Error): The server encountered while processing the stock. 504 (Timeout): Unable to process the spicified stock in time |
GET /stocks/1 | HTTP/1.1 200 OK { id: 1 name: “bag”, price: 4, ... ... } |
GET /stocksByTag/{tag} | read | gets all stocks with given tag |
200 (OK): The stocks with spicified tag were successfully acquired. 403 (Forbidden): The client doesn't have access to spicified stocks 404 (Not Found): Stocks with spicified tag not found. 410 (Gone): The stocks with spicified tag are no longer available 500 (Internal Server Error): The server encountered while processing the stocks. 504 (Timeout): Unable to process the spicified stocks in time |
GET /stocksByTag/reuseable | HTTP/1.1 200 OK { [list of stocks that has the reuseable] } |
GET /stocksByStatus/{status} | read | gets all stocks with given status |
200 (OK): The stocks with spicified status were successfully acquired. 403 (Forbidden): The client doesn't have access to spicified stocks 404 (Not Found): Stocks with spicified status not found. 410 (Gone): The stocks with spicified status are no longer available 500 (Internal Server Error): The server encountered an unexpected error while processing the stocks. 504 (Timeout): Unable to process the spicified stocks in time |
GET /stocksByStatus/available | HTTP/1.1 200 OK { [list of stocks that has the status available] } |
POST /stocks | add | add a new stocks to the system |
201 (Created): The stock was successfully created. 400 (Bad Request): Invaild stock data provided 401 (Unauthorized): The client is unauthorized. the stock was not created 409 (Conflict): The stock provided will conflict the resources on the server 415 (Unsupported Media Type): Content-type of the request is not supported by this server. 500 (Internal Server Error): The server encountered an unexpected error while creating the stock. |
POST /stocks { name: “new stock”, price: 4, ... ... } |
HTTP/1.1 201 Created { id: 2445 name: “new stock”, cost: 4, ... ... } |
PUT /stocks/{id} | update | update a stock |
200 (OK): The stock was successfully updated. 400 (Bad Request): Invalid stock id 401 (Unauthorized): The client is unauthorized. the stock was not updated 404 (Not Found): Stock not found. 409 (Conflict): The new stock data provided will conflict the resources on the server 500 (Internal Server Error): The server encountered an unexpected error while updating the stock. |
PUT /stocks/1 { name: “new name”, } |
HTTP/1.1 200 OK { id: 1 name: “new name”, price: 4, ... ... } |
DELETE /stocks/{id} | delete | deletes a stock from the system |
200 (OK): The stock was successfully deleted. 400 (Bad Request): Invalid stock id 401 (Unauthorized): The client is unauthorized. the stock was not deleted 403 (Forbidden): The client doesn't have access to spicified stock. Was unable to deleted 404 (Not Found): Stock not found. 500 (Internal Server Error): The server encountered an unexpected error while deleting the stock. |
DELETE /stocks/1 | HTTP/1.1 200 OK { message: "deleted" } |
Collection Resource (/warehouses) | |||||
---|---|---|---|---|---|
HTTP request (method URI) |
Operation | Description | HTTP status codes | Request sample | Respose sample |
GET /warehouses | read | gets all warehouses in the system |
200 (OK): The warehouses was successfully acquired. 403 (Forbidden): The client doesn't have access to the warehouses 404 (Not Found): Warehouses not found. 410 (Gone): The warehouses are no longer available 500 (Internal Server Error): The server encountered while processing the warehouses. 504 (Timeout): Unable to process the warehouses in time |
GET /warehouses | HTTP/1.1 200 OK { [list of warehouses] } |
POST /warehouses | add | add a new warehouse to the system |
201 (Created): The warehouse was successfully created. 400 (Bad Request): Invaild warehouse data provided 401 (Unauthorized): The client is unauthorized. the warehouse was not created 409 (Conflict): The warehouse provided will conflict the resources on the server 415 (Unsupported Media Type): Content-type of the request is not supported by this server. 500 (Internal Server Error): The server encountered an unexpected error while creating the warehouse. |
POST /warehouses { name: “new warehouse”, ... ... } |
HTTP/1.1 201 Created { id: 2445 name: “new warehouse”, ... ... } |
GET /warehouses/{id} | read | gets a single warehouse in the system |
200 (OK): The warehouse was successfully acquired. 403 (Forbidden): The client doesn't have access to this warehouse 404 (Not Found): Warehouse with spicified id not found. 410 (Gone): The warehouse with spicified id are no longer available 500 (Internal Server Error): The server encountered while processing the warehouse. 504 (Timeout): Unable to process the spicified warehouse in time |
GET /warehouses/1 | HTTP/1.1 200 OK { id: 1 name: “warehouse 1”, ... ... } |
GET /warehouses/{id}/stocks | read | Gets a all stocks in the given warehouse by id |
200 (OK): The stocks was successfully acquired. 403 (Forbidden): The client doesn't have access to the stocks 404 (Not Found): Stocks not found. 410 (Gone): The stocks are no longer available 500 (Internal Server Error): The server encountered while processing the stocks. 504 (Timeout): Unable to process the stocks in time |
GET /warehouses/1/stocks | HTTP/1.1 200 OK { [list of stocks] } |
PUT /warehouses/{id} | update | update a warehouse |
200 (OK): The warehouse was successfully updated. 400 (Bad Request): Invalid warehouse id 401 (Unauthorized): The client is unauthorized. the warehouse was not updated 404 (Not Found): Warehouse with spicified id not found. 409 (Conflict): The new warehouse data provided will conflict the resources on the server 500 (Internal Server Error): The server encountered an unexpected error while updating the warehouse. |
PUT /warehouses/1 { name: “new name”, } |
HTTP/1.1 200 OK { id: 1 name: “new name”, ... ... } |
DELETE /warehouses/{id} | delete | deletes a warehouse from the system |
200 (OK): The warehouse was successfully deleted. 400 (Bad Request): Invalid warehouse id 401 (Unauthorized): The client is unauthorized. the warehouse was not deleted 403 (Forbidden): The client doesn't have access to spicified warehouse. Was unable to deleted 404 (Not Found): warehouse with spicified id not found. 500 (Internal Server Error): The server encountered an unexpected error while deleting the warehouse. |
DELETE /warehouses/1 | HTTP/1.1 200 OK { message: "deleted" } |
Collection Resource (/managers) | |||||
---|---|---|---|---|---|
HTTP request (method URI) |
Operation | Description | HTTP status codes | Request sample | Respose sample |
GET /managers | read | gets all managers in the system |
200 (OK): The managers were successfully acquired. 403 (Forbidden): The client doesn't have access to the managers 404 (Not Found): Managers not found. 410 (Gone): The managers are no longer available 500 (Internal Server Error): The server encountered while processing the managers. 504 (Timeout): Unable to process the managers in time |
GET /managers | HTTP/1.1 200 OK { [list of managers] } |
GET /managers/{id} | read | gets a single manager in the system |
200 (OK): The manager was successfully acquired. 403 (Forbidden): The client doesn't have access to this manager 404 (Not Found): Manager with spicified id not found. 410 (Gone): The manager with spicified id are no longer available 500 (Internal Server Error): The server encountered while processing the manager. 504 (Timeout): Unable to process the spicified manager in time |
GET /managers/1 | HTTP/1.1 200 OK { id: “1”, name: “manager1”, ... ... } |
POST /managers | add | add a new manger to the system |
201 (Created): The manager was successfully created. 400 (Bad Request): Invaild manager data provided 401 (Unauthorized): The client is unauthorized. the manager was not created 409 (Conflict): The manager provided will conflict the resources on the server 415 (Unsupported Media Type): Content-type of the request is not supported by this server. 500 (Internal Server Error): The server encountered an unexpected error while creating the manager. |
POST /managers { name: “new manager”, ... ... } |
HTTP/1.1 201 Created { id: 2445 name: “new manager”, ... ... } |
PUT /managers/{id} | update | update a manager |
200 (OK): The manager was successfully updated. 400 (Bad Request): Invalid manager id 401 (Unauthorized): The client is unauthorized. the manager was not updated 404 (Not Found): Manager with spicified id not found. 409 (Conflict): The new manager data provided will conflict the resources on the server 500 (Internal Server Error): The server encountered an unexpected error while updating the manager. |
PUT /managers/1 { name: “new name”, } |
HTTP/1.1 200 OK { id: 1 name: “new name”, ... ... } |
DELETE /managers/{id} | delete | deletes a manager from the system |
200 (OK): The manager was successfully deleted. 400 (Bad Request): Invalid manager id 401 (Unauthorized): The client is unauthorized. the manager was not deleted 403 (Forbidden): The client doesn't have access to spicified manager. Was unable to deleted 404 (Not Found): Manager with spicified id not found. 500 (Internal Server Error): The server encountered an unexpected error while deleting the manager. |
DELETE /managers/1 | HTTP/1.1 200 OK { message: "deleted" } |
Collection Resource (/providers) | |||||
---|---|---|---|---|---|
HTTP request (method URI) |
Operation | Description | HTTP status codes | Request sample | Respose sample |
GET /providers | read | gets all providers in the system |
200 (OK): The providers were successfully acquired. 403 (Forbidden): The client doesn't have access to the providers 404 (Not Found): Providers not found. 410 (Gone): The providers are no longer available 500 (Internal Server Error): The server encountered while processing the providers. 504 (Timeout): Unable to process the providers in time |
GET /providers | HTTP/1.1 200 OK { [list of providers] } |
GET /providers/{id} | read | gets a single provider in the system |
200 (OK): The provider was successfully acquired. 403 (Forbidden): The client doesn't have access to this provider 404 (Not Found): Provider with spicified id not found. 410 (Gone): The provider with spicified id are no longer available 500 (Internal Server Error): The server encountered while processing the provider. 504 (Timeout): Unable to process the spicified provider in time |
GET /providers | HTTP/1.1 200 OK { [list of providers] } |
POST /providers | add | add a new provider to the system |
201 (Created): The provider was successfully created. 400 (Bad Request): Invaild data for the provider 401 (Unauthorized): The client is unauthorized. the provider was not created 409 (Conflict): The given provider will conflict the resources on the server 415 (Unsupported Media Type): Content-type of the request is not supported by this server. 500 (Internal Server Error): The server encountered an unexpected error while creating the provider. |
POST /providers { name: “new provider”, ... ... } |
HTTP/1.1 201 Created { id: 2445 name: “new provider”, ... ... } |
PUT /providers/{id} | update | update a provider |
200 (OK): The provider was successfully updated. 400 (Bad Request): Invalid provider id 401 (Unauthorized): The client is unauthorized. the provider was not updated 404 (Not Found): Provider with spicified id not found. 409 (Conflict): The new provider data will conflict the resources on the server 500 (Internal Server Error): The server encountered an unexpected error while updating the provider. |
PUT /providers/1 { name: “new name”, } |
HTTP/1.1 200 OK { id: 1 name: “new name”, ... ... } |
DELETE /providers/{id} | delete | deletes a providersfrom the system |
200 (OK): The provider was successfully deleted. 400 (Bad Request): Invalid provider id 401 (Unauthorized): The client is unauthorized. the provider was not deleted 403 (Forbidden): The client doesn't have access to spicified provider. Was unable to deleted 404 (Not Found): Provider with spicified id not found. 500 (Internal Server Error): The server encountered an unexpected error while deleting the provider. |
DELETE /providers/1 | HTTP/1.1 200 OK { message: "deleted" } |
You can access the specification by following the link Inventory Management System or head to 'inventory-management-system-openapi3_1.yaml' in this repo