Skip to content

Detailed API Documentation

Subhrodip Mohanta edited this page Jun 26, 2021 · 7 revisions

Authentication API

POST /authenticate

Request

{
  "username": "username",
  "password": "Password"
}

Response

{
  "jwt": "JSON.Web.Token"
}

Authenticate the User and provides them with a JWT token as a response

User Related APIs

GET /users/@{username}

Request

curl -X GET "http://localhost:8082/users/%40first"

Response

{
  "id": "30761418-70e6-46dc-8af5-17670e78f293",
  "username": "first",
  "name": "Nice Name",
  "avatar": "URL://updated-picture.png",
  "bio": "Updated Bio",
  "followerCount": 0,
  "followingCount": 0,
  "verified": false
}

Get details of a given user by username

GET /users/{userid}

Request

curl -X GET "http://localhost:8082/users/30761418-70e6-46dc-8af5-17670e78f293"

Response

{
  "id": "30761418-70e6-46dc-8af5-17670e78f293",
  "username": "first",
  "name": "Nice Name",
  "avatar": "URL://updated-picture.png",
  "bio": "Updated Bio",
  "followerCount": 0,
  "followingCount": 0,
  "verified": false
}

Get details of a given user by userid

POST /users

Request

{
  "username": "first",
  "name": "Nice Name",
  "bio": "Bio of 240 characters",
  "avatar": "URL://picture.png"
}

Response

{
  "id": "30761418-70e6-46dc-8af5-17670e78f293",
  "username": "first",
  "name": "Nice Name",
  "avatar": "URL://picture.png",
  "bio": "Bio of 240 characters",
  "followerCount": 0,
  "followingCount": 0,
  "verified": false
}

Create a new user

PATCH /users πŸ”’

Request

{
  "id": "30761418-70e6-46dc-8af5-17670e78f293",
  "username": "first",
  "name": "Nice Name",
  "avatar": "URL://updated-picture.png",
  "bio": "Updated Bio"
}

Response

{
  "id": "30761418-70e6-46dc-8af5-17670e78f293",
  "username": "first",
  "name": "Nice Name",
  "avatar": "URL://updated-picture.png",
  "bio": "Updated Bio",
  "followerCount": 0,
  "followingCount": 0,
  "verified": false
}

Update bio/name/image etc of an user

PUT /users/{userid}/follow πŸ”’

Request

{
  "username": "username",
  "password": "Password"
}

Response

{
  "jwt": "JSON.Web.Token"
}

Follow the given user

DELETE /users/{userid}/follow πŸ”’

Request

{
  "username": "username",
  "password": "Password"
}

Response

{
  "jwt": "JSON.Web.Token"
}

Un-follow the given user

GET /users/{userid}/followers πŸ“ƒ

Request

{
  "username": "username",
  "password": "Password"
}

Response

{
  "jwt": "JSON.Web.Token"
}

Get a list of all followers of this user

GET /users/{userid}/followings πŸ“ƒ

Request

{
  "username": "username",
  "password": "Password"
}

Response

{
  "jwt": "JSON.Web.Token"
}

Get a list of all following of this user

Post Related APIs

GET /posts πŸ“ƒ

Request

{
  "username": "username",
  "password": "Password"
}

Response

{
  "jwt": "JSON.Web.Token"
}

Get the list of all posts

GET /posts/{postid}

Request

{
  "username": "username",
  "password": "Password"
}

Response

{
  "jwt": "JSON.Web.Token"
}

Get Details of a post

POST /posts πŸ”’

Request

{
  "username": "username",
  "password": "Password"
}

Response

{
  "jwt": "JSON.Web.Token"
}

Create a new post

DELETE /posts/{postid} πŸ”’

Request

{
  "username": "username",
  "password": "Password"
}

Response

{
  "jwt": "JSON.Web.Token"
}

Delete a given post

PUT /posts/{postid}/like πŸ”’

Request

{
  "username": "username",
  "password": "Password"
}

Response

{
  "jwt": "JSON.Web.Token"
}

Like the given post

DELETE /posts/{postid}/like πŸ”’

Request

{
  "username": "username",
  "password": "Password"
}

Response

{
  "jwt": "JSON.Web.Token"
}

Un-like the given post

Hashtag Related APIs

GET /hashtags πŸ“ƒ

Request

{
  "username": "username",
  "password": "Password"
}

Response

{
  "jwt": "JSON.Web.Token"
}

Top hashtags (default top 10)

GET /hashtags/{hashtag}/posts πŸ“ƒ

Request

{
  "username": "username",
  "password": "Password"
}

Response

{
  "jwt": "JSON.Web.Token"
}

All posts of this given hashtag

01. Home

02. How to Contribute (needs splitting)

03. Entity Design

04. Technology Selection

  1. Installation

06. Lombok Configuration

  1. Project Configuration

  2. IDE Instructions

  3. Milestones and Versioning

10. API Endpoints Overview

Β Β  10.1 Request and Response Models

Β Β  10.2 Detailed API Documentation

  1. How to Test Endpoints

12. Collaboration

  1. Working with issues

  2. Reviewing pull requests

15. Static analysis

  1. Roadmap

17. Team

18. Known issues

19. Getting help

  1. Recognizing contributors
Clone this wiki locally