0% found this document useful (0 votes)
4 views

VisitEgypt_API_Documentation

The VisitEgypt API allows for user management with endpoints for user registration and login, returning user data and JWT tokens. It also includes place management functionalities, enabling the retrieval, creation, updating, and deletion of places, with specific authorization requirements for admin actions. Each endpoint has defined request bodies, responses, and status codes for various outcomes.

Uploaded by

modymody2358
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

VisitEgypt_API_Documentation

The VisitEgypt API allows for user management with endpoints for user registration and login, returning user data and JWT tokens. It also includes place management functionalities, enabling the retrieval, creation, updating, and deletion of places, with specific authorization requirements for admin actions. Each endpoint has defined request bodies, responses, and status codes for various outcomes.

Uploaded by

modymody2358
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

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": "[email protected]", "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": "[email protected]", "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.

You might also like