The Media Service is a RESTful API for storage, retrieval, and management of media files like images and banners for the application.
-
Service port: 8086
-
Database port: 5436
The database schema includes the following tables:
CREATE TABLE images (
id SERIAL PRIMARY KEY,
name VARCHAR(255),
type VARCHAR(255),
data BYTEA
);
BASE URL: /api/media
.
All calls to this service must start with the base URL. Any additional URL fields will be specified if relevant.
-
Method: POST
-
Endpoint:
/user/upload-profile-picture
-
Description: Upload a user's profile picture to the service.
-
Query Parameters:
file
(MultipartFile) – The profile picture.-
{ "ownerUserId": "uuid" }
-
Response:
{
"message": "string",
"imageUrl": "string",
"imageName": "string",
"type": "string"
}
- Response HTTP Status:
200 OK
– Picture successfully uploaded.
-
Method: POST
-
Endpoint:
/user/upload-banner-picture
-
Description: Upload a user's banner picture to the service.
-
Query Parameters:
file
(MultipartFile) – The banner picture.-
{ "ownerUserId": "uuid" }
-
Response:
{
"message": "string",
"imageUrl": "string",
"imageName": "string",
"type": "string"
}
- Response HTTP Status:
200 OK
– Picture successfully uploaded.
-
Method: POST
-
Endpoint:
/group/upload-profile-picture
-
Description: Upload a group's profile picture to the service.
-
Query Parameters:
file
(MultipartFile) – The profile picture.-
{ "ownerUserId": "uuid" }
-
Response:
{
"message": "string",
"imageUrl": "string",
"imageName": "string",
"type": "string"
}
- Response HTTP Status:
200 OK
– Picture successfully uploaded.
-
Method: POST
-
Endpoint:
/group/upload-banner-picture
-
Description: Upload a group's banner picture to the service.
-
Query Parameters:
file
(MultipartFile) – The banner picture.-
{ "ownerUserId": "uuid" }
-
Response:
{
"message": "string",
"imageUrl": "string",
"imageName": "string",
"type": "string"
}
- Response HTTP Status:
200 OK
– Picture successfully uploaded.
-
Method: GET
-
Endpoint:
/id
-
Description: Retrieves the image by its ID.
-
Path Variable:
id
(Long) – The image's ID.
-
Response:
ret
(byte[]) – A byte array of the retrieved image.
-
Response HTTP Status:
-
200 OK
– Image successfully retrieved. -
404 Not Found
– Image with the specified ID not found.
-
-
400 Bad Request
– The request could not be understood or was missing required parameters. -
404 Not Found
– The specified resource could not be found. -
500 Internal Server Error
– An error occurred on the server.
-
Make sure to include the
Content-Type: application/json
header in your requests. -
Use valid UUIDs in your requests.