Skip to content

API Documentation

Ömer Faruk Erzurumluoğlu edited this page May 18, 2024 · 1 revision

API Documentation for RegisteredUserController

Base URL

All API requests are made to:

/api/users

Endpoints

POST /register

This endpoint is used to register a new user.

Request

The request body must include a JSON object with the following properties:

  • userName (string): The username of the user.
  • email (string): The email of the user.
  • password (string): The password of the user.
  • name (string): The name of the user.
  • birthday (date): The birthday of the user.
  • bio (string): The bio of the user.
  • profilePicture (byte array): The profile picture of the user.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the registration was successful.
  • message (string): A message describing the result of the operation.

POST /login

This endpoint is used to login a user.

Request

The request body must include a JSON object with the following properties:

  • userName (string): The username of the user.
  • password (string): The password of the user.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the login was successful.
  • message (string): A message describing the result of the operation.
  • token (string): The JWT token for the authenticated session.

POST /details

This endpoint is used to get the details of a user.

Request

The request body must include a JSON object with the following properties:

  • username (string): The username of the user.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the operation was successful.
  • message (string): A message describing the result of the operation.
  • user (object): The user object with all the details of the user.

API Documentation for PostController

Base URL

All API requests are made to:

/api/posts

Endpoints

POST /create

This endpoint is used to create a new post.

Request

The request body must include a JSON object with the following properties:

  • username (string): The username of the user.
  • media (byte array): The media of the post.
  • animalName (string): The name of the animal in the post.
  • caption (string): The caption of the post.
  • location (string): The location of the post.
  • photoDate (date): The date of the photo.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the post creation was successful.
  • message (string): A message describing the result of the operation.

POST /getByUser

This endpoint is used to get the posts of a specific user.

Request

The request body must include a JSON object with the following properties:

  • username (string): The username of the user.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the operation was successful.
  • message (string): A message describing the result of the operation.
  • posts (array): An array of post objects.

POST /getByAnimalName

This endpoint is used to get the posts by animal name.

Request

The request body must include a JSON object with the following properties:

  • animalName (string): The name of the animal.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the operation was successful.
  • message (string): A message describing the result of the operation.
  • posts (array): An array of post objects.

POST /getByFamily

This endpoint is used to get the posts by family.

Request

The request body must include a JSON object with the following properties:

  • family (string): The family of the animal.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the operation was successful.
  • message (string): A message describing the result of the operation.
  • posts (array): An array of post objects.

GET /getFeed

This endpoint is used to get the feed of posts.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the operation was successful.
  • message (string): A message describing the result of the operation.
  • posts (array): An array of post objects.

POST /getUserPostInteractions

This endpoint is used to get the interactions of a user with a post.

Request

The request body must include a JSON object with the following properties:

  • postID (integer): The ID of the post.
  • username (string): The username of the user.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the operation was successful.
  • message (string): A message describing the result of the operation.
  • isLiked (boolean): Indicates if the user liked the post.
  • isDisliked (boolean): Indicates if the user disliked the post.
  • isBookmarked (boolean): Indicates if the user bookmarked the post.

API Documentation for LikeController

Base URL

All API requests are made to:

/api/users

Endpoints

POST /like

This endpoint is used to like a post.

Request

The request body must include a JSON object with the following properties:

  • username (string): The username of the user.
  • postID (integer): The ID of the post.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the like operation was successful.
  • message (string): A message describing the result of the operation.

POST /unlike

This endpoint is used to unlike a post.

Request

The request body must include a JSON object with the following properties:

  • username (string): The username of the user.
  • postID (integer): The ID of the post.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the unlike operation was successful.
  • message (string): A message describing the result of the operation.

POST /getLikeCount

This endpoint is used to get the like count of a post.

Request

The request body must include a JSON object with the following properties:

  • postID (integer): The ID of the post.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the operation was successful.
  • message (string): A message describing the result of the operation.
  • likeCount (integer): The like count of the post.

API Documentation for DislikeController

Base URL

All API requests are made to:

/api/users

Endpoints

POST /dislike

This endpoint is used to dislike a post.

Request

The request body must include a JSON object with the following properties:

  • username (string): The username of the user.
  • postID (integer): The ID of the post.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the dislike operation was successful.
  • message (string): A message describing the result of the operation.

POST /undislike

This endpoint is used to undislike a post.

Request

The request body must include a JSON object with the following properties:

  • username (string): The username of the user.
  • postID (integer): The ID of the post.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the undislike operation was successful.
  • message (string): A message describing the result of the operation.

POST /getDislikeCount

This endpoint is used to get the dislike count of a post.

Request

The request body must include a JSON object with the following properties:

  • postID (integer): The ID of the post.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the operation was successful.
  • message (string): A message describing the result of the operation.
  • likeCount (integer): The dislike count of the post.

API Documentation for CommentController

Base URL

All API requests are made to:

/api/comment

Endpoints

POST /post

This endpoint is used to post a comment.

Request

The request body must include a JSON object with the following properties:

  • username (string): The username of the user.
  • postID (integer): The ID of the post.
  • description (string): The content of the comment.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the comment posting was successful.
  • message (string): A message describing the result of the operation.

POST /delete

This endpoint is used to delete a comment.

Request

The request body must include a JSON object with the following properties:

  • commentID (integer): The ID of the comment.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the comment deletion was successful.
  • message (string): A message describing the result of the operation.

POST /getByPostID

This endpoint is used to get the comments of a specific post.

Request

The request body must include a JSON object with the following properties:

  • postID (integer): The ID of the post.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the operation was successful.
  • message (string): A message describing the result of the operation.
  • comments (array): An array of comment objects.

POST /getByUsername

This endpoint is used to get the comments of a specific user.

Request

The request body must include a JSON object with the following properties:

  • username (string): The username of the user.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the operation was successful.
  • message (string): A message describing the result of the operation.
  • comments (array): An array of comment objects.

API Documentation for BookmarkController

Base URL

All API requests are made to:

/api/users

Endpoints

POST /bookmark

This endpoint is used to bookmark a post.

Request

The request body must include a JSON object with the following properties:

  • username (string): The username of the user.
  • postID (integer): The ID of the post.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the bookmark operation was successful.
  • message (string): A message describing the result of the operation.

POST /unbookmark

This endpoint is used to unbookmark a post.

Request

The request body must include a JSON object with the following properties:

  • username (string): The username of the user.
  • postID (integer): The ID of the post.

Response

The response body returns a JSON object with the following properties:

  • success (boolean): Indicates if the unbookmark operation was successful.
  • message (string): A message describing the result of the operation.

API Documentation for SearchController

Base URL

All API requests are made to:

/api

Endpoints

POST /search

This endpoint is used to search for a term in the application.

Request

The request body must include a JSON object with the following properties:

  • searchTerm (string): The term to be searched.

Response

The response body returns a JSON object with the following properties:

  • animalInfoSearch (array): An array of AnimalInfoSearch objects that match the search term.
  • users (array): An array of RegisteredUser objects that match the search term.
  • posts (array): An array of Post objects that match the search term.
  • userShouldClarify (boolean): Indicates if the user should clarify the search term.
Clone this wiki locally