https://ranjan-food-order.herokuapp.com
The URL is only for making API requests.
Creates a new user/customer account.
-
URL
/users -
METHOD
POST -
DATA PARAMS
- REQUIRED:
name=[String]
email=[String]
roll=[String]
password=[String]
- REQUIRED:
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
{ "user": { "_id": "612776587eb003001548428e", "name": "Pratyush Ranjan", "email": "[email protected]", "roll": "imt2019000", "__v": 1 }, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MTI3NzY1ODdlYjAwMzAwMTU0ODQyOGUiLCJpYXQiOjE2Mjk5NzYxNTIsImV4cCI6MTYzMDU4MDk1Mn0.6WrlgR-wnrqh2pAHTY5tgdvLHl9JKY1xktfb0rh_LBU" }
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE:
Logs in an existing user.
-
URL
/users/login -
METHOD
POST -
DATA PARAMS
- REQUIRED:
email=[String]
password=[String]
- REQUIRED:
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
{ "user": { "_id": "60fe5f0366d658001515f875", "name": "Pratyush", "email": "[email protected]", "roll": "imt2019065", "__v": 3 }, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MGZlNWYwMzY2ZDY1ODAwMTUxNWY4NzUiLCJpYXQiOjE2Mjk5NzY5MDAsImV4cCI6MTYzMDU4MTcwMH0.RARaL0czG1lfO3r1s5saNo4m8gXqB2S1sTK8gdVGsAg" }
- CODE:
-
ERROR RESPONSE
- CODE:
400 - CONTENT:
{ error: [Object] }
- CODE:
Logs out the user from the current device.
-
URL
/users/logout -
METHOD
POST -
AUTHORIZATION
- User Authentication
Bearer Authentication Token
- User Authentication
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
{ "message": "Logged out" }
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE:
Logs out the user from all device from which he/she had logged in.
-
URL
/users/logoutAll -
METHOD
POST -
AUTHORIZATION
- User Authentication
Bearer Authentication Token
- User Authentication
-
SUCCESS RESPONSE
- CODE:
200
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE:
Fetches the details of the user currently logged in.
-
URL
/users/me -
METHOD
GET -
AUTHORIZATION
- User Authentication
Bearer Authentication Token
- User Authentication
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
{ "_id": "60fe5f0366d658001515f875", "name": "Pratyush", "email": "[email protected]", "roll": "imt2019065", "__v": 7 }
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE:
Deletes the user currently logged in.
-
URL
/users/me -
METHOD
DELETE -
AUTHORIZATION
- User Authentication
Bearer Authentication Token
- User Authentication
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
{ "_id": "60fe5f0366d658001515f875", "name": "Pratyush", "email": "[email protected]", "roll": "imt2019065", "__v": 7 }
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE:
Updates the modifiable user account parameters.
-
URL
/users/me -
METHOD
PATCH -
AUTHORIZATION
- User Authentication
Bearer Authentication Token
- User Authentication
-
DATA PARAMS
-
ALLOWED:
name=[String]
email=[String]
roll=[String]
password=[String] -
RESTRICTED:
tokens=[{token}]
-
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
{ "message": "Updated successfully" }
- CODE:
-
ERROR RESPONSE
- CODE:
400 - CONTENT:
{ error: [Object] }
- CODE:
Creates a new admin account. Only one admin account can be created. Only if the present admin is removed, can the next admin be created.
-
URL
/admin -
METHOD
POST -
DATA PARAMS
- REQUIRED:
name=[String]
email=[String]
password=[String]
- REQUIRED:
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
{ "admin": { "_id": "612776587eb003001548428e", "name": "Admin", "email": "[email protected]", "password": "adminiiitb", "__v": 1 }, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MTI3NzY1ODdlYjAwMzAwMTU0ODQyOGUiLCJpYXQiOjE2Mjk5NzYxNTIsImV4cCI6MTYzMDU4MDk1Mn0.6WrlgR-wnrqh2pAHTY5tgdvLHl9JKY1xktfb0rh_LBU" }
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE:
Logs in the existing admin.
-
URL
/admin/login -
METHOD
POST -
DATA PARAMS
- REQUIRED:
email=[String]
password=[String]
- REQUIRED:
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
{ "admin": { "_id": "60fe9b235ef7790015164c5d", "name": "Admin", "email": "[email protected]", "__v": 5 }, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MGZlOWIyMzVlZjc3OTAwMTUxNjRjNWQiLCJpYXQiOjE2Mjk5ODM5ODgsImV4cCI6MTYzMDU4ODc4OH0.spwvTMoENa3vk4FYx71a-hm20UaW7UCqq0gM96Mcme8" }
- CODE:
-
ERROR RESPONSE
- CODE:
400 - CONTENT:
{ error: [Object] }
- CODE:
Logs out the admin from the current device.
-
URL
/admin/logout -
METHOD
POST -
AUTHORIZATION
- Admin Authentication
Bearer Authentication Token
- Admin Authentication
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
{ "message": "Logged out" }
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE:
Logs out the admin from all device from which he/she had logged in.
-
URL
/admin/logoutAll -
METHOD
POST -
AUTHORIZATION
- Admin Authentication
Bearer Authentication Token
- Admin Authentication
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
{message: 'Logged out from all devices'}
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE:
Updates the modifiable admin account parameters.
-
URL
/admin/current -
METHOD
PATCH -
AUTHORIZATION
- Admin Authentication
Bearer Authentication Token
- Admin Authentication
-
DATA PARAMS
-
ALLOWED:
name=[String]
email=[String]
password=[String] -
RESTRICTED:
tokens=[{token}]
-
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
{ "message": "Details updated successfully" }
- CODE:
-
ERROR RESPONSE
- CODE:
400 - CONTENT:
{ error: [Object] }
- CODE:
Adds a new food item to the database.
-
URL
/food -
METHOD
POST -
AUTHORIZATION
- Admin Authentication
Bearer Authentication Token
- Admin Authentication
-
DATA PARAMS
-
REQUIRED:
name=[String]
price=[String]
availability=[Boolean] -
OPTIONAL:
discount=[Number]
stock=[Number]
-
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
{ "message": "Food successfully added" }
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE:
Fetches the food details of a particular food.
-
URL
/food/:id -
METHOD
GET -
URL PARAMS
- REQUIRED:
id=[mongoose.Schema.Types.ObjectId]
- REQUIRED:
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
{ "_id": "612798386ad0390015574a0a", "name": "Dosa", "price": 50, "availability": true, "stars": 5, "description": "Medium-sized dosa. Serves 1.", "discount": 10, "__v": 0 }
- CODE:
-
ERROR RESPONSE
- CODE:
404 - CONTENT:
{ error: [Object] }
- CODE:
Fetches multiple foods according to filters provided(if any). Pagination supported through limit and skip as query parameters.
-
URL
/food -
METHOD
GET -
URL PARAMS
- OPTIONAL:
limit:[Integer]
skip:[Integer]
- OPTIONAL:
-
BODY PARAMS
- OPTIONAL:
name:[String]
price:[Number]
discount:[Number]
availability:[Boolean]
stars:[Number]
- OPTIONAL:
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
[{ "_id": "612798386ad0390015574a0a", "name": "Dosa", "price": 50, "availability": true, "stars": 5, "description": "Medium-sized dosa. Serves 1.", "discount": 10, "__v": 0 }, { "_id": "612798386ad0390015574a0a", "name": "Dosa", "price": 50, "availability": true, "stars": 5, "description": "Medium-sized dosa. Serves 1.", "discount": 10, "__v": 0 }]
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE:
Updates the modifiable food parameters in the database.
-
URL
/food/:id -
METHOD
PATCH -
AUTHORIZATION
- Admin Authentication
Bearer Authentication Token
- Admin Authentication
-
URL PARAMS
- REQUIRED:
id=[mongoose.Schema.Types.ObjectId]
- REQUIRED:
-
DATA PARAMS
-
ALLOWED:
name=[String]
price=[Number]
availability=[Boolean]
discount=[Number]
stock=[Number] -
RESTRICTED:
stars=[Number]
-
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
{ [Food] }
- CODE:
-
ERROR RESPONSE
- CODE:
400 - CONTENT:
{ error: [Object] }
- CODE:
Deletes the food from the database.
-
URL
/food/:id -
METHOD
DELETE -
AUTHORIZATION
- Admin Authentication
Bearer Authentication Token
- Admin Authentication
-
URL PARAMS
- REQUIRED:
id=[mongoose.Schema.Types.ObjectId]
- REQUIRED:
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
{ "_id": "612798386ad0390015574a0a", "name": "Dosa", "price": 50, "availability": true, "stars": 5, "description": "Medium-sized dosa. Serves 1.", "discount": 10, "__v": 0 }
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE:
Creates a new food-order.
-
URL
/order/:foodID -
METHOD
POST -
AUTHORIZATION
- User Authentication
Bearer Authentication Token
- User Authentication
-
URL PARAMS
- REQUIRED:
foodID=[mongoose.Schema.Types.ObjectId]
- REQUIRED:
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
{ "message": "Order created" }
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE:
Fetches the details of an order.
-
URL
/orders/:id -
METHOD
GET -
AUTHORIZATION
- Admin Authentication
Bearer Authentication Token
- Admin Authentication
-
URL PARAMS
- REQUIRED:
id=[mongoose.Schema.Types.ObjectId]
- REQUIRED:
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
{ "quantity": 1, "paid": false, "_id": "6127b447e53db0001516aad2", "owner": "612784af7eb00300154842ab", "food": "6127b3d7e53db0001516aac7", "createdAt": "2021-08-26T15:33:27.298Z", "updatedAt": "2021-08-26T15:33:27.298Z", "__v": 0 }
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
OR - CODE:
404 - CONTENT:
{ error: 'No order found' }
- CODE:
Fetches multiple orders according to filters provided(if any). Pagination supported through limit and skip as query parameters.
-
URL
/orders -
METHOD
GET -
AUTHORIZATION
- Admin Authentication
Bearer Authentication Token
- Admin Authentication
-
URL PARAMS
- OPTIONAL:
limit:[Integer]
skip:[Integer]
paid:[Boolean]
- OPTIONAL:
-
SUCCESS RESPONSE
- CODE:
200 - CONTENT:
[{ "quantity": 1, "paid": false, "_id": "6127b447e53db0001516aad2", "owner": "612784af7eb00300154842ab", "food": "6127b3d7e53db0001516aac7", "createdAt": "2021-08-26T15:33:27.298Z", "updatedAt": "2021-08-26T15:33:27.298Z", "__v": 0 }, { "quantity": 2, "paid": true, "_id": "6127b447e53db0001516aae9", "owner": "612784af7eb00300154842sg", "food": "6127b3d7e53db0001516aaqe", "createdAt": "2021-08-26T13:33:27.298Z", "updatedAt": "2021-08-26T11:33:27.298Z", "__v": 0 }]
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE:
Deletes the order from the database.
-
URL
/order/:id -
METHOD
DELETE -
AUTHORIZATION
- Admin Authentication
Bearer Authentication Token
- Admin Authentication
-
URL PARAMS
- REQUIRED:
id=[mongoose.Schema.Types.ObjectId]
- REQUIRED:
-
SUCCESS RESPONSE
- CODE:
200
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE:
Uploads an avatar/profile-pic for the user.
-
URL
/users/me/avatar -
METHOD
POST -
AUTHORIZATION
- User Authentication
Bearer Authentication Token
- User Authentication
-
BODY PARAMS
- REQUIRED:
avatar=[File(png/jpg/jpeg)]
- REQUIRED:
-
SUCCESS RESPONSE
- CODE:
200 - Content:
{ 'message': 'Image uploaded' }
- CODE:
-
ERROR RESPONSE
- CODE:
400 - CONTENT:
{ error: [Object] }
- CODE:
Uploads an image for a food.
-
URL
/food/:id/image -
METHOD
POST -
AUTHORIZATION
- Admin Authentication
Bearer Authentication Token
- Admin Authentication
-
URL PARAMS
- REQUIRED:
id=[mongoose.Schema.Types.ObjectId]
- REQUIRED:
-
BODY PARAMS
- REQUIRED:
image=[File(png/jpg/jpeg)]
- REQUIRED:
-
SUCCESS RESPONSE
- CODE:
200 - Content:
{ 'message': 'Image uploaded' }
- CODE:
-
ERROR RESPONSE
- CODE:
400 - CONTENT:
{ error: [Object] }
- CODE:
Fetches the avatar of a user.
-
URL
/users/:id/avatar -
METHOD
GET -
URL PARAMS
- REQUIRED:
id=[mongoose.Schema.Types.ObjectId]
- REQUIRED:
-
SUCCESS RESPONSE
- CODE:
200 - Content:
image/png
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE:
Fetches the image of a food.
-
URL
/food/:id/image -
METHOD
GET -
URL PARAMS
- REQUIRED:
id=[mongoose.Schema.Types.ObjectId]
- REQUIRED:
-
SUCCESS RESPONSE
- CODE:
200 - Content:
image/png
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE:
Deletes the avatar/profile-pic of the user.
-
URL
/users/me/avatar -
METHOD
DELETE -
AUTHORIZATION
- User Authentication
Bearer Authentication Token
- User Authentication
-
SUCCESS RESPONSE
- CODE:
200
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE:
Deletes the image of a food.
-
URL
/food/:id/image -
METHOD
DELETE -
AUTHORIZATION
- Admin Authentication
Bearer Authentication Token
- Admin Authentication
-
URL PARAMS
- REQUIRED:
id=[mongoose.Schema.Types.ObjectId]
- REQUIRED:
-
SUCCESS RESPONSE
- CODE:
200
- CODE:
-
ERROR RESPONSE
- CODE:
500 - CONTENT:
{ error: [Object] }
- CODE: