---
# System prepended metadata

title: Untitled

---

### 3.4 Module 4 - Content Searching, Filtering and Presentation

**Endpoints of this module:**
* R401: Front page [` /home `]
* R402: Feed page [` /feed `]
* R403: News page [` /news `]
* R404: Opinion page [` /opinions `]
* R405: Search page [` /search `]
* R406: Tag page [` /tags/{tag_id} `]
* R407: Perform post search Action [` /api/search/posts `]
* R408: Perform author/user search Action [` /api/search/users `]
* R409: Perform tag search Action [` /api/search/tags `]
* R410: Search form/modal
* R411: Perform feed posts from subscribed tags search Action [` /api/feed/tags `]
* R412: Perform feed posts from subscribed users search Action [` /api/feed/users `]

NOTE: The search functionality of the web application is not in a page, but in a modal that can appear in most pages. Therefore, they do not have an URL connected to them. Nevertheless, they will be included anyway in this section.


#### R401: Front page

|   |   |
|---|---|
| **URL**          | `/home` |
| **Description**  | Home page of the web application. |
| **Method**       | GET |
| **UI**           | [UI01](https://git.fe.up.pt/lbaw/lbaw1920/lbaw2022/-/blob/master/docs/front-page-desktop.png) |
| **Ajax Calls**  | [R407](#r407-perform-post-search-action), [R409](#r409-perform-tag-search-action) |
| **Permissions** | PUB, USR |

#### R402: Feed page

|   |   |
|---|---|
| **URL**          | `/feed` |
| **Description**  | Main feed page of the web application. |
| **Method**       | GET |
| **UI**           | [UI08](https://git.fe.up.pt/lbaw/lbaw1920/lbaw2022/-/blob/master/docs/news-opinion-feed-desktop.png) |
| **Ajax Calls**  | [R411](#r411-perform-feed-posts-from-subscribed-tags-search-action), [R412](#r412-perform-feed-posts-from-subscribed-users-search-action) |
| **Permissions** | USR |


#### R403: News page

|   |   |
|---|---|
| **URL**          | `/news` |
| **Description**  | Main news page of the web application. |
| **Method**       | GET |
| **UI**           | [UI08](https://git.fe.up.pt/lbaw/lbaw1920/lbaw2022/-/blob/master/docs/news-opinion-feed-desktop.png) |
| **Ajax Calls**  | [R407](#r407-perform-post-search-action), [R409](#r409-perform-tag-search-action) |
| **Permissions** | PUB, USR |

#### R404: Opinions page

|   |   |
|---|---|
| **URL**          | `/opinions` |
| **Description**  | Main opinions page of the web application. |
| **Method**       | GET |
| **UI**           | [UI08](https://git.fe.up.pt/lbaw/lbaw1920/lbaw2022/-/blob/master/docs/news-opinion-feed-desktop.png) |
| **Ajax Calls**  | [R407](#r407-perform-post-search-action), [R409](#r409-perform-tag-search-action) |
| **Permissions** | PUB, USR |

#### R405: Search page

|   |   |
|---|---|
| **URL**          | `/search` |
| **Description**  | Page that shows the search results of the query previously inserted by the user. |
| **Method**       | GET |
| **UI**           | [UI11](https://git.fe.up.pt/lbaw/lbaw1920/lbaw2022/-/blob/master/docs/search-results.png) |
| **Ajax Calls**  | [R407](#r407-perform-post-search-action), [R408](#r408-perform-authoruser-search-action), [R409](#r409-perform-tag-search-action) |
| **Permissions** | PUB, USR |

#### R406: Tag page

|   |   |
|---|---|
| **URL**          | `/tags/{tag_id}` |
| **Description**  | Page that displays news and opinions that have a given tag in common. |
| **Parameters**   | +tag_id: integer | Tag primary key|
| **Method**       | GET |
| **UI**           | [UI10](https://git.fe.up.pt/lbaw/lbaw1920/lbaw2022/-/blob/master/docs/tagpage-desktop.png) |
| **Ajax Calls**  | [R407](#r407-perform-post-search-action)|
| **Permissions** | PUB, USR |

#### R407: Perform post search Action

|   |   |   |
|---|---|---|
| **URL**           | `/api/search/posts` | |
| **Description**   | API call that searches, filters and selects posts. Posts come ordered by date (most recent first) and likes (most liked first).| |
| **Method**        | GET | |
| **Parameters**  | ?search: string | query string inserted by the user, that can refer to either the title, the body or the author name of the post  |
|                   | ?author: string | Can be either 'subscribed' for subscribed users' posts, 'verified'  for verified users' posts or both (separated by commas) |
|                   | ?begin: string | Starting date for filtering the posts; they cannot be older than this date  |
|                   | ?end: string | Ending date for filtering the posts; they cannot be newer than this date  |
|                   | ?min: integer | Minimum number of likes that the post can have  |
|                   | ?max: integer | Maximum number of likes that the post can have  |
|                   | ?tags: string | String containing tags id that the post can have (separated by commas)  |
|                   | ?type: string | 'News' or 'Opinion' (can be either null or a comma separated string if we want both of them)  |
|                   | ?ppp: integer | Posts per page |
|                   | ?page: integer | Page number |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request | Error |
| **Response Body** | [JSON407](#json407-perform-post-search-action) |   |
| **Redirects**     | [R200](#r200-error-page)  | Success |
|                   | [R400](#r400-error-page)  | Error |
| **Permissions** | PUB, USR | |

#### R408: Perform author/user search Action

|   |   |   |
|---|---|---|
| **URL**          | `/api/search/users` | |
| **Description**  | API call that searches, filters and selects users. | |
| **Method**        | GET | |
| **Parameters**  | ?search: string | query string inserted by the user, that refers to the name of the user |
|                   | ?author: string | Can be either 'subscribed' for subscribed users, 'verified'  for verified users or both (separated by commas) |
|                   | ?begin: string | Starting date for filtering the birthday of the user  |
|                   | ?end: string | Ending date for filtering the birthday of the user  |
|                   | ?min: integer | Minimum number of subscribers that the user can have  |
|                   | ?max: integer | Maximum number of subscribers that the user can have  |
|                   | ?ppp: integer | Users per page |
|                   | ?page: integer | Page number |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request | Error |
| **Response Body** | [JSON408](#json408-perform-authoruser-search-action) |   |
| **Redirects**     | [R200](#r200-error-page)  | Success |
|                   | [R400](#r400-error-page)  | Error |
| **Permissions** | PUB, USR | |

#### R409: Perform tag search Action

|   |   |   |
|---|---|---|
| **URL**          | `/api/search/tags` | |
| **Description**  | API call that searches, filters and selects tags. | |
| **Method**        | GET | |
| **Parameters**  | ?search: string | query string inserted by the user, that refers to the name of the tag |
|                   | ?author: string | Can be either 'subscribed' for subscribed tags, 'verified'  for official tags or both (separated by commas) |
|                   | ?min: integer | Minimum number of subscribers that the tag can have  |
|                   | ?max: integer | Maximum number of subscribers that the tag can have  |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request | Error |
| **Response Body** | [JSON409](#json409-perform-tag-search-action) |   |
| **Redirects**     | [R200](#r200-error-page)  | Success |
|                   | [R400](#r400-error-page)  | Error |
| **Permissions** | PUB, USR | |


#### R410: Search form/modal

|   |   |
|---|---|
| **URL**           | - |
| **Description**   | Form for performing a search query for posts, users and tags.|
| **Method**        | - |
| **SUBMIT**        | [R401](#r401-front-page) |
| **Permissions**   | PUB, USR |


#### R411: Perform feed posts from subscribed tags search Action

|   |   |   |
|---|---|---|
| **URL**          | `/api/feed/tags` | |
| **Description**  | API call for fetching posts that have tags that the user has subscribed (without type discrimination) | |
| **Method**       | GET | |
| **Parameters**   | ?ppp: integer | Posts per page |
|                   | ?page: integer | Page number |
| **Returns**      | 200 OK | Success |
|                  | 400 Bad Request | Error |
|                   | 401 Unauthorized | Error (user not logged in) |
|                   | 404 Not found | Error (could not find logged in user) |
| **Response Body** | [JSON411](#json411-perform-feed-posts-from-subscribed-tags-search-action) |   |
| **Redirects**     | [R200](#r200-error-page)  | Success |
|                   | [R400](#r400-error-page)  | Error |
|                   | [R401](#r401-error-page)  | Error |
|                   | [R404](#r404-error-page)  | Error |
| **Permissions** | USR | |

#### R412: Perform feed posts from subscribed users search Action

|   |   |   |
|---|---|---|
| **URL**          | `/api/feed/users` | |
| **Description**  | API call for fetching posts that are written by subscribed users (without type discrimination).  | |
| **Method**        | GET | |
| **Parameters**    | ?ppp: integer | Posts per page |
|                   | ?page: integer | Page number |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request | Error |
|                   | 401 Unauthorized | Error (user not logged in) |
|                   | 404 Not found | Error (could not find logged in user) |
| **Response Body** | [JSON412](#json412-perform-feed-posts-from-subscribed-users-search-action) |   |
| **Redirects**     | [R200](#r200-error-page)  | Success |
|                   | [R400](#r400-error-page)  | Error |
|                   | [R401](#r401-error-page)  | Error (user not logged in) |
|                   | [R404](#r404-error-page)  | Error (could not find logged in user) |
| **Permissions** | USR | |

### 3.5 Module 5 - Post, Tag, Comment and Versions

**Endpoints of this module:**
* R501: Post page [` /posts/{post_id} `]
* R502: Fetch post info action  [` /api/posts/{post_id} `]
* R503: Rate content action [` /api/rate/{content_id} `]
* R504: Fetch post comments and replies action [` /api/posts/{post_id}/comments_replies `]
* R505: Add comment action [` /api/posts/{post_id}/comments `]
* R506: Add reply action [` /api/comments/{comment_id}/reply `]
* R507: Post versions page [` /posts/{post_id}/versions`]
* R508: Post versions action [` /api/posts/{post_id}/versions`]
* R509: Fetch posts related to the post  [` /api/posts/{post_id}/related_posts `]
* R510: Fetch tags related to the post  [` /api/posts/{post_id}/related_tags `]
* R511: Comment versions page [` /comments/{comment_id}/versions`]
* R512: Comment versions action [` /api/comments/{comment_id}/versions`]
* R513: Reply versions page [`/replies/{reply_id}/versions `]
* R514: Reply versions action [`/api/replies/{reply_id}/versions `]
* R515: Edit post page [` /posts/{post_id}/edit `]
* R516: Edit post action [` /api/posts/{post_id} `]
* R517: Edit reply action [` /api/replies/{reply_id} `]
* R518: Edit comment action [` /api/comments/{comment_id} `]
* R519: Save post action [` /api/posts/{post_id}/save `]
* R520: Make post private action [` /api/posts/{post_id}/visibility `]
* R521: Report reply action [` /api/replies/{reply_id}/report `]
* R522: Report comment action [` /api/comments/{comment_id}/report `]
* R523: Report post action [` /api/posts/{post_id}/report `]
* R524: Delete reply action [` /api/replies/{reply_id} `]
* R525: Delete comment action [` /api/comments/{comment_id} `]
* R526: Delete post action [` /api/posts/{post_id} `]
* R527: Add post action [` /api/posts/ `]
* R528: Create post page [` /posts/create `]
* R529: Report tag action [` /api/tags/{tag_id}/report `]
* R530: Delete tag action [` /api/tags/{tag_id} `]


#### R501: Post page

|   |   |
|---|---|
| **URL**          | `/posts/{post_id}` |
| **Description**  | Page that displays a post. |
| **Method**       | GET |
| **Parameters**     | +post_id: integer | Post primary key|
| **UI**           | [UI02](https://git.fe.up.pt/lbaw/lbaw1920/lbaw2022/-/blob/master/docs/post-desktop.png) |
| **Ajax Calls**  | [R502](#r502-fetch-post-info-action), [R504](#r504-fetch-post-comments-and-replies-action), [R509](#r509-fetch-posts-related-to-the-post), [R510](#r510-fetch-tags-related-to-the-post) |
| **Permissions** | PUB, USR |

#### R502: Fetch post info action

|   |   |   |
|---|---|---|
| **URL**          | `/api/posts/{post_id}` |  |
| **Description**  | Fetch the information about a post|  |
| **Parameters**    | +post_id: integer | Post primary key|
| **Method**        | GET |   |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request | Error |
|                   | 401 Unauthorized | Error (Not logged in) |
|                   | 403 Forbidden | Error (No permission) |
|                   | 404 Not Found | Error |
| **Response Body** | [JSON502](#json502-fetch-post-info-action) |   |
| **Permissions**   | PUB, USR |  |


#### R503: Rate content action

|   |   |   |
|---|---|---|
| **URL**          | `/api/rate/{content_id}` |  |
| **Description**  | Give a rating to a content (post, reply or comment) |  |
| **Method**        | POST |   |
| **Parameters**     | +content_id: integer | Content primary key|
| **Request Body**  | +rating: boolean | True for like, False for dislike  |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request | Error |
|                   | 401 Unauthorized | Error (Not logged in) |
|                   | 403 Forbidden | Error (No permission) |
|                   | 404 Not Found | Error |
| **Permissions**   | USR |  |

#### R504: Fetch post comments and replies action

|   |   |   |
|---|---|---|
| **URL**          | `/api/posts/{post_id}/comments_replies` |  |
| **Description**  | Fetch the comments of a post |  |
| **Method**        | GET |   |
| **Parameters**     | +post_id: integer | Post primary key|
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request | Error |
|                   | 404 Not Found | Error |
| **Response Body** | [JSON504](#json504-post-comments-action) |   |
| **Permissions** | PUB, USR |  |

#### R505: Add comment action

|   |   |   |
|---|---|---|
| **URL**          | `/api/posts/{post_id}/comment` |  |
| **Description**  | Add a comment to a given post |  |
| **Method**        | POST |   |
| **Parameters**     | +post_id: integer | Post primary key|
| **Request Body**  | +body: string | Comment's body  |
| **Returns**       | 201 Created | Success |
|                   | 400 Bad Request  | Error |
|                   | 401 Unauthorized | Error (Not logged in) |
|                   | 403 Forbidden | Error (No permission) |
|                   | 404 Not Found    | Error |
| **Permissions** | USR |  |

#### R506: Add reply action

|   |   |   |
|---|---|---|
| **URL**          | `/api/comments/{comment_id}/reply` |  |
| **Description**  | Reply to a comment |  |
| **Method**        | POST |   |
| **Parameters**     | +comment_id: integer | comment primary key|
| **Request Body**  | +body: string | Reply's body  |
| **Returns**       | 201 Created | Success |
|                   | 400 Bad Request  | Error |
|                   | 401 Unauthorized | Error (Not logged in) |
|                   | 403 Forbidden | Error (No permission) |
|                   | 404 Not Found    | Error |
| **Permissions** | USR |  |

#### R507: Post versions page

|   |   |
|---|---|
| **URL**          | `/posts/{post_id}/versions` |
| **Description**  | Page that displays the different versions of a post. |
| **Method**       | GET |
| **Parameters**     | +post_id: integer | Post primary key|
| **UI**           | [UI05](https://git.fe.up.pt/lbaw/lbaw1920/lbaw2022/-/blob/master/docs/post-version-desktop.png) |
| **Ajax Calls**  | [R508](#r508-fetch-post-versions-action)
| **Permissions** | PUB, USR |

#### R508: Fetch post versions action

|   |   |   |
|---|---|---|
| **URL**          | `/api/posts/{post_id}/versions` |  |
| **Description**  | Fetch the information about the different versions of a post |  |
| **Method**        | GET |   |
| **Parameters**     | +post_id: integer | Post primary key|
| **Request Body**  | +pageNo: integer | Number of the current page  |
|                   | +postsPerPage: integer | Number of the posts in a page  |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request | Error |
|                   | 404 Not Found | Error |
| **Response Body** | [JSON508](#json508-fetch-post-versions-action) |   |
| **Permissions** | PUB, USR |  |

#### R509: Fetch posts related to the post

|   |   |   |
|---|---|---|
| **URL**           | `/api/posts/{post_id}/related_posts` |  |
| **Description**   | Fetch posts related to the post|  |
| **Parameters**    | +post_id: integer | Post primary key|
| **Method**        | GET |   |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request | Error |
|                   | 404 Not Found | Error |
| **Response Body** | [JSON509](#json509-fetch-posts-related-to-the-post) |   |
| **Permissions**   | PUB, USR|  |

#### R510: Fetch tags related to the post

|   |   |   |
|---|---|---|
| **URL**           | `/api/posts/{post_id}/related_tags` |  |
| **Description**   | Fetch tags related to the post|  |
| **Parameters**    | +post_id: integer | Post primary key|
| **Method**        | GET |   |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request | Error |
|                   | 404 Not Found | Error |
| **Response Body** | [JSON510](#json510-fetch-tags-related-to-the-post) |   |
| **Permissions**   | PUB, USR|  |

#### R511: Comment versions page

|   |   |
|---|---|
| **URL**          | `/comments/{comment_id}/versions` |
| **Description**  | Page that displays the versions of a comment. |
| **Method**       | GET |
| **Parameters**     | +comment_id: integer | Comment primary key|
| **UI**           | [UI04](https://git.fe.up.pt/lbaw/lbaw1920/lbaw2022/-/blob/master/docs/comment-version-desktop.png) |
| **Ajax Calls**  | [R512](#r512-fetch-comment-versions-action) |
| **Permissions** | PUB, USR |


#### R512: Fetch comment versions action

|   |   |   |
|---|---|---|
| **URL**          | `/api/comments/{comment_id}/versions` |  |
| **Description**  | Fetch the information about the different versions of a comment |  |
| **Method**        | GET |   |
| **Parameters**     | +comment_id: integer | Comment primary key|
| **Request Body**  | +pageNo: integer | Number of the current page  |
|                   | +commentsPerPage: integer | Number of the comments in a page  |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request | Error |
|                   | 404 Not Found | Error |
| **Response Body** | [JSON512](#json512-fetch-comment-versions-action) |   |
| **Permissions** | PUB, USR |  |

#### R513: Reply versions page

|   |   |
|---|---|
| **URL**          | `/replies/{reply_id}/versions` |
| **Description**  | Display the different versions of a reply |
| **Method**       | GET |
| **Parameters**     | +reply_id: integer | Reply primary key|
| **UI**           | [UI04](https://git.fe.up.pt/lbaw/lbaw1920/lbaw2022/-/blob/master/docs/comment-version-desktop.png) |
| **Ajax Calls**  | [R514](#r514-fetch-reply-versions-action)
| **Permissions** | PUB, USR |


#### R514: Fetch reply versions action

|   |   |   |
|---|---|---|
| **URL**          | `/api/replies/{reply_id}/versions ` |  |
| **Description**  | Fetch the information about the different versions of a reply |  |
| **Method**        | GET |   |
| **Parameters**     | +reply_id: integer | Reply primary key|
| **Request Body**  | +pageNo: integer | Number of the current page  |
|                   | +postsPerPage: integer | Number of the posts in a page  |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request | Error |
|                   | 404 Not Found | Error |
| **Response Body** | [JSON514](#json514-fetch-reply-versions-action) |   |
| **Permissions** | PUB, USR |  |

#### R515: Edit post page

|   |   |   |
|---|---|---|
| **URL**          | `/posts/{post_id}/edit` |  |
| **Description**  | Display the form to edit a post |  |
| **Method**        | GET |   |
| **Parameters**     | +post_id: integer | Post primary key|
| **UI**           | [UI03](https://git.fe.up.pt/lbaw/lbaw1920/lbaw2022/-/blob/master/docs/editpost-desktop.png) |
| **SUBMIT**      | R516 |
| **Ajax Calls**  | [R502](#r502-fetch-post-info-action)
| **Permissions** | OWN |

#### R516: Edit post action

|   |   |   |
|---|---|---|
| **URL**          | `/api/posts/{post_id}` |  |
| **Description**  | Edit a post |  |
| **Method**        | PUT |   |
| **Parameters**     | +post_id: integer | Post primary key|
| **Request Body**  | +type: string | Type of the post ("News" or "Opinion")  |
|                   | +tags: string | Serialized list of tags |
|                   | +title: string | Post's title |
|                   | +body: string | Post's body |
|                   | ?release_date: string | Post's release date (may be null) |
|                   | +photo: string | Banner photo of the post |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request  | Error |
|                   | 401 Unauthorized | Error (Not logged in) |
|                   | 403 Forbidden | Error (No permission) |
|                   | 404 Not Found | Error |
| **Redirects**     | [R501](#r501-post-page)  | Success |
|                   | [R515](#r515-edit-post-page)  | Error |
| **Permissions** | OWN |  |

#### R517: Edit reply action

|   |   |   |
|---|---|---|
| **URL**          | `/api/replies/{reply_id}` |  |
| **Description**  | Edit a reply |  |
| **Method**        | PUT |   |
| **Parameters**     | +reply_id: integer | Reply primary key|
| **Request Body**  | +body: string | reply's body |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request  | Error |
|                   | 401 Unauthorized | Error (Not logged in) |
|                   | 403 Forbidden | Error (No permission) |
|                   | 404 Not Found | Error |
| **Permissions** | OWN |  |

#### R518: Edit comment action

|   |   |   |
|---|---|---|
| **URL**          | `/api/comments/{comment_id}` |  |
| **Description**  | Edit a comment |  |
| **Method**        | PUT |   |
| **Parameters**     | +comment_id: integer | Comment primary key|
| **Request Body**  | +body: string | comments's body |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request  | Error |
|                   | 401 Unauthorized | Error (Not logged in) |
|                   | 403 Forbidden | Error (No permission) |
|                   | 404 Not Found | Error |
| **Permissions** | OWN |  |

#### R519: Save post action

|   |   |   |
|---|---|---|
| **URL**          | `/api/posts/{post_id}/save` |  |
| **Description**  | Save a post |  |
| **Method**        | POST |   |
| **Parameters**     | +post_id: integer | Post primary key|
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request  | Error |
|                   | 401 Unauthorized | Error (Not logged in) |
|                   | 403 Forbidden | Error (No permission) |
|                   | 404 Not Found | Error |
| **Permissions** | USR |  |

#### R520: Toggle a posts visibility

|   |   |   |
|---|---|---|
| **URL**          | `/api/posts/{post_id}/visibility` |  |
| **Description**  | Switch a post's visibility|  |
| **Method**        | POST |   |
| **Parameters**     | +post_id: integer | Post primary key|
| **Request Body**  | +visibility: boolean | True if visible, false otherwise  |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request  | Error |
|                   | 401 Unauthorized | Error (Not logged in) |
|                   | 403 Forbidden | Error (No permission) |
|                   | 404 Not Found | Error |
| **Permissions** | OWN |  |

#### R521: Report a reply action

|   |   |   |
|---|---|---|
| **URL**          | `/api/replies/{reply_id}/report` |  |
| **Description**  | Report a reply |  |
| **Method**        | POST |   |
| **Parameters**     | +reply_id: integer | Reply primary key|
| **Request Body**  | +reason: string | Serialized list of report reasons  |
|                   | +comment: string | User's comment on the report  |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request  | Error |
|                   | 401 Unauthorized | Error (Not logged in) |
|                   | 403 Forbidden | Error (No permission) |
|                   | 404 Not Found | Error |
| **Permissions** | USR |  |

#### R522: Report a comment action

|   |   |   |
|---|---|---|
| **URL**          | `/api/comments/{comment_id}/report` |  |
| **Description**  | Report a comment |  |
| **Method**        | POST |   |
| **Parameters**     | +comment_id: integer | Comment primary key|
| **Request Body**  | +reason: string | Serialized list of report reasons  |
|                   | +comment: string | User's comment on the report  |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request  | Error |
|                   | 401 Unauthorized | Error (Not logged in) |
|                   | 403 Forbidden | Error (No permission) |
|                   | 404 Not Found | Error |
| **Permissions** | USR |  |

#### R523: Report a post action

|   |   |   |
|---|---|---|
| **URL**          | `/api/posts/{post_id}/report` |  |
| **Description**  | Report a post |  |
| **Method**        | POST |   |
| **Parameters**     | +post_id: integer | Post primary key|
| **Request Body**  | +reason: string | Serialized list of report reasons  |
|                   | +comment: string | User's comment on the report  |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request  | Error |
|                   | 401 Unauthorized | Error (Not logged in) |
|                   | 403 Forbidden | Error (No permission) |
|                   | 404 Not Found | Error |
| **Permissions** | USR |  |

#### R524: Delete reply action

|   |   |   |
|---|---|---|
| **URL**          | `/api/replies/{reply_id}` |  |
| **Description**  | Delete a reply |  |
| **Method**        | DELETE |   |
| **Parameters**     | +reply_id: integer | Reply primary key|
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request  | Error |
|                   | 401 Unauthorized | Error (Not logged in) |
|                   | 403 Forbidden | Error (No permission) |
|                   | 404 Not Found | Error |
| **Permissions** | OWN, ADM |  |

#### R525: Delete comment action

|   |   |   |
|---|---|---|
| **URL**          | `/api/comments/{comment_id}` |  |
| **Description**  | Delete a comment |  |
| **Method**        | DELETE |   |
| **Parameters**     | +comment_id: integer | Comment primary key|
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request  | Error |
|                   | 401 Unauthorized | Error (Not logged in) |
|                   | 403 Forbidden | Error (No permission) |
|                   | 404 Not Found | Error |
| **Permissions** | OWN, ADM |  |

#### R526: Delete post action

|   |   |   |
|---|---|---|
| **URL**          | `/api/posts/{post_id}` |  |
| **Description**  | Delete a post |  |
| **Method**        | DELETE |   |
| **Returns**       | 200 OK | Success |
|                   | 400 Bad Request  | Error |
|                   | 401 Unauthorized | Error (Not logged in) |
|                   | 403 Forbidden | Error (No permission) |
|                   | 404 Not Found | Error |
| **Redirects**     | [R201](#r201-view-user-profile)  | Success |
|                   | [R501](#r501-post-page)  | Error |
| **Permissions** | OWN, ADM |  |

#### R527: Add post action

|   |   |   |
|---|---|---|
| **URL**           | ` /api/posts ` |  |
| **Description**   | Add a new post to the application |  |
| **Method**        | POST |   |
| **Request Body**  | +type: string | Type of the post ("News" or "Opinion")  |
|                   | +tags: string | Serialized list of tags |
|                   | +title: string | Post's title |
|                   | +body: string | Post's body |
|                   | +photo: string | Banner photo of the post |
|                   | ?release_date: string | Post's release date (may be null) |
| **Returns**       | 201 Created | Success |
|                   | 400 Bad Request  | Error |
|                   | 401 Unauthorized | Error (Not logged in) |
|                   | 403 Forbidden | Error (No permission) |
| **Permissions** | USR |  |

#### R528: Create post page

|   |   |   |
|---|---|---|
| **URL**          | `/posts/create` |  |
| **Description**  | Page to create a new post |  |
| **Method**        | GET |   |
| **UI**           | [UI03](https://git.fe.up.pt/lbaw/lbaw1920/lbaw2022/-/blob/master/docs/editpost-desktop.png) |
| **Returns**       | 200 OK | Success |
|                   | 401 Unauthorized | Error (Not logged in) |
|                   | 403 Forbidden | Error (No permission) |
| **SUBMIT**      | [R527](#r527-add-post-action) |
| **Permissions** | USR |  |


#### R529: Report tag action

|   |   |   |
|---|---|---|
| **URL**          | `/api/tags/{tag_id}/report`  |  |
| **Description**  | API endpoint to report a tag |  |
| **Method**       | POST |   |
| **Parameters**   | +tag_id: integer | Tag primary key|
| **Request Body** | +reason: string | Serialized list of report reasons  |
|                  | +comment: string | User's comment on the report  |
| **Returns**      | 200 OK | Success |
|                  | 400 Bad Request  | Error |
|                  | 401 Unauthorized | Error (Not logged in) |
|                  | 404 Not Found | Error |
| **Permissions**  | USR |  |


### R530: Delete tag action

|   |   |   |
|---|---|---|
| **URL**          | `/api/tags/{tag_id}` |  |
| **Description**  | Delete a tag |  |
| **Method**       | DELETE |   |
| **Parameters**   | +tag_id: integer | Tag primary key|
| **Returns**      | 200 OK | Success |
|                  | 401 Unauthorized | Error (Not logged in) |
|                  | 403 Forbidden | Error (No permission) |
|                  | 404 Not Found | Error |
| **Permissions**  | ADM |  |



## 4. JSON/XML Types

NOTE: The JSON structure presented here does not take into consideration the pagination that may have to be done to some item (that functionality can be obtained by using Laravel functionalities).

### JSON202: Fetch user information Action
```json=
{
    "id": 1,
    "name": "Eduardo Ribeiro",
    "verified": true,
    "email": "edu.ribeiro@gmail.com",
    "birthday": "April 4, 2000",
    "local":{ "city": "Porto", "country":"Portugal"},
    "bio": "Hello there! I am a 20 years old portuguese lad who loves football",
    "num_subscribers": 45123,
    "photo": "/41245124kndjasdkjndak.png",
    "is_banned": false,
    "is_admin": true
}
```


### JSON205: Fetch user posts Action
```json=
{
    "user_id": 1,
    "posts": [
        {
            "post_id": 1,
            "title": "New AirMax Design",
            "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80",
            "body": "This Airmax design is wavy bruv. You can bet that it will sell out in weeks.",
            "publication_date": "2017-04-16 19:16:29",
            "modification_date": null,
            "likes_difference": 3410,
            "visible": true,
            "most_recent": false,
            "type": "Opinion",
            "tags": [
                {
                    "name": "Design",
                    "id": 3
                }
            ]
        },
        {
            "post_id": 2,
            "title": "Juventus player is tested positive for Coronavirus",
            "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80",
            "body": "Fortunately he is currently asymptomatic, but all Juventus players were put in quarantine.",
            "publication_date": "2017-04-16 19:16:29",
            "modification_date": null,
            "likes_difference": 81322,
            "visible": true,
            "type": "News",
            "tags": [
                {
                    "name": "Health",
                    "id": 31
                },
                {
                    "name": "Sports",
                    "id": 4
                },
                {
                    "name": "Corona",
                    "id": 54
                }
            ]
        }
    ]
}
```

### JSON206: Fetch user likes Action
```json=
{
    "user_id": 1,
    "post_likes": [
        {
            "post_id": 3,
            "author": {
              "name": "Joe Weller",
              "user_id": 45
            },
            "title": "Relax Codvid-19 Only Kills Elderly",
            "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80",
            "body": "Why not relax and take a sip of your favorite coffee while watching the overpopulation problem solve itself?",
            "publication_date": "2017-04-16 19:16:29",
            "modification_date": "2017-08-11 12:02:32",
            "likes_difference": -22,
            "visible": true,
            "type": "Opinion",
            "tags": [
                {
                    "name": "Health",
                    "id": 31
                }
            ]
        },
        {
            "post_id": 6,
            "author": {
              "name": "Jack Harlow",
              "user_id": 41
            },
            "title": "Why Nobody Cares and You shoudn't too",
            "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80",
            "body": "Happiness and why more or less everything is absolutely fine...",
            "publication_date": "2017-04-16 19:16:29",
            "modification_date": null,
            "likes_difference": 821731,
            "visible": true,
            "type": "Opinion",
            "tags": [
                {
                    "name": "Lifestyle",
                    "id": 2
                }
            ]
        }
    ],
    "comment_likes": [
        {
            "post": {
                "title": "Old News",
                "post_id": 987
            },
            "author": {
                "name": "Normal Girl",
                "verified": false,
                "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80",
                "user_id": 12
            },
            "body": "Wow this is amazing! Thanks for sharing :D",
            "publication_date": "2017-04-16 19:16:29",
            "modification_date": null,
            "likes_difference": 123
        }
    ]
}
```

### JSON207: Fetch user comments Action
```json=
{
    "user_id": 1,
    "comments": [
        {
            "post": {
                "title": "Old News",
                "post_id": 987
            },
            "body": "Wow this is amazing! Thanks for sharing :D",
            "publication_date": "2017-04-16 19:16:29",
            "modification_date": null,
            "likes_difference": 123
        },
        {
            "post": {
                "title": "Business News That Will Change The World",
                "post_id": 32124
            },
            "body": "It's mad how much the business world is evolving with all this tech revolution. One of the most insightful posts I've read!!",
            "publication_date": "2017-04-16 19:16:29",
            "modification_date": null,
            "likes_difference": 0
        }
    ]
}
```

### JSON208: Fetch user badges Action
```json=
{
    "user_id": 1,
    "badges": {
        "Verified": false,
        "Tag Master": true,
        "Targeted": false,
        "Violet": false,
        "Mr Worldwide": true,
        "Popular": true,
        "Champion": false
    }
}
```

### JSON211: Fetch user statistics Action
```json=
{
    "user_id": 1,
    "tags_on_posts": {
        "Sports": 3,
        "Design": 5,
        "Music": 20,
        "Technology": 40,
        "Others": 3
    },
    "subs_location": {
        "Portugal": 10,
        "India": 123,
        "United States": 12321,
        "Canada": 1902,
        "Germany": 1925,
        "Others": 9213
    },
    "subs_age": {
        "13-20": 1322,
        "21-30": 9014,
        "31-40": 9144,
        "41-50": 19239,
        "51-60": 932,
        "60+": 23
    },
    "most_liked_post": {
        "post_id": 1,
        "title": "New AirMax Design",
        "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80",
        "body": "This Airmax design is wavy bruv. You can bet that it will sell out in weeks.",
        "publication_date": "2017-04-16 19:16:29",
        "modification_date": null,
        "likes_difference": 3410,
        "visible": true,
        "type": "Opinion",
        "tags": [
            {
                "name": "Design",
                "id": 3
            }
        ]
    }
}
```

### JSON214: Fetch user subscriptions Action
```json=
{
    "user_id": 1,
    "users": [
        {
            "user_id": 42,
            "name": "Carlos Camacho",
            "verified": true,
            "email": "pl.og.never@gmai.com",
            "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80"
        },
        {
            "user_id": 48,
            "name": "Edu Carreira",
            "verified": true,
            "email": "edu.carr.rib@gmail.com",
            "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80"
        }
    ]
}
```

### JSON217: Fetch tag subscriptions Action
```json=
{
    "user_id": 1,
    "tags": [
        {
            "name": "Design",
            "id": 3
        },
        {
            "name": "Fighting",
            "id": 15
        },
        {
            "name": "Music",
            "id": 7
        },
        {
            "name": "Kendrick Lamar",
            "id": 78
        },
        {
            "name": "Peaky Blinders",
            "id": 261
        }
    ]
}
```

### JSON221: Fetch user saved posts Action
```json=
{
    "user_id": 1,
    "saved_posts": [
        {
            "post_id": 3,
            "author": {
              "name": "Joe Weller",
              "user_id": 45
            },
            "title": "Relax Codvid-19 Only Kills Elderly",
            "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80",
            "body": "Why not relax and take a sip of your favorite coffee while watching the overpopulation problem solve itself?",
            "publication_date": "2017-04-16 19:16:29",
            "modification_date": "2017-08-11 12:02:32",
            "likes_difference": -22,
            "visible": true,
            "type": "Opinion",
            "tags": [
                {
                    "name": "Health",
                    "id": 31
                }
            ]
        },
        {
            "post_id": 421,
            "author": {
              "name": "Joao Felix",
              "user_id": 51
            },
            "title": "Atletico play defensive masterclass, knocking raining champions Liverpool out of the Champions League",
            "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80",
            "body": "Check the highlights on the post.",
            "publication_date": "2017-04-16 19:16:29",
            "modification_date": null,
            "likes_difference": 22,
            "visible": true,
            "type": "News",
            "tags": [
                {
                    "name": "Sports",
                    "id": 2
                },
                {
                    "name": "Football",
                    "id": 15
                }
            ]
        }
    ]
}
```

### JSON223: Get tags used by the user Action

```json=
{
    "tags": [
        {
           "id": 2,
           "name": "lifestyle",
           "frequency": 1
        },
        {
           "id": 8,
           "name": "tech",
           "frequency": 3
        },
        {
           "id": 1,
           "name": "health",
           "frequency": 16
        },
        {
           "id": 3,
           "name": "design",
           "frequency": 4
        },
    ]
}
```

### JSON306: Fetch Admin Stats Action

```json=

{
    "user_id": "12314",
    "posts_deleted": "13",
    "comments_deleted": "55",
    "reports_solved": "23",
    "users_banned": "12"
}

```

### JSON307: Fetch Admins API

```json=
{
   "admins": [
       {
         "id": 1,
         "name": "Edu Carreira Ribeiro",
         "email": "eduribeiro123@yandex.com",
         "reports_solved": 7,
         "users_banned": 10,
         "posts_deleted": 19,
         "comments_deleted": 40
       },
       {
         "id": 4,
         "name": "Pedro Teixeira da Mota",
         "email": "ptm@gmail.com",
         "reports_solved": 0,
         "users_banned": 5,
         "posts_deleted": 71,
         "comments_deleted": 1
       },
       {
         "id": 182,
         "name": "Antonio Mendes",
         "email": "antoniomendesya@gmail.com",
         "reports_solved": 2,
         "users_banned": 4,
         "posts_deleted": 7,
         "comments_deleted": 0
       }
   ]
}
```

#### JSON310: Fetch reports API

```json=
{
    "open": [
        {
            "report_id": 123,
            "reasons": [
                "Fake news",
                "Offensive content",
                "Hate speech"
            ],
            "explanation": "I didn't like that at all! He has to delete it ASAP!",
            "closed": false,
            "reporter": {
                "user_id": 82,
                "name": "Eduardo Ribeiro"
            },
            "type": "post",
            "item": {
                "post_id": 54,
                "title": "Eduardo Ribeiro as been slacking off and not working on Compilers subject!!",
                "publication_date": "2017-04-16 19:16:29",
                "author": {
                    "user_id": 141,
                    "name": "Prof. Tiago"
                }
                "likes": 19512,
                "dislikes": 1,
                "tags": [
                    {
                        "name": "Compilers",
                        "id": 992
                    },
                    {
                        "name": "Laziness",
                        "id": 40
                    }
                ]
            }
        },
        {
            "report_id": 21,
            "reasons": [
                "Fake news"
            ],
            "explanation": "Does not portray the truth at all. Simply delusional",
            "closed": false,
            "reporter": {
                "user_id": 195,
                "name": "Fernando Madureira"
            },
            "type": "comment",
            "item": {
                "post": {
                    "title": "What is the best portuguese football team?",
                    "post_id": 31
                }
                "body": "Come on guys... We all know that SL Benfica is the best",
                "publication_date": "2017-04-16 19:16:29",
                "author": {
                    "user_id": 141,
                    "name": "João Maria Salgado"
                }
                "likes": 32,
                "dislikes": 1123
            }
        }
    ],
    "closed": [
         {
            "report_id": 813,
            "reasons": [
                "Advertising"
            ],
            "explanation": "Just advertising his product",
            "closed": true,
            "reporter": {
                "user_id": 666,
                "name": "Sara Gomes"
            },
            "type": "tag",
            "item": {
                "id": 40,
                "name": "BestTech2020"
            }
        }
    ]
}
```

#### JSON312: Fetch banned users

```json=

{
    "users": [

        {
            "banned_user_id": "321",
            "banned_user_name": "David Silva",
            "admin_user_id": "55",
            "admin_iser_name": "Luís Cunha",
            "start_date": "04/03/2012",
            "end_date": "04/03/2019"
        },
        {
            "banned_user_id": "2",
            "banned_user_name": "Celio Salgueiro",
            "admin_user_id": "7",
            "admin_iser_name": "Ricardo Salgado",
            "start_date": "07/03/2012",
            "end_date": "22/05/2019"
        },
        {
            "banned_user_id": "666",
            "banned_user_name": "Thomas Eng",
            "admin_user_id": "999",
            "admin_iser_name": "Ramiro Sultan",
            "start_date": "04/03/2012",
            "end_date": "04/03/2019"
        },
        {
            "banned_user_id": "442",
            "banned_user_name": "Anthony Flags",
            "admin_user_id": "55",
            "admin_iser_name": "Luís Cunha",
            "start_date": "04/03/2013",
            "end_date": null
        }
    ]
}
```

### JSON407: Perform post search Action
```json=
{
    "search_results": [
        {
            "post_id": 3,
            "author": {
              "name": "Joe Weller",
              "user_id": 45
            },
            "title": "Relax Codvid-19 Only Kills Elderly",
            "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80",
            "body": "Why not relax and take a sip of your favorite coffee while watching the overpopulation problem solve itself?",
            "publication_date": "2017-04-16 19:16:29",
            "modification_date": "2017-08-11 12:02:32",
            "likes_difference": -22,
            "visible": true,
            "type": "Opinion",
            "tags": [
                {
                    "name": "Health",
                    "id": 31
                }
            ]
        },
        {
            "post_id": 421,
            "author": {
              "name": "Joao Felix",
              "user_id": 51
            },
            "title": "Atletico play defensive masterclass, knocking raining champions Liverpool out of the Champions League",
            "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80",
            "body": "Check the highlights on the post.",
            "publication_date": "2017-04-16 19:16:29",
            "modification_date": null,
            "likes_difference": 22,
            "visible": true,
            "type": "News",
            "tags": [
                {
                    "name": "Sports",
                    "id": 2
                },
                {
                    "name": "Football",
                    "id": 15
                }
            ]
        }
    ]
}
```

### JSON408: Perform author/user search Action
```json=
{
    "search": [
        {
            "name": "Normal Girl",
            "email": "imjustaregularhoe@gmail.com",
            "verified": false,
            "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80",
            "user_id": 12
        }
    ]
}
```

### JSON409: Perform tag search Action
```json=
{
    "search": [
        {
            "name": "Sports",
            "id": 2
        },
        {
            "name": "Hip Hop",
            "id": 65
        },
        {
            "name": "FC Porto",
            "id": 129
        }
    ]
}
```

### JSON411: Perform feed posts from subscribed tags search Action
```json=
{
    "search_results": [
        {
            "post_id": 3,
            "author": {
              "name": "Joe Weller",
              "user_id": 45
            },
            "title": "Relax Codvid-19 Only Kills Elderly",
            "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80",
            "body": "Why not relax and take a sip of your favorite coffee while watching the overpopulation problem solve itself?",
            "publication_date": "2017-04-16 19:16:29",
            "modification_date": "2017-08-11 12:02:32",
            "likes_difference": -22,
            "visible": true,
            "type": "Opinion",
            "tags": [
                {
                    "name": "Health",
                    "id": 31
                }
            ]
        },
        {
            "post_id": 421,
            "author": {
              "name": "Joao Felix",
              "user_id": 51
            },
            "title": "Atletico play defensive masterclass, knocking raining champions Liverpool out of the Champions League",
            "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80",
            "body": "Check the highlights on the post.",
            "publication_date": "2017-04-16 19:16:29",
            "modification_date": null,
            "likes_difference": 22,
            "visible": true,
            "type": "News",
            "tags": [
                {
                    "name": "Sports",
                    "id": 2
                },
                {
                    "name": "Football",
                    "id": 15
                }
            ]
        }
    ]
}
```


### JSON412: Perform feed posts from subscribed users search Action
```json=
{
    "search_results": [
        {
            "post_id": 3,
            "author": {
              "name": "Joe Weller",
              "user_id": 45
            },
            "title": "Relax Codvid-19 Only Kills Elderly",
            "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80",
            "body": "Why not relax and take a sip of your favorite coffee while watching the overpopulation problem solve itself?",
            "publication_date": "2017-04-16 19:16:29",
            "modification_date": "2017-08-11 12:02:32",
            "likes_difference": -22,
            "visible": true,
            "type": "Opinion",
            "tags": [
                {
                    "name": "Health",
                    "id": 31
                }
            ]
        },
        {
            "post_id": 421,
            "author": {
              "name": "Joao Felix",
              "user_id": 51
            },
            "title": "Atletico play defensive masterclass, knocking raining champions Liverpool out of the Champions League",
            "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80",
            "body": "Check the highlights on the post.",
            "publication_date": "2017-04-16 19:16:29",
            "modification_date": null,
            "likes_difference": 22,
            "visible": true,
            "type": "News",
            "tags": [
                {
                    "name": "Sports",
                    "id": 2
                },
                {
                    "name": "Football",
                    "id": 15
                }
            ]
        }
    ]
}
```


### JSON502: Fetch post info action
```json=
{
    "id": 1234,
    "title": "Statistics of the working man",
    "likes_difference": 10903,
    "visible": true,
    "most_recent": true,
    "photo": "https://images.unsplash.com/photo-1536250280793-064d9fb83b0c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80",
    "body": "Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.\nThe problem\nBring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring. \nThe past and new solutions\nCapitalize on low hanging fruit to identify a ballpark value added activity to beta test. Override the digital divide with additional clickthroughs from DevOps. Nanotechnology immersion along the information highway will close the loop on focusing solely on the bottom line.\nPodcasting operational change management inside of workflows to establish a framework. Taking seamless key performance indicators offline to maximise the long tail. Keeping your eye on the ball while performing a deep dive on the start-up mentality to derive convergence on cross-platform integration.\n\nSample Image\nCollaboratively administrate empowered markets via plug-and-play networks. Dynamically procrastinate B2C users after installed base benefits. Dramatically visualize customer directed convergence without revolutionary ROI. Efficiently unleash cross-media information without cross-media value. Quickly maximize timely deliverables for real-time schemas. Dramatically maintain clicks-and-mortar solutions without functional solutions.",
    "edited": true,
    "publication_date": "2017-04-16 19:16:29",
    "modification_date": "2020-02-19 12:20:29",
    "author": {
            "id": 23,
            "name": "Business Woman",
            "local": {
                        "city": "Porto", 
                        "country":"Portugal"
                      },
            "bio": "Hi! I'm a 39 years young woman paving the way for the future generation of women. Follow my thoughts, follow my lead!",
            "verified": true
        },
    "type": "Opinion",    
    "tags": [
        {
            "name": "Business",
            "id": 2
        }

    ],   
}
```

### JSON504: Post comments action

```json=
{
    "total": 3,
    "comments": [
        {
            "id": 23,
            "author": {
                "id": 14,
                "name": "Business Man",
                "verified": true
            },
            "body": "Great post looking forward to what's comming next!!",
            "publication_date": "2017-04-16 19:16:29",
            "modification_date": null,
            "likes_difference": 6212,
            "edited": true,
            "replies": [
                {
                    "id": 24,
                    "author": {
                        "id": 14,
                        "name": "Business Woman",
                        "verified": true
                    },
                    "body": "Thank you so much. I thought that no one was gonna understand me!",
                    "publication_date": "2017-04-16 20:16:29",
                    "modification_date": null,
                    "likes_difference": 530,
                    "edited": false
                }
            ]
        },

        {
            "id": 25,
            "author": {
                "id": 14,
                "name": "Business Woman",
                "verified": true
            },
            "body": "Thanks to everyone who upvoted!",
            "publication_date": "2017-04-16 19:16:29",
            "modification_date": null,
            "likes_difference": 123,
            "edited": false,
            "replies": [ ]
        }
    ]
}

```

### JSON508: Fetch post versions action
```json=
{
    "post_id": 12,
    "page_number": 1,
    "posts_per_page": 6,
    "versions": [
        {
            "id": 50,
            "title": "David Dias delivers ultimate blow as he wins UFC title",
            "modification_date": "03/03/2020",
            "body": "What a match. What a win. What a fighter!!!!!"
        },
        {
            "id": 34,
            "title": "David edges out oponnent to win UFC title",
            "modification_date": "08/03/2020",
            "body": "David is amazing!!! What a match."
        },
        {
            "id": 33,
            "title": "David Dias handles opponent and wins UFC title",
            "modification_date": "30/12/2019",
            "body": "David fought really well. Amazing match to watch."
        },
        {
            "id": 21,
            "title": "David Dias fights well and wins title",
            "modification_date": "30/12/2019",
            "body": "Pretty good match! There wasn't much difference but David won in the end."
        },
        {
            "id": 15,
            "title": "David Dias wins title as fight goes his way",
            "modification_date": "30/12/2019",
            "body": "A bit lucky, to be honest. Nevertheless, the title is his."
        },
        {
            "id": 5,
            "title": "David Dias gets lucky and wins",
            "modification_date": "30/12/2019",
            "body": "Horrible fight, to be honest... David didn't fight that well... I really don't know how he won"
        }
    ],
    "author": {
        "id": 15,
        "name": "Eduardo Ribeiro"
    }

}
```

### JSON509: Fetch posts related to the post
```json=
{
    "related_posts":[
        {
            "id": 5,
            "title": "New AirMax Design",
            "tags": [
                {
                    "name": "Design",
                    "id": 3
                }
            ],
            "author": {
                "id": 6,
                "name": "Sneaker Head"
            },
            "publication_date": "2017-04-16 19:16:29",
            "likes_difference": 57,
            "type": "Opinion"

        },
        {
            "id": 9,
            "title": "New Corona Virus in Asia",
            "tags": [
                {
                    "name": "Health",
                    "id": 4
                }
            ],
            "author":{
                "id": 7,
                "name": "Hypochondriac Guy"
            },
            "publication_date": "2017-04-16 19:16:29",
            "likes_difference": 80,
            "type": "News" 
        },
        {
            "id": 503,
            "title": "PLOG Grades out Now",
            "tags": [
                {
                    "name": "Health",
                    "id": 4
                },
                {
                    "name": "Business",
                    "id": 4
                }
            ],
            "author": {
                "id": 7,
                "name": "Nerd Oldwoman"
            },
            "publication_date": "2017-04-16 19:16:29",
            "likes_difference": 200,
            "type": "News"
        }
        
    ]
    
}
```

### JSON510: Fetch tags related to the post
```json=
{
    "related_tags":
    [
                {
                    "name": "Design",
                    "id": 1
                },
                {
                    "name": "Health",
                    "id": 2
                },
                                {
                    "name": "Opinions",
                    "id": 5
                },
                {
                    "name": "Sports",
                    "id": 8
                },
                                {
                    "name": "Lifestyle",
                    "id": 11
                },
                {
                    "name": "Corona",
                    "id": 504
                }
    ]
    
}
```

### JSON512: Fetch comment versions action
```json=
{
    "comment_id": 12,
    "page_number": 1,
    "posts_per_page": 5,
    "likes_difference": 6245,
    "versions": [
        {
            "id": 50,
            "modification_date": "03/03/2020",
            "body": "Great post looking forward to what's comming next!!"
        },
        {
            "id": 34,
            "title": "David edges out oponnent to win UFC title",
            "modification_date": "08/03/2020",
            "body": "What is the source of this article? A little dubious if you ask me..."
        },
        {
            "id": 33,
            "title": "David Dias handles opponent and wins UFC title",
            "modification_date": "30/12/2019",
            "body": "Not sure what to take from this..."
        },
        {
            "id": 21,
            "title": "David Dias fights well and wins title",
            "modification_date": "30/12/2019",
            "body": "Very incomplete..."
        },
        {
            "id": 15,
            "title": "David Dias wins title as fight goes his way",
            "modification_date": "30/12/2019",
            "body": "Was not expecting that!"
        }

    ],
    "author": {
        "id": 15,
        "name": "Eduardo Ribeiro"
    }

}
```

### JSON514: Fetch reply versions action
```json=
{
    "reply_id": 12,
    "comment_id": 12,
    "page_number": 1,
    "posts_per_page": 5,
    "likes_difference": 6245,
    "versions": [
        {
            "id": 50,
            "modification_date": "03/03/2020",
            "body": "Great post looking forward to what's comming next!!"
        },
        {
            "id": 34,
            "title": "David edges out oponnent to win UFC title",
            "modification_date": "08/03/2020",
            "body": "What is the source of this article? A little dubious if you ask me..."
        },
        {
            "id": 33,
            "title": "David Dias handles opponent and wins UFC title",
            "modification_date": "30/12/2019",
            "body": "Not sure what to take from this..."
        },
        {
            "id": 21,
            "title": "David Dias fights well and wins title",
            "modification_date": "30/12/2019",
            "body": "Very incomplete..."
        },
        {
            "id": 15,
            "title": "David Dias wins title as fight goes his way",
            "modification_date": "30/12/2019",
            "body": "Was not expecting that!"
        }

    ],
    "author": {
        "id": 15,
        "name": "Eduardo Ribeiro"
    }

}
```

## Revision history

* Change in URLs from R212-R219
* Added R220
* Added JSON disclaimer (no pagination)
* Removed bad request from R528
* Fixed links
* Updated/Fixed JSON307
* Added extra AJAX calls to R201
* Removed tags-on-post from JSON202
* Changed some parameters to optional on R203
* Removed redirect to error page on R220
* Changed R506 endpoint and added missing parameters
* Separated endpoints for user/tag (un)subscribing and fetching (R214-R218)

***
GROUP2022, 26/04/2020
 
* David Luís Dias da Silva, up201705373@fe.up.pt
* Eduardo Carreira Ribeiro, up201705421@fe.up.pt
* Luís Pedro Pereira Lopes Mascarenhas Cunha, up201706736@fe.up.pt (Editor)
* Manuel Monge dos Santos Pereira Coutinho, up201704211@fe.up.pt