E-Commerce
Returns json data.
-
URL
/register
-
Method:
POST
-
URL Params
Required:
None
-
Data Params
name=[string]
email=[string]
password=[string]
-
Success Response:
name = 'Arif Rachman Husen'' email = '[email protected]' password = '12345'
-
Code: 201 OK
Content:`{"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhcmlmIiwiaWF0IjoxNTgxNjY0NTgzfQ.mRMIr1EyfdKXrj86mPrQogjY5XQiL6VvWR-xi8UEYdw"}`
-
-
Error Response:
name = '' email = arif05rachman.com password = ''
- Code: 400 BadRequest
Content:{ "message": [ "User.password cannot be null", "Validation isEmail on email failed", "Validation notEmpty on name failed", ] }
OR
name = 'Arif Rachman Husen'' email = '[email protected]' password = '12345'
- Code: 409 Conflict
Content:{ "message": "Email already register" }
- Code: 400 BadRequest
-
Sample Call:
axios .post(`${process.env.BASE_URL}/register`,{ name:name ,username:username ,email:email ,password:password })
Returns json data.
-
URL
/login
-
Method:
POST
-
URL Params
Required:
None
-
Data Params
email=[string]
password=[string]
-
Success Response:
email = '[email protected]' password = '12345'
-
Code: 200 OK
Content:`{"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhcmlmIiwiaWF0IjoxNTgxNjY0NTgzfQ.mRMIr1EyfdKXrj86mPrQogjY5XQiL6VvWR-xi8UEYdw"}`
-
-
Error Response:
email = '' password = ''
- Code: 400 BadRequest
Content:{ "message": [ "User.password cannot be null", "Validation isEmail on email failed", ] }
OR
email = '[email protected]' password = 'qwerty'
- Code: 401 Unauthorize
Content:{ "message": "Email or Password wrong" }
OR
email = '[email protected]' password = '12345'
- Code: 404 Not Found
Content:{ "message": "User Not Found" }
- Code: 400 BadRequest
-
Sample Call:
axios .post(`${process.env.BASE_URL}/login`,{ email:email ,password:password })
Returns json data.
-
URL
/loginAdmin
-
Method:
POST
-
URL Params
Required:
None
-
Data Params
email=[string]
password=[string]
-
Success Response:
email = '[email protected]' password = '12345'
-
Code: 200 OK
Content:`{"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhcmlmIiwiaWF0IjoxNTgxNjY0NTgzfQ.mRMIr1EyfdKXrj86mPrQogjY5XQiL6VvWR-xi8UEYdw"}`
-
-
Error Response:
email = '' password = ''
- Code: 400 BadRequest
Content:{ "message": [ "User.password cannot be null", "Validation isEmail on email failed", ] }
OR
email = '[email protected]' password = 'qwerty'
- Code: 401 Unauthorize
Content:{ "message": "Email or Password wrong" }
OR
email = '[email protected]' password = '12345'
- Code: 404 Not Found
Content:{ "message": "User Not Found" }
- Code: 400 BadRequest
-
Sample Call:
axios .post(`${process.env.BASE_URL}/login`,{ email:email ,password:password })
Returns json data.
-
URL
/user
-
Method:
POST
-
URL Params
Required:
-
Header:
token : `<secretToken>`
-
Data Params
name=[string]
email=[string]
password=[string]
-
Success Response:
name = 'Arif Rachman Husen'' email = '[email protected]' password = '12345' admin = true
-
Code: 201 OK
Content:`{"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhcmlmIiwiaWF0IjoxNTgxNjY0NTgzfQ.mRMIr1EyfdKXrj86mPrQogjY5XQiL6VvWR-xi8UEYdw"}`
-
-
Error Response:
name = '' email = arif05rachman.com password = ''
- Code: 400 BadRequest
Content:{ "message": [ "User.password cannot be null", "Validation isEmail on email failed", "Validation notEmpty on name failed", "Validation notEmpty on username failed" ] }
OR
name = 'Arif Rachman Husen'' email = '[email protected]' password = '12345'
- Code: 409 Conflict
Content:{ "message": "Email already register" }
- Code: 400 BadRequest
-
Sample Call:
axios .post(`${process.env.BASE_URL}/user`,{ name:name ,email:email ,password:password })
Returns json data.
-
URL
/user
-
Method:
GET
-
URL Params
none
-
Data Body none
-
Success Response:
token : `<secretToken>`
- Code: 200 OK
Content:[ { "id": 3, "name": "Bob", "email": "[email protected]", "password": <hasedpassword>, "admin": true, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" },{ "id": 4, "name": "Jack", "email": "[email protected]", "password": <hasedpassword>, "AdministratorId": 1, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" } ]
- Code: 200 OK
-
Error Response:
token : ``
none
- Code: 400 BadRequest
Content:{ "message": "token require" }
- Code: 400 BadRequest
-
Sample Call:
axios .get(`${process.env.BASE_URL}/user`)
Returns json data.
-
URL
/user/id
-
Method:
GET
-
URL Params
`id:3
-
Header:
token : `<secretToken>`
-
Data Body
none
-
Success Response:
token : `<secretToken>`
- Code: 200 OK
Content:{ "id": 3, "name": "Carrier", "email": [email protected], "password": 30, "admin": true, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" }
- Code: 200 OK
-
Error Response:
token : ``
none
- Code: 404 BadRequest
Content:{ "message": "token require" }
- Code: 404 BadRequest
OR
-
Error Response:
token : `<secretToken>`
none
- Code: 404 NotFound
Content:{ "message": "Data Not Found" }
- Code: 404 NotFound
-
Sample Call:
axios .get(`${process.env.BASE_URL}/user/id`)
Returns json data.
-
URL
/user/id
-
Method:
PUT
-
URL Params
`id:[integer]`
-
Header:
token : `<secretToken>`
-
Data Body
`name=[string]` `email=[string]` `password=[string]`
-
Success Response:
id : `3`
token : `<secretToken>`
id : 3 name: Carrier, email: [email protected], password: password
- Code: 200 OK
Content:{ "id": 3, "name": "Carrier", "email": [email protected], "password": <hasedpassword>, "admin": true, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" }
- Code: 200 OK
-
Error Response:
id : `3`
token : `<secretToken>`
name: , email: [email protected], password: password
- Code: 400 BadRequest
Content:{ "message": [ "Validation notEmpty on name failed", ] }
- Code: 400 BadRequest
OR
-
Error Response:
id : `3`
token : ``
name: name, email: [email protected], password: password
- Code: 400 BadRequest
Content:{ "message": "token require" }
- Code: 400 BadRequest
OR
-
Error Response:
id : `90`
token : `<secretToken>`
name: name, email: [email protected], password: password
- Code: 404 NotFound
Content:{ "message": "Data Not Found" }
- Code: 404 NotFound
-
Sample Call:
axios .put(`${process.env.BASE_URL}/user/id`,{ name:name ,email: email@email.com ,password:"12345" })
Returns json data.
-
URL
/user/id
-
Method:
DELETE
-
URL Params
`id:[integer]`
-
Header:
token : `<secretToken>`
-
Data Body
-
Success Response:
id : `3`
token : `<secretToken>`
none
- Code: 200 OK
Content:data succes delete
- Code: 200 OK
-
Error Response:
id : `3`
token : ``
none
- Code: 400 BadRequest
Content:{ "message": "token require" }
- Code: 400 BadRequest
OR
-
Error Response:
id : `90`
token : `<secretToken>`
none
- Code: 404 NotFound
Content:{ "message": "Data Not Found" }
- Code: 404 NotFound
-
Sample Call:
axios .delete(`${process.env.BASE_URL}/user/id`,{ name:name ,email:email@email.com ,password:<hassedpassword> })
Returns json data.
-
URL
/products
-
Method:
POST
-
URL Params
none
-
Header:
token : `<secretToken>`
-
Data Body
`name=[string]` `image_url=[string]` `price=[integer]` `stock=[integer]`
-
Success Response:
token : `<secretToken>`
name: Carrier, image_url: http://localhost:3000/assets/image/product.jpg, price: 200000, stock: 30
- Code: 200 OK
Content:{ "id": 3, "name": "Carrier", "image_url": "http://localhost:3000/assets/image/product.jpg", "price": 200000, "stock": 30, "AdministratorId": 1, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" }
- Code: 200 OK
-
Error Response:
token : `<secretToken>`
name: , image_url: http://localhost:3000/assets/image/product.txt, price: -200000, stock: '30'
- Code: 400 BadRequest
Content:{ "message": [ "Validation notEmpty on name failed", "Validation imageExtention on image_url failed", "Validation notNegativeValue on price failed", "Validation isNumber on stock failed" ] }
- Code: 400 BadRequest
OR
-
Error Response:
token : ``
name: Carrier, image_url: http://localhost:3000/assets/image/product.jpg, price: 200000, stock: 30
- Code: 400 BadRequest
Content:{ "message": "token require" }
- Code: 400 BadRequest
-
Sample Call:
axios .post(`${process.env.BASE_URL}/products`,{ name:name ,image_url:image_url ,price:200000 ,stock:30 })
Returns json data.
-
URL
/products
-
Method:
GET
-
URL Params
none
Header:
token : `<secretToken>`
-
Data Body none
-
Success Response:
token : `<secretToken>`
- Code: 200 OK
Content:[ { "id": 3, "name": "Carrier", "image_url": "http://localhost:3000/assets/image/product.jpg", "price": 200000, "stock": 30, "AdministratorId": 1, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" },{ "id": 4, "name": "Boots", "image_url": "http://localhost:3000/assets/image/product2.jpg", "price": 100000, "stock": 20, "AdministratorId": 1, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" } ]
- Code: 200 OK
-
Error Response:
token : ``
none
- Code: 400 BadRequest
Content:{ "message": "token require" }
- Code: 400 BadRequest
-
Sample Call:
axios .get(`${process.env.BASE_URL}/products`)
Returns json data.
-
URL
/products/id
-
Method:
GET
-
URL Params
`id:3
-
Header:
token : `<secretToken>`
-
Data Body
none
-
Success Response:
token : `<secretToken>`
- Code: 200 OK
Content:{ "id": 3, "name": "Carrier", "image_url": "http://localhost:3000/assets/image/product.jpg", "price": 200000, "stock": 30, "AdministratorId": 1, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" }
- Code: 200 OK
-
Error Response:
token : ``
none
- Code: 404 BadRequest
Content:{ "message": "token require" }
- Code: 404 BadRequest
OR
-
Error Response:
token : `<secretToken>`
none
- Code: 404 NotFound
Content:{ "message": "Data Not Found" }
- Code: 404 NotFound
-
Sample Call:
axios .get(`${process.env.BASE_URL}/products/id`)
Returns json data.
-
URL
/products/id
-
Method:
PUT
-
URL Params
`id:[integer]`
-
Header:
token : `<secretToken>`
-
Data Body
`name=[string]` `image_url=[string]` `price=[integer]` `stock=[integer]`
-
Success Response:
id : `3`
token : `<secretToken>`
id : 3 name: Carrier, image_url: http://localhost:3000/assets/image/product.jpg, price: 200000, stock: 30
- Code: 200 OK
Content:{ "id": 3, "name": "Carrier", "image_url": "http://localhost:3000/assets/image/product.jpg", "price": 200000, "stock": 30, "AdministratorId": 1, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" }
- Code: 200 OK
-
Error Response:
id : `3`
token : `<secretToken>`
name: , image_url: http://localhost:3000/assets/image/product.txt, price: -200000, stock: '30'
- Code: 400 BadRequest
Content:{ "message": [ "Validation notEmpty on name failed", "Validation imageExtention on image_url failed", "Validation notNegativeValue on price failed", "Validation isNumber on stock failed" ] }
- Code: 400 BadRequest
OR
-
Error Response:
id : `3`
token : ``
name: Carrier, image_url: http://localhost:3000/assets/image/product.jpg, price: 200000, stock: 30
- Code: 400 BadRequest
Content:{ "message": "token require" }
- Code: 400 BadRequest
OR
-
Error Response:
id : `90`
token : `<secretToken>`
name: Carrier, image_url: http://localhost:3000/assets/image/product.jpg, price: 200000, stock: 30
- Code: 404 NotFound
Content:{ "message": "Data Not Found" }
- Code: 404 NotFound
-
Sample Call:
axios .put(`${process.env.BASE_URL}/products/id`,{ name:name ,image_url:image_url ,price:200000 ,stock:30 })
Returns json data.
-
URL
/products/id
-
Method:
DELETE
-
URL Params
`id:[integer]`
-
Header:
token : `<secretToken>`
-
Data Body
`name=[string]` `image_url=[string]` `price=[integer]` `stock=[integer]`
-
Success Response:
id : `3`
token : `<secretToken>`
none
- Code: 200 OK
Content:[ 1 , { "id": 3, "name": "Carrier", "image_url": "http://localhost:3000/assets/image/product.jpg", "price": 200000, "stock": 30, "AdministratorId": 1, "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" }]
- Code: 200 OK
-
Error Response:
id : `3`
token : ``
none
- Code: 400 BadRequest
Content:{ "message": "token require" }
- Code: 400 BadRequest
OR
-
Error Response:
id : `90`
token : `<secretToken>`
none
- Code: 404 NotFound
Content:{ "message": "Data Not Found" }
- Code: 404 NotFound
-
Sample Call:
axios .delete(`${process.env.BASE_URL}/products/id`,{ name:name ,image_url:image_url ,price:200000 ,stock:30 })
Returns json data.
-
URL
/categories
-
Method:
POST
-
URL Params
Required:
-
Header:
token : `<secretToken>`
-
Data Params
name=[string]
-
Success Response:
name = 'adnventure''
-
Code: 201 OK
Content:`{ "id": 3, "name": "Action", "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" }`
-
-
Error Response:
name = ''
- Code: 400 BadRequest
Content:{ "message": [ "Validation notEmpty on name failed", ] }
- Code: 400 BadRequest
-
Sample Call:
axios .post(`${process.env.BASE_URL}/categories`,{ name:name })
Returns json data.
-
URL
/categories
-
Method:
GET
-
URL Params
none
-
Data Body none
-
Success Response:
token : `<secretToken>`
- Code: 200 OK
Content:[ { "id": 3, "name": "Action", "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" },{ "id": 4, "name": "Adventure", "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" } ]
- Code: 200 OK
-
Error Response:
token : ``
none
- Code: 400 BadRequest
Content:{ "message": "token require" }
- Code: 400 BadRequest
-
Sample Call:
axios .get(`${process.env.BASE_URL}/categories`)
Returns json data.
-
URL
/categories/id
-
Method:
GET
-
URL Params
`id:3
-
Header:
token : `<secretToken>`
-
Data Body
none
-
Success Response:
token : `<secretToken>`
- Code: 200 OK
Content:{ "id": 3, "name": "Carrier", "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" }
- Code: 200 OK
-
Error Response:
token : ``
none
- Code: 404 BadRequest
Content:{ "message": "token require" }
- Code: 404 BadRequest
OR
-
Error Response:
token : `<secretToken>`
none
- Code: 404 NotFound
Content:{ "message": "Data Not Found" }
- Code: 404 NotFound
-
Sample Call:
axios .get(`${process.env.BASE_URL}/categories/id`)
Returns json data.
-
URL
/categories/id
-
Method:
PUT
-
URL Params
`id:[integer]`
-
Header:
token : `<secretToken>`
-
Data Body
`name=[string]`
-
Success Response:
id : `3`
token : `<secretToken>`
id : 3 name: Adventure,
- Code: 200 OK
Content:{ "id": 3, "name": "Adventure", "updatedAt": "2020-02-14T15:37:46.848Z", "createdAt": "2020-02-14T15:37:46.848Z" }
- Code: 200 OK
-
Error Response:
id : `3`
token : `<secretToken>`
name: ,
- Code: 400 BadRequest
Content:{ "message": [ "Validation notEmpty on name failed", ] }
- Code: 400 BadRequest
OR
-
Error Response:
id : `3`
token : ``
name: name,
- Code: 400 BadRequest
Content:{ "message": "token require" }
- Code: 400 BadRequest
OR
-
Error Response:
id : `90`
token : `<secretToken>`
name: name,
- Code: 404 NotFound
Content:{ "message": "Data Not Found" }
- Code: 404 NotFound
-
Sample Call:
axios .put(`${process.env.BASE_URL}/categories/id`,{ name:name })
Returns json data.
-
URL
/categories/id
-
Method:
DELETE
-
URL Params
`id:[integer]`
-
Header:
token : `<secretToken>`
-
Data Body
-
Success Response:
id : `3`
token : `<secretToken>`
none
- Code: 200 OK
Content:data succes delete
- Code: 200 OK
-
Error Response:
id : `3`
token : ``
none
- Code: 400 BadRequest
Content:{ "message": "token require" }
- Code: 400 BadRequest
OR
-
Error Response:
id : `90`
token : `<secretToken>`
none
- Code: 404 NotFound
Content:{ "message": "Data Not Found" }
- Code: 404 NotFound
-
Sample Call:
axios .delete(`${process.env.BASE_URL}/categories/id`,{ name:name })
Returns json data.
-
URL
/carts
-
Method:
POST
-
URL Params
Required:
-
Header:
token : `<secretToken>`
-
Data Params
ProductId=[string]
-
Success Response:
ProductId = 'adnventure''
-
Code: 201 OK
Content:`{ "id": 1, "ProductId": "1", "UserId": "1", "quantity": "1", "updatedAt": "2020-03-14T15:37:46.848Z", "createdAt": "2020-03-14T15:37:46.848Z" }`
-
-
Error Response:
ProductId = ''
- Code: 400 BadRequest
Content:{ "message": [ "Validation notEmpty on ProductId failed", ] }
- Code: 400 BadRequest
-
Sample Call:
axios .post(`${process.env.BASE_URL}/carts`,{ ProductId:ProductId })
Returns json data.
-
URL
/carts
-
Method:
GET
-
URL Params
none
-
Data Body none
-
Success Response:
token : `<secretToken>`
- Code: 200 OK
Content:[ { "id": 7, "UserId": 2, "ProductId": 1, "quantity": 1, "createdAt": "2020-03-26T16:12:54.903Z", "updatedAt": "2020-03-26T16:12:54.903Z", "Product": { "id": 1, "name": "product 1", "CategoryId": 1, "image_url": "string", "price": 1, "stock": 16, "description": "string", "createdAt": "2020-03-26T02:29:26.706Z", "updatedAt": "2020-03-26T02:33:50.374Z" } } ]
- Code: 200 OK
-
Error Response:
token : ``
none
- Code: 400 BadRequest
Content:{ "message": "token require" }
- Code: 400 BadRequest
-
Sample Call:
axios .get(`${process.env.BASE_URL}/carts`)
Returns json data.
-
URL
/carts/id
-
Method:
GET
-
URL Params
`id:7
-
Header:
token : `<secretToken>`
-
Data Body
none
-
Success Response:
token : `<secretToken>`
- Code: 200 OK
Content:{ "id": 7, "UserId": 2, "ProductId": 1, "quantity": 1, "createdAt": "2020-03-26T16:12:54.903Z", "updatedAt": "2020-03-26T16:12:54.903Z", "Product": { "id": 1, "name": "product 1", "CategoryId": 1, "image_url": "string", "price": 1, "stock": 16, "description": "string", "createdAt": "2020-03-26T02:29:26.706Z", "updatedAt": "2020-03-26T02:33:50.374Z" } }
- Code: 200 OK
-
Error Response:
token : ``
none
- Code: 404 BadRequest
Content:{ "message": "token require" }
- Code: 404 BadRequest
OR
-
Error Response:
token : `<secretToken>`
none
- Code: 404 NotFound
Content:{ "message": "Data Not Found" }
- Code: 404 NotFound
-
Sample Call:
axios .get(`${process.env.BASE_URL}/carts/id`)
Returns json data.
-
URL
/carts/id
-
Method:
PATCH
-
URL Params
`id:[integer]`
-
Header:
token : `<secretToken>`
-
Data Body
`quantity=[integer]`
-
Success Response:
id : `7`
token : `<secretToken>`
id : 3 ProductId: Adventure,
- Code: 200 OK
Content:{ "id": 7, "UserId": 2, "ProductId": 1, "quantity": 3, "createdAt": "2020-03-26T16:12:54.903Z", "updatedAt": "2020-03-26T16:15:43.628Z" }
- Code: 200 OK
-
Error Response:
id : `7`
token : `<secretToken>`
quantity: ,
- Code: 400 BadRequest
Content:{ "message": [ "Validation notEmpty on quantity failed", ] }
- Code: 400 BadRequest
OR
-
Error Response:
id : `7`
token : `<secretToken>`
quantity: 0,
- Code: 400 BadRequest
Content:{ "message": [ "Validation min on quantity failed", ] }
- Code: 400 BadRequest
OR
-
Error Response:
id : `3`
token : ``
quantity: 2,
- Code: 400 BadRequest
Content:{ "message": "token require" }
- Code: 400 BadRequest
OR
-
Error Response:
id : `90`
token : `<secretToken>`
ProductId: ProductId,
- Code: 404 NotFound
Content:{ "message": "Data Not Found" }
- Code: 404 NotFound
-
Sample Call:
axios .put(`${process.env.BASE_URL}/carts/id`,{ ProductId:ProductId })
Returns json data.
-
URL
/carts/id
-
Method:
DELETE
-
URL Params
`id:[integer]`
-
Header:
token : `<secretToken>`
-
Data Body
-
Success Response:
id : `3`
token : `<secretToken>`
none
- Code: 200 OK
Content:data succes delete
- Code: 200 OK
-
Error Response:
id : `3`
token : ``
none
- Code: 400 BadRequest
Content:{ "message": "token require" }
- Code: 400 BadRequest
OR
-
Error Response:
id : `90`
token : `<secretToken>`
none
- Code: 404 NotFound
Content:{ "message": "Data Not Found" }
- Code: 404 NotFound
-
Sample Call:
axios .delete(`${process.env.BASE_URL}/carts/id`,{ ProductId:ProductId })