The following documentation describes the usage for a REST API built using flask.
- Parcel: Resource in the database that represents a product that needs to be shipped by the logistics company
- Shipment: Resource used to represent a "shipment" made by the logistics company
- Category: Resource used to represent categories that producs (parcels) belong to
A POST endpoint that allows the client to create a new parcel
Path
:<host_address>/admin/parcel
A PATCH endpoint that allows the client to edit an existing parcel.
Path
:<host_address>/admin/parcel/<parcel_id>
- "<parcel_id>" This refers to a dynamic path, that's passed as part of the url when calling the API on that endpoint.
A DELETE endpoint that allows the client to delete an existing parcel.
Path
:<host_address>/admin/parcel/<parcel_id>
- "<parcel_id>" This refers to a dynamic path, that's passed as part of the url when calling the API on that endpoint.
This endpoint allows the client to fetch a single parcel item by its id, similar to the "delete" and "edit" endpoints the path also has a dynamic part where the client specifies the id of the parcel to be fetched.
Path
:<host_address>/admin/parcel/<parcel_id>
- "<parcel_id>" This refers to a dynamic path, that's passed as part of the url when calling the API on that endpoint.
![image](https://user-images.githubusercontent.com/45743339/168911345-44166691-d3d4-47a5-9ec8-648bb71282e1.png)
Here we can request for a list of all parcels in pages. Each page contains 10 parcels at most.
Path
:<host_address>/admin/parcel/<page_no>
- "<page_no>" This refers to a dynamic path, that's passed as part of the url when calling the API on that endpoint.
This enpoint is responsible for creating a new shipment, using the parcel id.
Path
:<host_address>/shipment/<parcel_id>
- "<parcel_id>": This refers to a dynamic path, that's passed as part of the url when calling the API on that endpoint.
This endpoint can be used to update a shipment's status and other information as needed, via a PATCH request
path
: `/shipment/<shipment_id>/<status_id>- "<shipment_id>": This refers to a dynamic path, that's passed as part of the url when calling the API on that endpoint.
- "<status_id>": This refers to a dynamic path, that's passed as part of the url when calling the API on that endpoint. This in particular is typically one of 3 numbers, where each one represents a distinct status as shown below:
Example request
Allows admin to add new parcel category
path
:<hostname>/admin/category
- method: POST