Notes
any
undefined
field can be ommitted from the body|
means it can accept only any of the values
POST
| /users/signup
Body
{
"username": "string",
"password": "string",
"firstName": "string",
"lastName": "string",
"birthDate": "yyyy-mm-dd",
"gender": "M" | "F",
"nationality": "string" | undefined,
"email": "string",
"role": "fan" | "manager" | "admin"
}
Example
{
"username": "hazem",
"password": "123456789",
"firstName": "Hazem",
"lastName": "Elaswad",
"birthDate": "2000-09-20",
"gender": "M",
"nationality": "Egyptian",
"email": "[email protected]",
"role": "fan"
}
Response
status: 400
{
"status": "failure",
"message": "<error_msg>"
}
status: 500
{
"status": "failure",
"message": "Internal server error"
}
status: 201
{
"status": "success",
"message": "User has been created successfully"
}
POST
| /users/signin
Body
{
"username": "string",
"password": "string"
}
Example
{
"username": "hazem",
"password": "123456789",
}
Response
status: 400
{
"status": "failure",
"message": "<error_msg>"
}
status: 401
{
"status": "failure",
"message": "<error_msg>"
}
status: 403
{
"status": "failure",
"message": "Username is incorrect"
}
status: 200
{
"status": "success",
"message": "User signed in successfully",
"token": "<token>"
}
GET
| /users/me
Headers
Token: "string"
Response
status: 400
{
"status": "failure",
"message": "User does not exist in the system"
}
status: 401
{
"status": "failure",
"message": "Unauthorized request, provide a token"
}
status: 403
{
"status": "failure",
"message": "Permission denied, invalid token"
}
status: 200
{
"username": "string",
"firstName": "string",
"lastName": "string",
"birthDate": "date",
"gender": "M" | "F",
"nationality": "string",
"email": "string",
"role": "fan" | "manager" | "admin",
"matches": [
{
"matchId": "string",
"seatRow": "number",
"seatColumn": "number",
"_id": "string"
}
]
}
PUT
| /users/me
Headers
Token:
"string"
NOTE: You don't have to provide all body attributes, you can omit what you want, and update what you need
Body
{
"firstName": "string",
"lastName": "string",
"birthDate": "yyyy-mm-dd",
"password": "string",
"gender": "M" | "F",
"nationality": "string",
}
Example
{
"firstName": "Saif",
"lastName": "Elsayed",
"birthDate": "1999-09-20",
"gender": "M",
}
Response
status: 400
{
"status": "failure",
"message": "<error_msg>"
}
status: 401
{
"status": "failure",
"message": "Unauthorized request, provide a token"
}
status: 403
{
"status": "failure",
"message": "Permission denied, invalid token"
}
status: 201
{
"status": "success",
"message": "User has been updated successfully"
}
PUT
| /users/reservation
Headers
Token:
"string"
Body
{
"matchId": "string",
"seats": [
{
"seatColumn": "number",
"seatRow": "number"
}
],
"creditCard": "string",
"pinNumber": "number"
}
Example
{
"matchId": "639a5621051539530761d6e5",
"seats": [
{
"seatColumn": 50,
"seatRow": 10
},
{
"seatColumn": 43,
"seatRow": 12
}
],
"creditCard": "16589764561651",
"pinNumber": 1259
}
Response
status: 400
{
"status": "failure",
"message": "<error_msg>"
}
status: 401
{
"status": "failure",
"message": "Unauthorized request, provide a token"
}
status: 403
{
"status": "failure",
"message": "<error_msg>"
}
status: 500
{
"status": "failure",
"message": "Internal server error"
}
status: 201
{
"ticket": "string"
}
PUT
| /users/cancellation
Headers
Token:
"string"
Body
{
"matchId": "string",
"seatColumn": "number",
"seatRow": "number"
}
Example
{
"matchId": "339a56k1051539530761d655",
"seatColumn": 15,
"seatRow": 3
}
Response
status: 400
{
"status": "failure",
"message": "<error_msg>"
}
status: 401
{
"status": "failure",
"message": "Unauthorized request, provide a token"
}
status: 403
{
"status": "failure",
"message": "<error_msg>"
}
status: 500
{
"status": "failure",
"message": "Internal server error"
}
status: 201
{
"status": "success",
"message": "Cancelled successfully"
}
GET
| /matches
Response
status: 200
[
{
"matchId": "string",
"firstTeam": "string",
"secondTeam": "string",
"stadium": {
"name": "string",
"columnsCount": "number",
"rowsCount": "number"
},
"date": "date",
"referee": "string",
"firstLineman": "string",
"secondLineman": "string",
"fans": [
{
"fanId": "string",
"seatRow": "number",
"seatColumn": "number",
"_id": "string"
}
]
}
]
GET
| /matches/:id
Response
status: 200
{
"matchId": "string",
"firstTeam": "string",
"secondTeam": "string",
"stadium": {
"name": "string",
"columnsCount": "number",
"rowsCount": "number"
},
"date": "date",
"referee": "string",
"firstLineman": "string",
"secondLineman": "string",
"fans": [
{
"fanId": "string",
"seatRow": "number",
"seatColumn": "number",
"_id": "string"
}
]
}
GET
| /admin/users
Response
status: 200
[
{
"userId": "string",
"username": "string",
"firstName": "string",
"lastName": "string",
"birthDate": "date",
"gender": "M" | "F",
"nationality": "string",
"email": "string",
"role": "fan" | "manager",
"status": "approved" | "pending",
"matches": [
{
"matchId": "string",
"seatRow": "number",
"seatColumn": "number",
"_id": "string"
}
]
}
]
GET
| /admin/getpandeng
Headers
Token:
"string"
Response
status: 401
{
"status": "failure",
"message": "Unauthorized request, provide a token"
}
status: 403
{
"status": "failure",
"message": "Permission denied, invalid token"
}
status: 200
{
"users": [
{
"_id": "string",
"username": "string",
"password": "string",
"firstName": "string",
"lastName": "string",
"birthDate": "yyyy-mm-dd",
"gender": "M" | "F",
"email": "string",
"role": "fan" | "manager" | "admin",
"status": "pending",
"matches": [],
"__v": 0
}
]
}
POST
| /admin/approve/:id
Headers
Token:
"string"
Response
status: 401
{
"status": "failure",
"message": "Unauthorized request, provide a token"
}
status: 403
{
"status": "failure",
"message": "Permission denied, invalid token"
}
status: 500
{
"status": "failure",
"message": "Internal server error"
}
status: 200
{
"status": "success",
"message": "approved successfully"
}
DELETE
| /admin/user/:id
Headers
Token:
"string"
Response
status: 401
{
"status": "failure",
"message": "Unauthorized request, provide a token"
}
status: 403
{
"status": "failure",
"message": "<error_msg>"
}
status: 404
{
"status": "failure",
"message": "User has already been deleted"
}
status: 500
{
"status": "failure",
"message": "Internal server error"
}
status: 200
{
"status": "success",
"message": "Deleted successfully"
}