Repository navigation
API Contracts Demo 2
Endpoint: POST /api/register
Content-Type: application/json
{
"username": "example_username",
"password": "ExampleP@assword123",
"email": "example@email.com"
}- The username must be unique.
- The password must meet the following requirements:
- Must be at least 8 characters long.
- Must include at least one uppercase character:
A-Z. - Must include at least one digit:
0-9. - Must include at least one lowercase character:
a-z. - Must include at least one special character, for example:
!,@,#.
- The email must be unique and meet the following requirements:
- At least one of the following characters in any order:
0-9,A-Z,a-z,_,.,+, or-. - An
@character follows the requirement above. - At least one of the following characters in any order:
0-9,a-z,A-Z,., or-. - A
.follows the requirement above. - At least two of the following characters in any order:
A-Zora-z.
- At least one of the following characters in any order:
Status Code: 201
{
"status": "success",
"message": "Account created successfully"
}Status Code: 400
{
"status": "error",
"message": "Invalid or missing username"
}-
400- Returned when there are invalid or missing fields in the request body. -
409- Returned when the email or username in the request body is not unique. -
422- Validation Error
Endpoint: POST /api/login
Content-Type: application/json
{
"username": "example_username",
"password": "ExampleP@assword123"
}- The password must meet the following requirements:
- Must be at least 8 characters long.
- Must include at least one uppercase character:
A-Z. - Must include at least one digit:
0-9. - Must include at least one lowercase character:
a-z. - Must include at least one special character, for example:
!,@,#.
Status Code: 200
{
"status": "success",
"token": "Example_token_here"
}Status Code: 401
{
"status": "error",
"message": "Invalid or missing username"
}-
400- Returned when the password or email in the request body does not meet requirements. -
401- Returned when the password is incorrect. -
404- Returned when the user does not exist. -
409- Returned when the email or username in the request body is not unique. -
422- Validation Error
Endpoint: Post /api/fetchUsers
No parameters
No parameters
status code: 200 application/json
{
"status": "success",
"users": user[]
}users would have a list of all the users and appropriate details
application/json status code: 403
{
"status":"error",
"message": "User unauthorized"
}- 401- Returned when JWT is invalid
- 500 - Returned when an Unknown server error occurs
Endpoint: POST /api/changeUserRole
No parameters
json:
{
"userId": "string",
"NewRole": "string"
}status code: 200 application/json
{
"status": "success",
"message": "User role updated to {new_role} successfully"
}{new_role} is the new role of the individual
application/json status code: 403
{
"status": "error",
"message": "User unauthorized"
}- 400 - When a Bad request is sent to the endpoint
- 401- Returned when JWT is
- 403 -When the admin tries to change their own role or the user does not have authorization to use this endpoint
- 404 - When the user is not found
- 500 - Returned when an Unknown server error occurs or database error
Endpoint: DELETE /api/users/{user_id}
user_id : string
This is the user's uuid
No requesst Body
status code: 200 application/json
{
"status": "success",
"message": "User deleted successfully."
}application/json status code: 403
{
"status": "error",
"message": "User unauthorized"
}- 400 - When a Bad request is sent to the endpoint or when the Admin tries to delete themselves
- 401- Returned when JWT is
- 403 - the user does not have authorization to use this endpoint
- 404 - When the user is not found
- 500 - Returned when an Unknown server error occurs or database error
Endpoint: /api/refreshToken
No paramters
No requesst Body
status code: 200 application/json
{
"status": "success",
"message": "Token does not need refreshing"
}or
{
"status": "success",
"message": "Token refreshed"
}application/json status code: 401
{
"status": "error",
"message": "Token missing required fields"
}- 401- When the user is not authenticated
- 500 - Returned when an Unknown server error occurs or database error
Endpoint: POST /api/createCase
Content-Type: application/jsonAuthorization: Bearer <token_here>
{
"title": "Example title here",
"description": "Example description of the case here."
}- The title cannot be blank or missing.
Status Code: 201
{
"status": "success",
"CaseId": "Example_case_id_here"
}Status Code: 403
{
"status": "error",
"message": "User unauthorized"
}-
400- Returned when the request body does not meet the requirements. -
401- Returned when there is a JWT-related error. -
403- Returned when the user is not authorized to access the endpoint.
Endpoint: POST /api/getCases
Content-Type: application/jsonAuthorization: Bearer <token_here>
{}Status Code: 201
{
"status": "success",
"cases": [
{
"CaseId": "Example id here",
"CaseCreator": "Creator here",
"CaseName": "Suspicious AI-generated claim",
"CaseReviews": null,
"CaseDescription": "Example description",
"CaseClosed": false,
"CaseCreationDate": "2026-05-21T11:30:00"
}
]
}Status Code: 401
{
"status": "error",
"message": "JWT related error here"
}-
401- Returned when there is a JWT-related error.
Endpoint: POST /api/getCases
Content-Type: application/jsonAuthorization: Bearer <token_here>
{
"caseID": "Some case ID"
}- The
caseIDmust not be missing or empty. - The
caseIDmust be a valid UUID.
Status Code: 200
{
"status": "success",
"case": {
"CaseId": "Example id here",
"CaseCreator": "Creator here",
"CaseName": "Suspicious AI-generated claim",
"CaseReviews": null,
"CaseDescription": "Example description",
"CaseClosed": false,
"CaseCreationDate": "2026-05-21T11:30:00"
}
}Status Code: 404
{
"status": "error",
"message": "Case not found"
}-
400- Returned when thecaseIDis missing. -
401- Returned when thecaseIDis not a valid UUID or there is a JWT-related error. -
404- Returned when the case does not exist.
Endpoint: POST /api/cases/evidence
Content-Type: multipart/form-dataAuthorization: Bearer <token_here>
{
"caseID": "Some case ID",
"media": "uploaded file"
}- The
caseIDmust not be missing or empty. - The
caseIDmust be a valid UUID. - The media file must be uploaded.
Status Code: 201
{
"status": "success",
"evidence": {
"MediaId": "Example media UUID here",
"url": "http://localhost:9000/example-bucket/example-file.png",
"Status": "uploaded"
}
}Status Code: 404
{
"status": "error",
"message": "Case not found"
}-
400- Returned when the file extension is unsupported or thecaseIDis invalid. -
401- Returned when there are JWT or UUID errors. -
403- Returned when the user is unauthorized. -
404- Returned when the case does not exist. -
422- Returned by FastAPI when the case media is missing from the form.
Endpoint: POST /api/closeCase
No Parameters
{
"CaseID": "string"
}Status Code: 200
{
"status": "success",
"message": "Case closed successfully."
}Status code: 500
{
"status": "error",
"message": "Database error"
}-
400- Returned when thecaseIDis missing or invalid JWT - 404 - When the case is not found or you are unauthorised to use the endpoint
- 500 - When there was a database error or an internal server error
Endpoint: POST /api/updateCase
No Parameters
Required
{
"CaseID": "string",
"CaseName": "string",
"CaseDescription": "string"
}Status Code: 200
{
"status": "success",
"message": "Case updated successfully."
}Status code: 500
{
"status": "error",
"message": "Database error"
}-
400- Returned when thecaseIDis missing or invalid or if the request body does not have everything - 401 - Returned if the JWT is invalid
- 404 - Returned if case not found or user unauthorised
- 500 - When there was a database error or an internal server error
Endpoint: POST /api/editComment/case/{case_id}/comment/{comment_id}
case_id: string *required*
is the uuid of the case
comment_id: integer *required*
The id of the comment
Required
{
"comment": "string"
}Status Code: 200
{
"status": "success",
"message": "Comment edit successfully."
}Status code: 500
{
"status": "error",
"message": "Database error"
}-
400- Returned when thecaseIDis missing or invalid - 401 - Returned if the JWT is invalid
- 404 - Returned if case not found or user unauthorised
- 500 - When there was a database error or an internal server error
Endpoint: DELETE /api/deleteComment/comment/{comment_id}
comment_id: integer *required*
The id of the comment
Required
{
"comment": "string"
}Status Code: 200
{
"status": "success",
"message": "Comment edit successfully."
}Status code: 500
{
"status": "error",
"message": "Database error"
}-
400- Returned when thecaseIDis missing or invalid - 401 - Returned if the JWT is invalid
- 404 - Returned if comment not found or user unauthorised
- 500 - When there was a database error or an internal server error
Endpoint: POST /api/getComments/{case_id}
case_id: string *required*
The uuuid of the case
Status Code: 200
{
"status": "success",
"comments": json of the comments
}Status code: 500
{
"status": "error",
"message": "Database error"
}- 403 - Returned if the JWT is invalid
- 500 - When there was a database error or an internal server error
Endpoint: POST /api/delete/case/{case_id}/evidence/{media_id}
case_id: string *reguired*
the uuid of the case
media_id: string *regular*
the uuid of the media
Status Code: 200
{
"status": "success",
"Deleted": media_id
}Status code: 500
{
"status": "error",
"message": "Database error"
}- 400 - Invalid uuid for case id
- 401 - Returned if the JWT is invalid
- 403 - Unauthorized to delete this evidence or record not found
- 404 - Returned if the media was not found or user unauthorised
- 500 - When there was a database error or an internal server error
Endpoint: POST /api/cases/comments
no paramters
{
"case_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"comment": "string"
}Status Code: 201
{
"status": "success",
"comment": THe new comment
}Status code: 500
{
"status": "error",
"message": "Database error"
}- 400 - Returned if the comment is empty
- 401 - Returned if the JWT is invalid
- 500 - When there was a database error or an internal server error
Endpoint: DELETE /api/deleteCase
no paramters
{
"CaseID": "string"
}Status Code: 201
{
"status": "success",
"message": "Case deleted successfully"
}Status code: 403
{
"status": "error",
"message": "Invalid token or database failure"
}- 400 - Returned if the caseID is empty
- 401 - Returned if the case id is invalid
- 403 - Returned if any other than the case owner tries to delete the case
- 404 - Returned if the case is not found
- 500 - When there was a database error or an internal server error
Endpoint: POST /api/saveAnnotations
no paramters
{
"reportId": "string",
"annotations": [
{
"additionalProp1": {}
}
]
}Status Code: 200
{
"status": "success"
}Status code: 401
{
"status": "error",
"message": "Signature has expired."
}- 401 - Returned if the JWT expired or if the UUID is malformed
- 403 - User unauthorized
- 404 - Returned if the case is not found
- 500 - When there was a database error or an internal server error
- User Stories
- Use Cases
- Use Case Diagrams
- Functional Requirements
- API Service Contracts
- Quality Requirements
- Constraints
- Technologies Required
- Architecture Diagram
- Domain Model
- Introduction
- User Stories
- Use Case Diagrams
- Functional Requirements
- Non-Functional Requirements
- Domain Model
- Introduction
- User Stories
- Use Case Diagrams
- Functional Requirements
- Non-Functional Requirements
- Domain Model
- Introduction
- Architectural Requirements
- Technology Requirements
- API Contracts
- Deployment
- NFR Testing
- NFR Traceability Matrix
- Introduction
- User Stories
- Use Case Diagrams
- Functional Requirements
- Non-Functional Requirements
- Domain Model
- Introduction
- Architectural Requirements
- Technology Requirements
- API Contracts
- Deployment
- NFR Testing
- NFR Traceability Matrix