-
URL
/v1/products
-
Method:
GET
-
Success Response:
- Code: 200
Content:[ { "id": 1, "category": { "name": "Nikon", "category_type": "point and shoot", "model": 2019 }, "description": "10x Zoom", "price": 123.34, "make": 2019 } ]
- Code: 200
-
URL
/v1/categories
-
Method:
GET
-
Success Response:
- Code: 200
Content:[ { "id": 1, "name": "Nikon", "category_type": "point and shoot", "model": 2019 } ]
- Code: 200
-
URL
/v1/products/:category
-
Method:
GET
-
Params
Required:
category=[string]
-
Success Response:
- Code: 200
Content:[ { "id": 1, "description": "10x zoom", "price": 120.23, "make": 2019 } ]
- Code: 200
-
URL
/v1/sessions
-
Method:
POST
-
Params
Required:
email=[string]
password=[string]
-
Success Response:
- Code: 200
Content:{ "email": "rubalps@gmail.com", "authentication_token": "nKsGzXPK2xawGzS7Vfc8" }
- Code: 200
-
Error Response:
- Code: 401 UNAUTHORIZED
-
Sample Data:
email=rubalps@gmail.com
password=12345678
-
URL
/v1/sessions
-
Method:
DELETE
-
Headers
X-User-Email=[string]
X-User-Token=[string]
-
Success Response:
- Code: 200
- Code: 200
-
Error Response:
- Code: 401 UNAUTHORIZED
-
Sample Data:
X-User-Email=rubalps@gmail.com
X-User-Token=7G_KvhxsoyZnHGNJNxsd
-
URL
/v1/cart/add/:product_id
-
Method:
GET
-
Params
Required:
product_id=[integer]
-
Headers
X-User-Email=[string]
X-User-Token=[string]
-
Success Response:
- Code: 200
Content:{ "product": { "id": 1, "name": "150D", "price": 123.34 }, "quantity": 4 }
- Code: 200
-
Error Response:
- Code: 401 UNAUTHORIZED
-
Sample Data:
X-User-Email=rubalps@gmail.com
X-User-Token=7G_KvhxsoyZnHGNJNxsd
-
URL
/v1/cart
-
Method:
GET
-
Headers
X-User-Email=[string]
X-User-Token=[string]
-
Success Response:
- Code: 200
Content:[ { "product": { "id": 2, "name": "100Z", "price": 130.2 }, "quantity": 1 }, { "product": { "id": 1, "name": "150D", "price": 123.34 }, "quantity": 3 } ]
- Code: 200
-
Error Response:
- Code: 401 UNAUTHORIZED
-
Sample Data:
X-User-Email=rubalps@gmail.com
X-User-Token=7G_KvhxsoyZnHGNJNxsd
-
Unit Testing for Category:
rake
Must pass all tests