VisitEgypt API Documentation
VisitEgypt API Documentation
User Management
- **Register User**
- Endpoint: `/user/register`
- Method: `POST`
- Authorization: None
- Description: Registers a new user.
- Request Body: `{"email": "example@[Link]", "password": "password123", "name":
"John Doe", "userType": "User"}`
- Response: User data and a JWT token.
- Status Codes:
- `201 Created`: Successfully created the user.
- `409 Conflict`: Email already in use.
- `500 Internal Server Error`: Server error.
- **Login User**
- Endpoint: `/user/login`
- Method: `POST`
- Authorization: None
- Description: Authenticates user and returns a token.
- Request Body: `{"email": "example@[Link]", "password": "password123"}`
- Response: User data and a JWT token.
- Status Codes:
- `200 OK`: Successfully logged in.
- `401 Unauthorized`: Invalid credentials.
VisitEgypt API Documentation
- `500 Internal Server Error`: Server error.
VisitEgypt API Documentation
Place Management
- **Get All Places**
- Endpoint: `/places/`
- Method: `GET`
- Authorization: None
- Description: Retrieves all places.
- Response: Array of all place objects.
- Status Codes:
- `200 OK`: Successfully retrieved all places.
- **Create, Update, Delete Place**
- POST `/places/`
- Description: Creates a new place.
- Authorization: Admin only.
- Request Body: `{"name": "New Place", "location": "Location details", "description":
"Description of the place"}`
- Response: Details of the newly created place.
- Status Codes:
- `201 Created`: Successfully created the place.
- `500 Internal Server Error`: Failed to create the place.
- PUT `/places/:id`
- Description: Updates an existing place.
- Authorization: Admin only.
- Request Body: `{"name": "Updated Name", "location": "Updated Location", "description":
VisitEgypt API Documentation
"Updated Description"}`
- Response: Details of the updated place.
- Status Codes:
- `200 OK`: Successfully updated the place.
- `404 Not Found`: Place not found.
- `500 Internal Server Error`: Server error.
- DELETE `/places/:id`
- Description: Deletes a place.
- Authorization: Admin only.
- Path Parameters: `id` - ID of the place to delete.
- Response: Success message.
- Status Codes:
- `204 No Content`: Successfully deleted the place.
- `404 Not Found`: Place not found.
- `500 Internal Server Error`: Server error.