Welcome to the TurfTender API documentation. TurfTender is a platform that connects users with turf facilities for events and bookings. Below, you will find information about the available endpoints, their functionalities, and the expected input and output formats.
The base URL for all API endpoints is https://turftender.onrender.com/api
- Endpoint:
/admin/login
- Method:
POST
- Description: Logs in an admin user.
- Input:
email
(string): Admin user emailpassword
(string): Admin user password
- Output:
email
(string): Admin user emailtoken
(string): Authentication tokenadmin
(boolean): Indicates if the user is an admin
- Endpoint:
/admin/signup
- Method:
POST
- Description: Registers a new admin user.
- Input:
name
(string): Admin user namemobileNumber
(string): Admin user mobile numberemail
(string): Admin user emailaddress
(string): Admin user addressdistrict
(string): Admin user districtpincode
(number): Admin user pincodepassword
(string): Admin user passwordavatar
(string): Admin user avatar URL
- Output:
adminUser
(object): Newly created admin user details
- Endpoint:
/admin/signup/otp
- Method:
POST
- Description: Confirms admin user registration with OTP.
- Input:
name
(string): Admin user namemobileNumber
(string): Admin user mobile numberemail
(string): Admin user emailaddress
(string): Admin user addressdistrict
(string): Admin user districtpincode
(number): Admin user pincodepassword
(string): Admin user passwordavatar
(string): Admin user avatar URLotp
(string): OTP received via email
- Output:
adminUserOtp
(object): Confirmed admin user details
- Endpoint:
/admin/data
- Method:
PUT
- Description: Updates admin user data.
- Input:
name
(string): Updated admin user namemobileNumber
(string): Updated admin user mobile numberemail
(string): Updated admin user emailaddress
(string): Updated admin user addressdistrict
(string): Updated admin user districtpincode
(number): Updated admin user pincode
- Output:
update
(object): Updated admin user details
- Endpoint:
/admin/password-update
- Method:
PUT
- Description: Updates admin user password.
- Input:
password
(string): Updated admin user password
- Output:
update
(object): Updated admin user details
- Endpoint:
/favorites/:id
- Method:
POST
- Description: Adds a turf to the user's favorites.
- Input:
id
(string): Turf ID to be added to favorites
- Output:
favorite
(object): Details of the added favorite
- Endpoint:
/favorites/getfavorites
- Method:
GET
- Description: Retrieves the user's favorite turfs.
- Output:
favorite
(array): List of favorite turfs
- Endpoint:
/booking/details/:day/:month/:year
- Method:
GET
- Description: Retrieves all booking details for a specific date.
- Input:
day
(string): Day of the monthmonth
(string): Month of the yearyear
(string): Year
- Output:
bookingDetails
(array): List of booking details for the specified date
- Endpoint:
/booking/details/revenue
- Method:
GET
- Description: Retrieves the total revenue.
- Output:
data
(string): Total revenue amount
- Endpoint:
/booking/details/graph
- Method:
GET
- Description: Retrieves the total revenue graph data.
- Output:
expenses
(array): Monthly expense data for the revenue graph
- Endpoint:
/booking/adminbook/:id
- Method:
POST
- Description: Books a turf for an admin user.
- Input:
id
(string): Turf ID to be bookedtime
(string): Booking timerate
(number): Booking ratedate
(string): Booking datename
(string): User namemobileNumber
(string): User mobile numberevent
(string): Booking event
- Output:
book
(object): Details of the booked turf
- Endpoint:
/turf/:category
- Method:
GET
- Description: Retrieves all turfs based on the category.
- Input:
category
(string): Turf category
- Output:
turf
(array): List of turfs in the specified category
- Endpoint:
/turf/details/:id
- Method:
GET
- Description: Retrieves details of a specific turf.
- Input:
id
(string): Turf ID
- Output:
turf
(object): Details of the specified turf
- Endpoint:
/user/login
- Method:
POST
- Description: Logs in a user.
- Input:
mobileNumber
(string): User mobile numberpassword
(string): User password
- Output:
token
(string): Authentication tokenuser
(object): User details
- Endpoint:
/user/signup
- Method:
POST
- Description: Registers a new user.
- Input:
name
(string): User namemobileNumber
(string): User mobile numberpassword
(string): User passwordavatar
(string): User avatar URL
- Output:
user
(object): Newly created user details
- Endpoint:
/user/signup/otp
- Method:
POST
- Description: Confirms user registration with OTP.
- Input:
name
(string): User namemobileNumber
(string): User mobile numberpassword
(string): User passwordavatar
(string): User avatar URLotp
(string): OTP received via SMS
- Output:
userOtp
(object): Confirmed user details
- Endpoint:
/user/data
- Method:
PUT
- Description: Updates user data.
- Input:
name
(string): Updated user namemobileNumber
(string): Updated user mobile numberavatar
(string): Updated user avatar URL
- Output:
update
(object): Updated user details
- Endpoint:
/user/password-update
- Method:
PUT
- Description: Updates user password.
- Input:
password
(string): Updated user password
- Output:
update
(object): Updated user details
- Endpoint:
/turf/review/:id
- Method:
POST
- Description: Adds a review for a specific turf.
- Input:
id
(string): Turf IDrating
(number): Review ratingcomment
(string): Review comment
- Output:
review
(object): Details of the added review
All endpoints, except for the user login, user signup, user OTP confirmation, admin login, and admin signup endpoints, require authentication. To authenticate a request, include the user's or admin's authentication token in the request headers.
Example:
Authorization: Bearer <token>
The API returns standard HTTP status codes to indicate the success or failure of a request. In case of an error, additional information is provided in the response body.
Example Error Response:
{
"error": {
"status": 404,
"message": "Resource not found"
}
}