Returns user token.
-
URL
/users/signin
-
Method:
POST
-
URL Params
Required:
-
Data Params
email=[string], password=[string]
-
Success Response:
- Code: 201
Content:{ token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImFyZGExQG1haWwuY29tIiwiaWQiOjEyLCJpYXQiOjE1ODMzMTE2MDZ9.t5qKOtXlnrfYQjovHZKRNkN8OtFWOARf2Mfoh18iXW0 }
- Code: 201
-
Error Response:
- Code: 400 BAD REQUEST
Content:{ wrong username/password }
- Code: 400 BAD REQUEST
Returns user token.
-
URL
/users/register
-
Method:
POST
-
URL Params
Required:
-
Data Params
email=[string], password=[string]
-
Success Response:
- Code: 201
Content:{ token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImFyZGExQG1haWwuY29tIiwiaWQiOjEyLCJpYXQiOjE1ODMzMTE2MDZ9.t5qKOtXlnrfYQjovHZKRNkN8OtFWOARf2Mfoh18iXW0 }
- Code: 201
-
Error Response:
-
Code: 400 BAD REQUEST
Content:name is required
OR
-
Code: 400 BAD REQUEST
Content:someone has signed up using this email
OR
-
Code: 400 BAD REQUEST
Content:invalid email format
OR
-
Code: 400 BAD REQUEST
Content:password should be at least 5 characters
OR
-
Code: 400 BAD REQUEST
Content:password is required
-
Returns user token.
-
URL
/admins/signin
-
Method:
POST
-
URL Params
Required:
-
Data Params
email=[string], password=[string]
-
Success Response:
- Code: 201
Content:{ token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImFyZGExQG1haWwuY29tIiwiaWQiOjEyLCJpYXQiOjE1ODMzMTE2MDZ9.t5qKOtXlnrfYQjovHZKRNkN8OtFWOARf2Mfoh18iXW0 }
- Code: 201
-
Error Response:
- Code: 400 BAD REQUEST
Content:wrong username/password
- Code: 400 BAD REQUEST
Returns details of product created
-
URL
/products
-
Method:
POST
-
URL Params
Required:
-
Headers Params
token=[string]
-
Data Params
name=[string], img_url=[string], price=[integer], stock=[integer]
-
Success Response:
- Code: 201
Content: { id: 1 name: 'akua', price: 9000, image_url: '', stock: 9 }
- Code: 201
-
Error Response:
-
Code: 400 BAD REQUEST
Content:name is required
OR
-
Code: 400 BAD REQUEST
Content:price must be higher than 0
OR
-
Code: 400 BAD REQUEST
Content:price is required
OR
- Code: 400 BAD REQUEST
Content:this email haven't been signed up
- Code: 400 BAD REQUEST
-
Returns lists of products
-
URL
/products
-
Method:
GET
-
URL Params
Required:
-
Headers Params
token=[string]
-
Data Params
-
Success Response:
- Code: 200
Content: { id: 1 name: 'akua', price: 9000, image_url: '', stock: 9 }
- Code: 200
-
Error Response:
- Code: 400 BAD REQUEST
Content:this email haven't been signed up
- Code: 400 BAD REQUEST
Delete product determined by product's id.
-
URL
/products/:id
-
Method:
DELETE
-
Headers Params
token=[string]
-
URL Params
id=[integer]
Required:
-
Data Params
-
Success Response:
- Code: 200
Content: [1, { id: 1 name: 'akua', price: 9000, image_url: '', stock: 9 }]
- Code: 200
-
Error Response:
- Code: 400 BAD REQUEST
Content:user unautorized
OR
- Code: 400 BAD REQUEST
Content:this email haven't been signed up
OR
- Code: 404 NOT FOUND
Content:cannot find product with spesific id
- Code: 400 BAD REQUEST
Edit product determined by product's id.
-
URL
/products/:id
-
Method:
PUT
-
Headers Params
token=[string]
-
URL Params
id=[integer], name=[string], img_url=[string], pric e=[integer], stock=[integer]
Required:
-
Data Params
-
Success Response:
- Code: 200
Content: { id: 1 name: 'akua', price: 9000, image_url: '', stock: 9 }
- Code: 200
-
Error Response:
-
Code: 400 BAD REQUEST
Content:user unautorized
OR
- Code: 400 BAD REQUEST
Content:this email haven't been signed up
OR
- Code: 404 NOT FOUND
Content:cannot find product with spesific id