This service provides endpoints for managing images and slideshows, including adding, deleting, and retrieving ordered images in a slideshow, as well as recording proof-of-play events.
Build project using maven command:
mvn clean install
Run server using Docker compose: docker compose up
The application will be available at http://localhost:8080
- Endpoint:
POST /images/addImage
- Description: Adds a new image to the system.
There is validation if URL actually contains an image (JPEG, PNG, WEBP and other).
{
"url": "https://xclcamps.com/wp-content/uploads/coding-difference-1.jpg"
}
- Endpoint:
DELETE /images/deleteImage/{id}
- Path Parameter:
id
- The ID of the image to be deleted (integer).
Expected Response: HTTP Status: 204 No Content
- Endpoint:
GET /images/search
- Description: Search for images using optional query parameters: keyword and duration.
GET /images/search?keyword=beach&duration=10
Response Body:
[
{
"id": 1,
"url": "https://xclcamps.com/wp-content/uploads/coding-difference-4.jpg",
"createdAt": "2025-01-15T17:03:05.473611",
"slideshowIds": [
1,
2,
3
]
},
{
"id": 3,
"url": "https://xclcamps.com/wp-content/uploads/coding-difference-1.jpg",
"createdAt": "2025-01-15T19:19:14.926455",
"slideshowIds": [
1,
2,
3
]
}
]
- Endpoint:
POST /slideshow/addSlideshow
- Description: Adds a new slideshow to the system.
{
"images": [
{ "imageId": 1, "duration": 10 },
{ "imageId": 4, "duration": 15 },
{ "imageId": 5, "duration": 8 }
]
}
- Endpoint:
DELETE /slideshow/deleteSlideshow/{id}
- Path Parameter:
id
- The ID of the slideshow to be deleted (integer).
Expected Response: HTTP Status: 204 No Content
- Endpoint:
GET /slideshow/{id}/slideshowOrder
- Description: Retrieves the ordered images in a slideshow by its ID.
- Path Parameter:
id
- The ID of the slideshow (integer).
GET /slideshow/1/slideshowOrder
Response Body:
[
{
"id": 1,
"url": "https://xclcamps.com/wp-content/uploads/coding-difference-4.jpg",
"createdAt": "2025-01-15T17:03:05.473611",
"slideshowIds": [
1,
2,
3
]
},
{
"id": 3,
"url": "https://xclcamps.com/wp-content/uploads/coding-difference-1.jpg",
"createdAt": "2025-01-15T19:19:14.926455",
"slideshowIds": [
1,
2,
3
]
}
]
- Endpoint:
POST /slideshow/{id}/proof-of-play/{imageId}
- Description: Simulates the playback of a slideshow and sends a proof-of-play event when an image is played.
During the simulation, each image in the slideshow that is tracked in the image-to-track cache is "played" sequentially, and proof-of-play events that are published by
SpringEventPublisher
are logged for each image.
To verify the event, check the application logs for entries similar to:
Proof of Play Event | Slideshow ID: 1 | Image ID: 3.
POST /slideshow/1/proof-of-play/2