Use the json file in this repo to set up the database.
-
URL
/products
-
Method:
GET
-
Query Params
Required:
There are no required URL params
Optional:
categories=[string]
- A comma seperated list of category strings
characters=[string]
- A comma seperated list of character stringsExample:
/products?categories=Aprons,Mugs&characters=Bubbles,Rex
-
Success Response:
- Code: 200
Content:
{ "message": "Successfully found products.", "data": [ { "id": "63a06c1f39e63776d2b2809f", "title": "It's All 0's and 1's to Me! Apron", "price": 24, "image": "https://binaryville.com/images/products/fred-0s1s-apron-black.jpg", "category": "Aprons", "character": "Fred" }, { "id": "63a06c1f39e63776d2b280a0", "title": "I Compute, Therefore I Am Apron", "price": 24, "image": "https://binaryville.com/images/products/dolores-compute-apron-black.jpg", "category": "Aprons", "character": "Dolores" } ] }
- Code: 200
-
Error Response:
-
Code: 400 BAD REQUEST
Content:{"message": "Unknown category", "data": []}
-
Code: 400 BAD REQUEST
Content:{"message": "Unknown character", "data": []}
-
Code: 500 SERVER ERROR
Content:{"message": "Unexpected error", "data": []}
-
-
URL
/products/{id}
-
Method:
GET
-
URL Params
Required:
There are no required URL params
Optional:
There are no optional URL params
Example:
/products/63a06c1f39e63776d2b280a0
-
Success Response:
- Code: 200
Content:
{ "message": "Successfully found product.", "data": { "id": "63a06c1f39e63776d2b2809f", "title": "I Compute, Therefore I Am Baseball Hat", "price": 29, "image": "https://binaryville.com/images/products/dolores-compute-baseballhat-black.jpg", "category": "Baseball Hats", "character": "Dolores", "description": "Cheer the team on in style with our unstructured, low crown, six-panel baseball cap made of 100% organic cotton twill. Featuring our original Binaryville artwork, screen-printed with PVC- and phthalate-free inks. Complete with matching, sewn eyelets, and adjustable fabric closure. ", "image2": "https://binaryville.com/images/products/dolores-compute-baseballhat-gray.jpg", "image3": "NULL" } }
- Code: 200
-
Error Response:
-
Code: 400 BAD REQUEST
Content:{"message": "Unknown product ID", "data": []}
-
Code: 500 SERVER ERROR
Content:{"message": "Unexpected error", "data": []}
-
-
URL
/products
-
Method:
POST
-
URL Params
Required:
There are no required URL params
Optional:
There are no optional URL params
-
Body Data
Must be sent as JSON with the correct headers
Required:
{ "title": "String", "price": Number, "image": "URL string", "category": "String", "character": "String", "description": "String" }
Optional:
{ "image2": "URL string"|null, "image3": "URL string"|null }
Example:
/products
-
Success Response:
- Code: 201 CREATED
Content:
{"message": "Successfully created product.", "data": [] }
- Code: 201 CREATED
-
Error Response:
-
Code: 400 BAD REQUEST
Content:{"message": "Invalid product data", "data": []}
-
Code: 500 SERVER ERROR
Content:{"message": "Unexpected error", "data": []}
-