M.Said's Restaurant API is perfect for any food-related project that requires restaurants, menus, and user data in JSON format. Check out the examples below to see how it works!
Get all restaurants
fetch('https://restaurant-app-api.runasp.net/api/Restaurant')
.then(res => res.json())
.then(json => console.log(json))
[
{ restaurantID: 26, restaurantName: ".....", address: ".....", type: ".....", parkingLot: ...... },
{ restaurantID: 25, restaurantName: ".....", address: ".....", type: ".....", parkingLot: ...... }
]
Filter by category
fetch('https://restaurant-app-api.runasp.net/api/Restaurant?category=Parsi Cuisine')
.then(res => res.json())
.then(json => console.log(json))
[
{ restaurantID: 16, restaurantName: ".....", address: ".....", type: "Parsi Cuisine", parkingLot: ...... }
]
Filter by address and Restaurant Name
fetch('https://restaurant-app-api.runasp.net/api/Restaurant?address=hyderabad&name=Paradise Biryani')
.then(res => res.json())
.then(json => console.log(json))
The address may be a substring. The system performs a 'contains' operation to retrieve related addresses.
[
{ "restaurantID": 1, "restaurantName": "Paradise Biryani", "address": "Hyderabad, Secunderabad, Telangana", "type": "Biryani", "parkingLot": true }
]
Get Restaurant by id
fetch('https://restaurant-app-api.runasp.net/api/Restaurant/4')
.then(res => res.json())
.then(json => console.log(json))
{ restaurantID: 4, restaurantName: ".....", address: ".....", type: "Parsi Cuisine", parkingLot: ...... }
Get Restaurant menu
fetch('https://restaurant-app-api.runasp.net/api/Restaurant/5/menu')
.then(res => res.json())
.then(json => console.log(json))
[
{ itemID: 91, itemName: "Haleem", itemDescription: "Rich and creamy stew.", itemPrice: 220, restaurantName: "Pista House", restaurantID: 5 },
{ itemID: 92, itemName: "Mutton Biryani", itemDescription: "Signature biryani with mutton.", itemPrice: 350, restaurantName: "Pista House", restaurantID: 5 }
.......
]
Sort menu by price
fetch('https://restaurant-app-api.runasp.net/api/Restaurant/5/menu?sortbyprice=desc')
.then(res => res.json())
.then(json => console.log(json))
Prices sorted ascending with sortbyprice=asc, descending with sortbyprice=desc. If null, displayed in a random order.
[
{ itemID: 92, itemName: "Mutton Biryani", itemPrice: 350 },
{ itemID: 91, itemName: "Haleem", itemPrice: 220 }
.......
]
Get all items
fetch('https://restaurant-app-api.runasp.net/api/Restaurant/items')
.then(res => res.json())
.then(json => console.log(json))
[
{ itemID: 91, itemName: '.....', itemDescription: '......', itemPrice: ....., restaurantName: '.....', restaurantID: ....., imageUrl: '.....' },
{ itemID: 92, itemName: '.....', itemDescription: '......', itemPrice: ....., restaurantName: '.....', restaurantID: ....., imageUrl: '.....' }
.......
]
Search items by item name
fetch('https://restaurant-app-api.runasp.net/api/Restaurant/items?ItemName=fish')
.then(res => res.json())
.then(json => console.log(json))
[
{ itemID: 14, itemName: 'Fish Amritsari', itemPrice: ..... },
{ itemID: 47, itemName: 'Fish Curry', itemPrice: ..... }
.......
]
Sort items by price
fetch('https://restaurant-app-api.runasp.net/api/Restaurant/items?sortbyprice=asc')
.then(res => res.json())
.then(json => console.log(json))
Prices sorted ascending with sortbyprice=asc, descending with sortbyprice=desc. If null, displayed in a random order.
[
{ itemID: 26, itemPrice: 40, restaurantName: '.....' },
{ itemID: 80, itemPrice: 60, restaurantName: '.....' }
.......
]
Add a restaurant
fetch('https://restaurant-app-api.runasp.net/api/Restaurant', {
method: "POST",
body: JSON.stringify({ restaurantName: 'string', address: 'string', type: 'string', parkingLot: true })
})
.then(res => res.json())
.then(json => console.log(json))
The response is a temporary object only โ saving to the database is coming soon.
{ restaurantID: ...., restaurantName: ".....", address: ".....", type: ".....", parkingLot: ...... }
Add an item to a restaurant menu
fetch('https://restaurant-app-api.runasp.net/api/Restaurant/{Restaurant_id}/additem', {
method: "POST",
body: JSON.stringify({ itemName: "string", itemPrice: 0.00, itemDescription: "string", imageUrl: "string" })
})
.then(res => res.json())
.then(json => console.log(json))
The response is a temporary object only โ saving to the database is coming soon.
{ itemID: ....., itemName: ".....", itemDescription: ".....", itemPrice: ....., restaurant: {....}, restaurantID: ....., imageUrl: "....." }
Get users
fetch('https://restaurant-app-api.runasp.net/api/User')
.then(res => res.json())
.then(json => console.log(json))
[
{ "userEmail": "tech@example.com", "password": "let's go", "usercode": "cbc4ecf6-7eda-47e7-bbae-de84be9c796c" },
{ "userEmail": "bachelor@example.com", "password": "keep consistency", "usercode": "dbc3ecf6-7eda-47e7-bbae-de87be9c796c" }
]
Get user code
fetch('https://restaurant-app-api.runasp.net/api/User/getusercode?UserEmail=tech@example.com&Password=string')
.then(res => res.json())
.then(json => console.log(json))
The user code is your unique API key. Required for all protected operations. Keep it secure.
{ usercode: "cbc4ecf6-7eda-47e7-bbae-de84be9c796c" }
Register new user
fetch('https://restaurant-app-api.runasp.net/api/User/register', {
method: "POST",
body: JSON.stringify({ userEmail: "user@bachelor.com", password: "sonicmaster" })
})
.then(res => res.json())
.then(json => console.log(json))
{ "userEmail": "user@bachelor.com", "password": "sonicmaster", "usercode": "6f3d1852-aecd-4224-8898-8507a541bc52" }
Delete user details
fetch('https://restaurant-app-api.runasp.net/api/User/{apikey}', { method: "DELETE" })
.then(res => res.json())
.then(json => console.log(json))
Replace {apikey} with your actual user code. Using the literal {apikey} will not work.
{ message: "User Data Deleted" }
Update user details
fetch('https://restaurant-app-api.runasp.net/api/User/{apikey}', {
method: "PUT",
body: JSON.stringify(NewPassword)
})
.then(res => res.json())
.then(json => console.log(json))
The request body should be a string representing the new password.
{ "userEmail": "user@bachelor.com", "password": "string", "usercode": "6f3d1852-aecd-4224-8898-8507a541bc52" }
Get orders
fetch('https://restaurant-app-api.runasp.net/api/Order?apikey={api key}')
.then(res => res.json())
.then(json => console.log(json))
Retrieves all master orders for the user associated with the given api key, including total price and user details.
[
{ masterID: 4, userID: ".....", usercode: ".....", restaurantID: 1, grandtotal: 2750 },
{ masterID: 6, userID: ".....", usercode: ".....", restaurantID: 1, grandtotal: 2750 }
]
Get orders by id
fetch('https://restaurant-app-api.runasp.net/api/Order/{master_id}?apikey={api key}')
.then(res => res.json())
.then(json => console.log(json))
Retrieves all individual orders within a specified master order. Each order has its own ID grouped under one master ID.
[
{ orderID: 3, userID: ".....", itemName: ".....", quantity: ....., itemPrice: ....., totalPrice: ....., masterID: ..... }
......
]
Make an order
fetch('https://restaurant-app-api.runasp.net/api/Order/{restaurant_id}/makeorder?apikey={api key}', {
method: "POST",
body: JSON.stringify({
menuDTO: [
{ itemName: "Kofta Curry", quantity: 2 },
{ itemName: "Sheer Korma", quantity: 2 }
]
})
})
.then(res => res.json())
.then(json => console.log(json))
Creates a master order (transaction). All individual item orders are grouped under one master order ID.
{
fullorder: [
{ orderID: 9, itemName: "Kofta Curry", quantity: 2, itemPrice: 300, totalPrice: 600, masterID: 8 },
{ orderID: 10, itemName: "Sheer Korma", quantity: 2, itemPrice: 150, totalPrice: 300, masterID: 8 }
],
grandTotal: 900
}
Delete master order
fetch('https://restaurant-app-api.runasp.net/api/Order/master/{master_ID}?apikey={api key}', { method: "DELETE" })
.then(res => res.json())
.then(json => console.log(json))
{
message: "Master order Deleted",
orderexits: [{ masterID: 8, userID: "tech@example.com", restaurantID: 2, grandTotal: 600 }],
singleorders: [{ orderID: 9, itemName: "Kofta Curry", quantity: 2, itemPrice: 300, totalPrice: 600, masterID: 8 }]
}
Delete single order
fetch('https://restaurant-app-api.runasp.net/api/Order/{order_ID}?apikey={api key}', { method: "DELETE" })
.then(res => res.json())
.then(json => console.log(json))
{
message: "Order Deleted",
orderexits: { orderID: 9, itemName: "Kofta Curry", quantity: 2, itemPrice: 300, totalPrice: 600, masterID: 8 }
}