Note: Unfortunatelly, The upload image function won't work on deployment server due to the Heroku's policy. If you want to test the image upload function you can run the server on localhost to test it
- Download Postman
- Open Postman and import shopify_challenge.postman_collection in the github folder to postman in order to generate collection.
- All the routes will be setuped and you can create your own data or using data that inside the mock_data.json in the github folder.
- Since the product is being deployed on the cloud you can go to the link below to test it. https://shopify-challenge-project-2022.herokuapp.com/api-docs/
Some helpful tips To make a request body in Postman following these steps: In body tab, select raw, change the text format to json format in the dropdown menu. To upload image on postman following these steps: In body tab, choose form-data, in key field type image and choose file. Click on Select File and chose the image that you want to upload.
Create store with name and location Name's store must be unique. Example
{
"name":"store_3",
"location":"houston"
}
Note: You must create a store first before create a product since every product need to have a store Example:
{
"name": "Fixflex4",
"company": "Jabbersphere",
"desc": "Proin at turpis a pede posuere nonummy. Integer non velit. Donec diam neque, vestibulum eget, vulputate ut, ultrices vel, augue. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec pharetra, magna vestibulum aliquet ultrices, erat tortor sollicitudin mi, sit amet lobortis sapien sapien non mi.",
"quantity": 481,
"price": 303.9,
"type": "clothes",
"store":[storeID_1,storeID_2]
Ex:"store":["61dfbc34d042a4d9e8c66aca","61dfbcb3d042a4d9e8c66acc","61dfbcbad042a4d9e8c66ace"]
}
To upload and link the image to product, you can provide productID in query. If you don't provide the productID, the request still works and it still returns the link of the image. Example: http://localhost:5000/api/v1/products/upload?productID={id}
To edit/remove product please pass in the product id in the url Example: https://shopify-challenge-project-2022.herokuapp.com/api/v1/products/{id}
Inside the body, you can provide the key and value you want to update. Example
{
"price":2000,
"desc":"this product is a abcxyz"
}
No need to pass anything when removing the product