Skip to content

urrestarazu-alejandro/SpringBootFakeApi

 
 

Repository files navigation

Photogram fake api

Description

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.

Technologies

Usage

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

Available enpoints


  • 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

Run in Postman

Docker

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

Author

Alejandro Manuel Urrestarazu

About

REST service to consume the Fake API offered by https://jsonplaceholder.typicode.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 99.8%
  • Dockerfile 0.2%