[R9] Update README with Authentication endpoint and token header

This commit is contained in:
Mirna Gama 2024-01-12 16:59:05 -03:00 committed by Mirna Gama
parent df24600ed8
commit bde702362f

108
README.md
View File

@ -22,6 +22,44 @@ Hospital Management API built in Spring Boot
## API Documentation ## API Documentation
### /auth
#### POST - [**/api/auth/register**] - Register a new user
- **Body:**
```
{
"login" (string, required),
"password" (string, required),
}
```
- **Responses:**
| Code | Description |
| ------------- | ------------- |
| `200` | _Successfully operation_ |
| `400` | _Validation Error_ |
#### POST - [**/api/auth/login**] - Perform the login
- **Body:**
```
{
"login" (string, required),
"password" (string, required),
}
```
- **Responses:**
| Code | Description |
| ------------- | ------------- |
| `200` | _Successfully operation_ |
| `400` | _Validation Error_ |
| `403` | _Incorrect credentials_ |
### /doctors ### /doctors
#### POST - [**/api/v1.0/doctors**] - Adds a new doctor #### POST - [**/api/v1.0/doctors**] - Adds a new doctor
@ -46,12 +84,19 @@ Hospital Management API built in Spring Boot
} }
``` ```
- **Request Headers:**
| Key | Description |
| ------------- | ------------- |
| `Authorization` | _Authorization token_ |
- **Responses:** - **Responses:**
| Code | Description | | Code | Description |
| ------------- | ------------- | | ------------- | ------------- |
| `201` | _Successfully created_ | | `201` | _Successfully created_ |
| `400` | _Validation Error_ | | `400` | _Validation Error_ |
| `403` | _Unauthorized / Invalid token_ |
#### GET - [**/api/v1.0/doctors/{id}**] - Get an existing doctor #### GET - [**/api/v1.0/doctors/{id}**] - Get an existing doctor
@ -77,6 +122,12 @@ Hospital Management API built in Spring Boot
} }
``` ```
- **Request Headers:**
| Key | Description |
| ------------- | ------------- |
| `Authorization` | _Authorization token_ |
- **Request Parameters:** - **Request Parameters:**
| Key | Description | | Key | Description |
@ -89,6 +140,7 @@ Hospital Management API built in Spring Boot
| ------------- | ------------- | | ------------- | ------------- |
| `200` | _Successful operation_ | | `200` | _Successful operation_ |
| `404` | _Entity not found_ | | `404` | _Entity not found_ |
| `403` | _Unauthorized / Invalid token_ |
#### GET - [**/api/v1.0/doctors**] - Get a list of doctors #### GET - [**/api/v1.0/doctors**] - Get a list of doctors
@ -143,6 +195,12 @@ Hospital Management API built in Spring Boot
} }
``` ```
- **Request Headers:**
| Key | Description |
| ------------- | ------------- |
| `Authorization` | _Authorization token_ |
- **Request Parameters:** - **Request Parameters:**
| Key | Description | | Key | Description |
@ -156,6 +214,7 @@ Hospital Management API built in Spring Boot
| Code | Description | | Code | Description |
| ------------- | ------------- | | ------------- | ------------- |
| `200` | _Successful operation_ | | `200` | _Successful operation_ |
| `403` | _Unauthorized / Invalid token_ |
#### PUT - [**/api/v1.0/doctors**] - Updates an existing doctor #### PUT - [**/api/v1.0/doctors**] - Updates an existing doctor
@ -178,12 +237,19 @@ Hospital Management API built in Spring Boot
} }
``` ```
- **Request Headers:**
| Key | Description |
| ------------- | ------------- |
| `Authorization` | _Authorization token_ |
- **Responses:** - **Responses:**
| Code | Description | | Code | Description |
| ------------- | ------------- | | ------------- | ------------- |
| `200` | _Successful operation_ | | `200` | _Successful operation_ |
| `400` | _Validation Error_ | | `400` | _Validation Error_ |
| `403` | _Unauthorized / Invalid token_ |
#### DELETE - [**/api/v1.0/doctors/{id}**] - Deactivates an existing doctor #### DELETE - [**/api/v1.0/doctors/{id}**] - Deactivates an existing doctor
@ -210,6 +276,12 @@ Hospital Management API built in Spring Boot
} }
``` ```
- **Request Headers:**
| Key | Description |
| ------------- | ------------- |
| `Authorization` | _Authorization token_ |
- **Request Parameters:** - **Request Parameters:**
| Key | Description | | Key | Description |
@ -223,6 +295,7 @@ Hospital Management API built in Spring Boot
| `200` | _Successful operation_ | | `200` | _Successful operation_ |
| `400` | _Validation Error_ | | `400` | _Validation Error_ |
| `404` | _Entity not found_ | | `404` | _Entity not found_ |
| `403` | _Unauthorized / Invalid token_ |
### /patients ### /patients
@ -247,12 +320,19 @@ Hospital Management API built in Spring Boot
} }
``` ```
- **Request Headers:**
| Key | Description |
| ------------- | ------------- |
| `Authorization` | _Authorization token_ |
- **Responses:** - **Responses:**
| Code | Description | | Code | Description |
| ------------- | ------------- | | ------------- | ------------- |
| `201` | _Successfully created_ | | `201` | _Successfully created_ |
| `400` | _Validation Error_ | | `400` | _Validation Error_ |
| `403` | _Unauthorized / Invalid token_ |
#### GET - [**/api/v1.0/patients/{id}**] - Get an existing patient #### GET - [**/api/v1.0/patients/{id}**] - Get an existing patient
@ -278,6 +358,12 @@ Hospital Management API built in Spring Boot
} }
``` ```
- **Request Headers:**
| Key | Description |
| ------------- | ------------- |
| `Authorization` | _Authorization token_ |
- **Request Parameters:** - **Request Parameters:**
| Key | Description | | Key | Description |
@ -290,6 +376,7 @@ Hospital Management API built in Spring Boot
| ------------- | ------------- | | ------------- | ------------- |
| `200` | _Successful operation_ | | `200` | _Successful operation_ |
| `404` | _Entity not found_ | | `404` | _Entity not found_ |
| `403` | _Unauthorized / Invalid token_ |
#### GET - [**/api/v1.0/patients**] - Get a list of patients #### GET - [**/api/v1.0/patients**] - Get a list of patients
@ -341,6 +428,12 @@ Hospital Management API built in Spring Boot
} }
``` ```
- **Request Headers:**
| Key | Description |
| ------------- | ------------- |
| `Authorization` | _Authorization token_ |
- **Request Parameters:** - **Request Parameters:**
| Key | Description | | Key | Description |
@ -354,6 +447,7 @@ Hospital Management API built in Spring Boot
| Code | Description | | Code | Description |
| ------------- | ------------- | | ------------- | ------------- |
| `200` | _Successful operation_ | | `200` | _Successful operation_ |
| `403` | _Unauthorized / Invalid token_ |
#### PUT - [**/api/v1.0/patients**] - Updates an existing patient #### PUT - [**/api/v1.0/patients**] - Updates an existing patient
@ -375,12 +469,19 @@ Hospital Management API built in Spring Boot
} }
``` ```
- **Request Headers:**
| Key | Description |
| ------------- | ------------- |
| `Authorization` | _Authorization token_ |
- **Responses:** - **Responses:**
| Code | Description | | Code | Description |
| ------------- | ------------- | | ------------- | ------------- |
| `200` | _Successful operation_ | | `200` | _Successful operation_ |
| `400` | _Validation Error_ | | `400` | _Validation Error_ |
| `403` | _Unauthorized / Invalid token_ |
#### DELETE - [**/api/v1.0/patients/{id}**] - Deactivates an existing patient #### DELETE - [**/api/v1.0/patients/{id}**] - Deactivates an existing patient
@ -405,6 +506,12 @@ Hospital Management API built in Spring Boot
} }
``` ```
- **Request Headers:**
| Key | Description |
| ------------- | ------------- |
| `Authorization` | _Authorization token_ |
- **Request Parameters:** - **Request Parameters:**
| Key | Description | | Key | Description |
@ -418,3 +525,4 @@ Hospital Management API built in Spring Boot
| `200` | _Successful operation_ | | `200` | _Successful operation_ |
| `400` | _Validation Error_ | | `400` | _Validation Error_ |
| `404` | _Entity not found_ | | `404` | _Entity not found_ |
| `403` | _Unauthorized / Invalid token_ |