Skip to content

'View Post' Documentation

mrabiabrn edited this page Jun 13, 2021 · 3 revisions

Description

This endpoint returns all the details of the post with the given id. It shows the post's page. It handles GET requests. Additionally, it uses 'Similar Words API' to get similar words to the given post's tags. It returns these similar words with other post attributes.

URI

http://ec2-35-158-103-6.eu-central-1.compute.amazonaws.com:5000/api/viewPost/{postId}

Parameters

Path Parameters

These parameters are taken in the URL.

postId: -> id of the post that is requested to be viewed

Responses

HTTP 200: Returns post object successfully.

  • Example Response
{
    "id": 6,
    "lastEdit": " ",
    "location": "Grönland",
    "multimedia": [
        "photo_link_1",
        "photo_link_2"
    ],
    "numberOfComments": 1,
    "numberOfLikes": "2",
    "owner_username": "merverabia",
    "postDate": "Fri, 12 Feb 2016 19:59:40 GMT",
    "similarTags": [
        "southern",
        "northeastern",
        "north-western",
        "north-eastern",
        "south-eastern",
        "south-western",
        "southwestern",
        "north-central",
        "southeastern",
        "south-central",
        "lamps",
        "lighting",
        "headlights",
        "lamp",
        "streetlights",
        "headlamps",
        "light",
        "floodlights",
        "curtains",
        "torches"
    ],
    "story": "This place is where everything has changed for me... Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
    "storyDate": {
        "end": "Fri, 12 Feb 2016 00:00:00 GMT",
        "start": "Fri, 12 Feb 2016 00:00:00 GMT"
    },
    "tags": [
        "northern",
        "lights"
    ],
    "topic": "A Dream Come True"
}

HTTP 404: Return when the post with the given id does not exist in the database.

  • Example Response
{
    "error": "Post not found"
}
Clone this wiki locally