Skip to content

Latest commit

 

History

History
202 lines (160 loc) · 5.67 KB

request.rest

File metadata and controls

202 lines (160 loc) · 5.67 KB

########USERS######USERS########USERS##############USERS######USERS########USERS###### ########USERS######USERS########USERS##############USERS######USERS########USERS###### ########USERS######USERS########USERS##############USERS######USERS########USERS###### @user_token=### @user_uuid=###

### get all the users GET http://localhost:3000/api/users Authorization: Bearer {{user_token}}

### get a specific user with uuid GET http://localhost:3000/api/users/{{user_uuid}} Authorization: Bearer {{user_token}}

### add a user POST http://localhost:3000/api/users Content-Type: application/json

{
"first_name": "Khalid", "last_name": "Mesbah", "password": "my_secret_password"

}

### update a user using put request PUT http://localhost:3000/api/users/{{user_uuid}} Authorization: Bearer {{user_token}} Content-Type: application/json

{
"first_name": "Loda", "last_name": "Sebaq", "password": "secret_password"

}

### update a user using patch request PATCH http://localhost:3000/api/users/{{user_uuid}} Authorization: Bearer {{user_token}} Content-Type: application/json

{
"first_name": "Khalid", "last_name": "Mesbah", "password": "password"

}

### authenticate a user GET http://localhost:3000/api/users/auth/{{user_uuid}} Content-Type: application/json

{
"password": "password"

}

### delete a user DELETE http://localhost:3000/api/users/{{user_uuid}} ############################ Authorization: Bearer {{user_token}}

########PRODUCTS######PRODUCTS########PRODUCTS##############PRODUCTS######PRODUCTS########PRODUCTS###### ########PRODUCTS######PRODUCTS########PRODUCTS##############PRODUCTS######PRODUCTS########PRODUCTS###### ########PRODUCTS######PRODUCTS########PRODUCTS##############PRODUCTS######PRODUCTS########PRODUCTS###### @product_uuid=### ### get all the products => index GET http://localhost:3000/api/products Authorization: Bearer {{user_token}}

### get a specific product with uuid => show GET http://localhost:3000/api/products/{{product_uuid}} Authorization: Bearer {{user_token}}

### get all products by category GET http://localhost:3000/api/products/indexByCategory/vegetables Authorization: Bearer {{user_token}}

### add a product POST http://localhost:3000/api/products Authorization: Bearer {{user_token}} Content-Type: application/json

{
"name": "apples", "price":115, "category":"fruits"

}

### update a product using put http request PUT http://localhost:3000/api/products/{{product_uuid}} Authorization: Bearer {{user_token}} Content-Type: application/json

{
"name": "bananas", "price":3421, "category":"vegetables"

}

### update a product using patch http request PATCH http://localhost:3000/api/products/{{product_uuid}} Authorization: Bearer {{user_token}} Content-Type: application/json

{
"name": "cucamber", "price":115, "category":"fruits"

}

### delete a product DELETE http://localhost:3000/api/products/{{product_uuid}} Authorization: Bearer {{user_token}}

########ORDERS######ORDERS########ORDERS##############ORDERS######ORDERS########ORDERS###### ########ORDERS######ORDERS########ORDERS##############ORDERS######ORDERS########ORDERS###### ########ORDERS######ORDERS########ORDERS##############ORDERS######ORDERS########ORDERS######

@order_uuid=### ### get all of the orders GET http://localhost:3000/api/orders Authorization: Bearer {{user_token}}

### get a specific order GET http://localhost:3000/api/orders/{{order_uuid}} Authorization: Bearer {{user_token}}

### create an order POST http://localhost:3000/api/orders Authorization: Bearer {{user_token}} Content-Type: application/json

{
"status": "active", "user_id_FK": "{{user_uuid}}"

}

### update a specific order using the patch http request PATCH http://localhost:3000/api/orders/{{order_uuid}} Authorization: Bearer {{user_token}} Content-Type: application/json

{
"status":"complete"

}

### update a specific order using the put http request PUT http://localhost:3000/api/orders/{{order_uuid}} Authorization: Bearer {{user_token}} Content-Type: application/json

{
"status":"active"

}

### add a product to a specific order POST http://localhost:3000/api/orders/{{order_uuid}}/products Authorization: Bearer {{user_token}} Content-Type: application/json

{
"quantity": 2222, "product_id_FK": "{{product_uuid}}"

}

### get all prodcuts of a specific order GET http://localhost:3000/api/orders/{{order_uuid}}/products Authorization: Bearer {{user_token}}

### delete a specific order DELETE http://localhost:3000/api/orders/{{order_uuid}} Authorization: Bearer {{user_token}}

########DASHBOARD######DASHBOARD########DASHBOARD##############DASHBOARD######DASHBOARD########DASHBOARD###### ########DASHBOARD######DASHBOARD########DASHBOARD##############DASHBOARD######DASHBOARD########DASHBOARD###### ########DASHBOARD######DASHBOARD########DASHBOARD##############DASHBOARD######DASHBOARD########DASHBOARD######

### get all products that have been included in orders GET http://localhost:3000/api/dashboard/getAllProductsInOrders Authorization: Bearer {{user_token}}

### get all users that have made orders GET http://localhost:3000/api/dashboard/getUsersWithOrders Authorization: Bearer {{user_token}}

### get the <number> most expensive products GET http://localhost:3000/api/dashboard/getMostExpProducts Authorization: Bearer {{user_token}} Content-Type: application/json

{
"limit":5

}

### get the most popular products GET http://localhost:3000/api/dashboard/getmostPopProducts Authorization: Bearer {{user_token}}

### get the current order by user GET http://localhost:3000/api/dashboard/getCurrentOrderByUser/{{user_uuid}} Authorization: Bearer {{user_token}}

### get the completed orders by user GET http://localhost:3000/api/dashboard/getCompletedOrdersByUser/{{user_uuid}} Authorization: Bearer {{user_token}}