REST service to consume the Fake API offered by https://jsonplaceholder.typicode.com This API simulates having a list of fans, from which you can get their posts and also create, modify and delete comments.
- Java 8
- Jacaco (https://www.jacoco.org/jacoco/)
- project lombok (https://projectlombok.org/)
- gson (https://sites.google.com/site/gson/)
- JUnit (https://junit.org/junit5/)
- Checkstyle (https://checkstyle.sourceforge.io/)
- Clean architecture (https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html)
- swagger: https://swagger.io/tools/swagger-ui/
- jackson: https://github.com/FasterXML/jackson-dataformat-xml
The application runs on port 8080 by default. First of all you must get a session token to run the endpoints. (GET localhost:8080/photogram/api/v1/user/1/session)
Then use it in the call header, adding the key "session-token".
Swagger: http://localhost:8080/swagger-ui.html
- GET localhost:8080/photogram/api/v1/ping
used to validate that the API is up
- GET localhost:8080/photogram/api/v1/user/{userId}/session
Gets a token session
- PUT localhost:8080/photogram/api/v1/fan/{fanId}
Adds a fanatic
- GET localhost:8080/photogram/api/v1/fan/{fanId}/posts
Gets posts from a fan
- POST localhost:8080/photogram/api/v1/post/{postId}/comment
Body
{
"newComment": "welcome!"
}
comment on a posts
- GET localhost:8080/photogram/api/v1/post/{postId}/comments
List all comments of a post
-
PUT localhost:8080/photogram/api/v1/comment/1`
Body
{ "postId": 1, "name": "nombre otro", "email": "mi@gmail.com", "body": "Que lindo!" } ``
Update a comment
- DEL localhost:8080/photogram/api/v1/comment/{commentId}
Delete a comment
- GET localhost:8080/photogram/api/v1/fan/report/{format}
Generate a JSON or XML fan's report
To build a Docker image:
docker build -t "fake-api-docker-img" .
To crate a Docker container from an image and starts the container:
docker run --name fake-api-docker -p 8080:8080 fake-api-docker-img:latest
Alejandro Manuel Urrestarazu