This document provides detailed information about the APIs available in the microservices application. It is generated and may be not up-to-date
Most endpoints require authentication using JSON Web Tokens (JWT). To authenticate:
- Make a POST request to
/api/auth/loginwith valid credentials - Receive a JWT token in the response
- Include the token in subsequent requests in the Authorization header:
Authorization: Bearer <your_token>
The JWT token includes the following claims:
sub: User ID (GUID)email: User emailusername: Usernamerole: User role (Regular, Admin, SuperAdmin)jti: Unique token IDexp: Expiration time
Base URL: http://localhost:5280/api
POST /auth/login
Request:
{
"username": "johndoe",
"password": "P@ssw0rd123!"
}Response (200 OK):
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}GET /users
Authorization: Required (Admin or SuperAdmin)
Response (200 OK):
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"username": "johndoe",
"email": "john@example.com",
"firstName": "John",
"lastName": "Doe",
"role": 0,
"createdAt": "2025-03-15T14:30:00Z",
"lastLoginDate": "2025-03-19T09:45:00Z"
},
...
]GET /users/{id}
Authorization: Required
Response (200 OK):
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"username": "johndoe",
"email": "john@example.com",
"firstName": "John",
"lastName": "Doe",
"role": 0,
"createdAt": "2025-03-15T14:30:00Z",
"lastLoginDate": "2025-03-19T09:45:00Z"
}GET /users/by-email/{email}
Authorization: Required (Admin or SuperAdmin)
Response (200 OK):
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"username": "johndoe",
"email": "john@example.com",
"firstName": "John",
"lastName": "Doe",
"role": 0,
"createdAt": "2025-03-15T14:30:00Z",
"lastLoginDate": "2025-03-19T09:45:00Z"
}GET /users/by-username/{username}
Authorization: Required (Admin or SuperAdmin)
Response (200 OK):
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"username": "johndoe",
"email": "john@example.com",
"firstName": "John",
"lastName": "Doe",
"role": 0,
"createdAt": "2025-03-15T14:30:00Z",
"lastLoginDate": "2025-03-19T09:45:00Z"
}POST /users
Authorization: Not required
Request:
{
"username": "johndoe",
"email": "john@example.com",
"password": "P@ssw0rd123!",
"firstName": "John",
"lastName": "Doe",
"role": 0
}Role values:
- 0: Regular
- 1: Admin
- 2: SuperAdmin
Response (201 Created):
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"username": "johndoe",
"email": "john@example.com",
"firstName": "John",
"lastName": "Doe",
"role": 0,
"createdAt": "2025-03-20T10:15:30Z",
"lastLoginDate": null
}PUT /users
Authorization: Required
Request:
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"firstName": "John",
"lastName": "Smith",
"email": "john.smith@example.com",
"role": 0
}Response (200 OK):
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"username": "johndoe",
"email": "john.smith@example.com",
"firstName": "John",
"lastName": "Smith",
"role": 0,
"createdAt": "2025-03-15T14:30:00Z",
"lastLoginDate": "2025-03-19T09:45:00Z"
}DELETE /users/{id}
Authorization: Required (Admin or SuperAdmin)
Response (204 No Content)
Base URL: http://localhost:5282/api
GET /locations
Authorization: Not required
Response (200 OK):
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "Central Park",
"latitude": 40.785091,
"longitude": -73.968285,
"address": "Central Park",
"city": "New York",
"state": "NY",
"country": "USA",
"postalCode": "10022",
"createdAt": "2025-03-10T08:15:30Z",
"details": [
{
"id": "4fa85f64-5717-4562-b3fc-2c963f66afa7",
"propertyName": "type",
"propertyValue": "park"
},
{
"id": "5fa85f64-5717-4562-b3fc-2c963f66afa8",
"propertyName": "size",
"propertyValue": "843 acres"
}
]
},
...
]GET /locations/{id}
Authorization: Not required
Response (200 OK):
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "Central Park",
"latitude": 40.785091,
"longitude": -73.968285,
"address": "Central Park",
"city": "New York",
"state": "NY",
"country": "USA",
"postalCode": "10022",
"createdAt": "2025-03-10T08:15:30Z",
"details": [
{
"id": "4fa85f64-5717-4562-b3fc-2c963f66afa7",
"propertyName": "type",
"propertyValue": "park"
},
{
"id": "5fa85f64-5717-4562-b3fc-2c963f66afa8",
"propertyName": "size",
"propertyValue": "843 acres"
}
]
}GET /locations/nearby?latitude=40.7128&longitude=-74.0060&radiusKm=5
Authorization: Not required
Response (200 OK):
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "Central Park",
"latitude": 40.785091,
"longitude": -73.968285,
"address": "Central Park",
"city": "New York",
"state": "NY",
"country": "USA",
"postalCode": "10022",
"createdAt": "2025-03-10T08:15:30Z",
"details": [...]
},
...
]GET /locations/by-property?key=type&value=park
Authorization: Not required
Response (200 OK):
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "Central Park",
"latitude": 40.785091,
"longitude": -73.968285,
"address": "Central Park",
"city": "New York",
"state": "NY",
"country": "USA",
"postalCode": "10022",
"createdAt": "2025-03-10T08:15:30Z",
"details": [...]
},
...
]POST /locations
Authorization: Required
Request:
{
"name": "Empire State Building",
"latitude": 40.748817,
"longitude": -73.985428,
"address": "350 Fifth Avenue",
"city": "New York",
"state": "NY",
"country": "USA",
"postalCode": "10118",
"details": [
{
"propertyName": "type",
"propertyValue": "building"
},
{
"propertyName": "height",
"propertyValue": "381 meters"
}
]
}Response (201 Created):
{
"id": "6fa85f64-5717-4562-b3fc-2c963f66afa9",
"name": "Empire State Building",
"latitude": 40.748817,
"longitude": -73.985428,
"address": "350 Fifth Avenue",
"city": "New York",
"state": "NY",
"country": "USA",
"postalCode": "10118",
"createdAt": "2025-03-20T10:25:30Z",
"details": [
{
"id": "7fa85f64-5717-4562-b3fc-2c963f66afaa",
"propertyName": "type",
"propertyValue": "building"
},
{
"id": "8fa85f64-5717-4562-b3fc-2c963f66afab",
"propertyName": "height",
"propertyValue": "381 meters"
}
]
}PUT /locations
Authorization: Required
Request:
{
"id": "6fa85f64-5717-4562-b3fc-2c963f66afa9",
"name": "Empire State Building",
"address": "350 Fifth Avenue",
"city": "New York",
"state": "NY",
"country": "USA",
"postalCode": "10118"
}Response (200 OK):
{
"id": "6fa85f64-5717-4562-b3fc-2c963f66afa9",
"name": "Empire State Building",
"latitude": 40.748817,
"longitude": -73.985428,
"address": "350 Fifth Avenue",
"city": "New York",
"state": "NY",
"country": "USA",
"postalCode": "10118",
"createdAt": "2025-03-20T10:25:30Z",
"details": [...]
}DELETE /locations/{id}
Authorization: Required (Admin or SuperAdmin)
Response (204 No Content)
POST /locations/{locationId}/details
Authorization: Required
Request:
{
"propertyName": "yearBuilt",
"propertyValue": "1931"
}Response (200 OK):
{
"id": "6fa85f64-5717-4562-b3fc-2c963f66afa9",
"name": "Empire State Building",
"latitude": 40.748817,
"longitude": -73.985428,
"address": "350 Fifth Avenue",
"city": "New York",
"state": "NY",
"country": "USA",
"postalCode": "10118",
"createdAt": "2025-03-20T10:25:30Z",
"details": [
{
"id": "7fa85f64-5717-4562-b3fc-2c963f66afaa",
"propertyName": "type",
"propertyValue": "building"
},
{
"id": "8fa85f64-5717-4562-b3fc-2c963f66afab",
"propertyName": "height",
"propertyValue": "381 meters"
},
{
"id": "9fa85f64-5717-4562-b3fc-2c963f66afac",
"propertyName": "yearBuilt",
"propertyValue": "1931"
}
]
}PUT /locations/{locationId}/details/{detailId}
Authorization: Required
Request:
{
"propertyName": "height",
"propertyValue": "381.1 meters"
}Response (200 OK):
{
"id": "6fa85f64-5717-4562-b3fc-2c963f66afa9",
"name": "Empire State Building",
"latitude": 40.748817,
"longitude": -73.985428,
"address": "350 Fifth Avenue",
"city": "New York",
"state": "NY",
"country": "USA",
"postalCode": "10118",
"createdAt": "2025-03-20T10:25:30Z",
"details": [
{
"id": "7fa85f64-5717-4562-b3fc-2c963f66afaa",
"propertyName": "type",
"propertyValue": "building"
},
{
"id": "8fa85f64-5717-4562-b3fc-2c963f66afab",
"propertyName": "height",
"propertyValue": "381.1 meters"
}
]
}DELETE /locations/{locationId}/details/{detailId}
Authorization: Required
Response (200 OK):
{
"id": "6fa85f64-5717-4562-b3fc-2c963f66afa9",
"name": "Empire State Building",
"latitude": 40.748817,
"longitude": -73.985428,
"address": "350 Fifth Avenue",
"city": "New York",
"state": "NY",
"country": "USA",
"postalCode": "10118",
"createdAt": "2025-03-20T10:25:30Z",
"details": [
{
"id": "7fa85f64-5717-4562-b3fc-2c963f66afaa",
"propertyName": "type",
"propertyValue": "building"
}
]
}Base URL: http://localhost:5284/api
GET /reviews
Authorization: Not required
Response (200 OK):
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"userId": "1fa85f64-5717-4562-b3fc-2c963f66afa1",
"locationId": "6fa85f64-5717-4562-b3fc-2c963f66afa9",
"rating": 5,
"content": "Amazing building with a fantastic view from the observation deck!",
"createdAt": "2025-03-20T11:15:30Z",
"updatedAt": null
},
...
]GET /reviews/{id}
Authorization: Not required
Response (200 OK):
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"userId": "1fa85f64-5717-4562-b3fc-2c963f66afa1",
"locationId": "6fa85f64-5717-4562-b3fc-2c963f66afa9",
"rating": 5,
"content": "Amazing building with a fantastic view from the observation deck!",
"createdAt": "2025-03-20T11:15:30Z",
"updatedAt": null
}GET /reviews/by-user/{userId}
Authorization: Not required
Response (200 OK):
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"userId": "1fa85f64-5717-4562-b3fc-2c963f66afa1",
"locationId": "6fa85f64-5717-4562-b3fc-2c963f66afa9",
"rating": 5,
"content": "Amazing building with a fantastic view from the observation deck!",
"createdAt": "2025-03-20T11:15:30Z",
"updatedAt": null
},
...
]GET /reviews/by-location/{locationId}
Authorization: Not required
Response (200 OK):
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"userId": "1fa85f64-5717-4562-b3fc-2c963f66afa1",
"locationId": "6fa85f64-5717-4562-b3fc-2c963f66afa9",
"rating": 5,
"content": "Amazing building with a fantastic view from the observation deck!",
"createdAt": "2025-03-20T11:15:30Z",
"updatedAt": null
},
...
]GET /reviews/average-rating/{locationId}
Authorization: Not required
Response (200 OK):
{
"locationId": "6fa85f64-5717-4562-b3fc-2c963f66afa9",
"averageRating": 4.7
}POST /reviews
Authorization: Required
Request:
{
"locationId": "6fa85f64-5717-4562-b3fc-2c963f66afa9",
"rating": 4,
"content": "Great place to visit! Highly recommended."
}Response (201 Created):
{
"id": "7fa85f64-5717-4562-b3fc-2c963f66afad",
"userId": "1fa85f64-5717-4562-b3fc-2c963f66afa1",
"locationId": "6fa85f64-5717-4562-b3fc-2c963f66afa9",
"rating": 4,
"content": "Great place to visit! Highly recommended.",
"createdAt": "2025-03-20T15:20:30Z",
"updatedAt": null
}PUT /reviews
Authorization: Required
Request:
{
"id": "7fa85f64-5717-4562-b3fc-2c963f66afad",
"rating": 5,
"content": "Great place to visit! The experience was even better than expected. Highly recommended."
}Response (200 OK):
{
"id": "7fa85f64-5717-4562-b3fc-2c963f66afad",
"userId": "1fa85f64-5717-4562-b3fc-2c963f66afa1",
"locationId": "6fa85f64-5717-4562-b3fc-2c963f66afa9",
"rating": 5,
"content": "Great place to visit! The experience was even better than expected. Highly recommended.",
"createdAt": "2025-03-20T15:20:30Z",
"updatedAt": "2025-03-20T16:05:15Z"
}DELETE /reviews/{id}
Authorization: Required
Response (204 No Content)
All APIs follow a consistent error handling approach:
{
"statusCode": 400,
"message": "Error message details"
}- 200 OK: The request was successful
- 201 Created: The resource was successfully created
- 204 No Content: The request was successful, but there is no content to return
- 400 Bad Request: The request was invalid or cannot be served
- 401 Unauthorized: Authentication is required or failed
- 403 Forbidden: The authenticated user does not have the required permissions
- 404 Not Found: The requested resource does not exist
- 500 Internal Server Error: An unexpected error occurred on the server
When validation fails, a 400 Bad Request response is returned with details about the validation errors:
{
"statusCode": 400,
"message": "Validation error",
"errors": {
"username": [
"Username must be at least 3 characters"
],
"password": [
"Password must contain at least one uppercase letter",
"Password must contain at least one number"
]
}
}When authentication fails, a 401 Unauthorized response is returned:
{
"statusCode": 401,
"message": "Invalid username or password"
}Or when the token is invalid or expired:
{
"statusCode": 401,
"message": "Invalid or expired token"
}When the authenticated user does not have permission to access a resource:
{
"statusCode": 403,
"message": "You do not have permission to access this resource"
}