Skip to content

Curiouspaul1/shopify-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shopify-challenge

The following documentation describes the usage for a REST API built using flask.

API Documentation

Definitions

  • 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

Create Parcel

A POST endpoint that allows the client to create a new parcel

  • Path: <host_address>/admin/parcel

image

Edit 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.

image

Delete Parcel

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.

image

Fetch Single Parcel

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)

Fetch Parcels by page

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.

image

Create new shipment

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.

image

Update Shipment Status

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:

image


Example request

image


Add new category

Allows admin to add new parcel category

  • path: <hostname>/admin/category
  • method: POST

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages