'View Home' Documentation - bounswe/2021SpringGroup7 GitHub Wiki
This API functionality views all the posts of the followings of a given user. The function for this endpoint is getHome(username), existing in the file home.py. This functionality utilizes GET requests in our API. Externally, it uses a third party API that gives random advice from https://api.adviceslip.com/advice.
If you try this API in our AWS EC2 instance,use
http://ec2-35-158-103-6.eu-central-1.compute.amazonaws.com:5000/api/home/{username}
If you try this API on our local machine, use
http://localhost:5000/api/home/{username}
Note that this functionality works only with GET requests. To test this API, you can use the following valid usernames:
- atainan
- ryan
- merverabia
- onurcanavci
- kadirelmaci
This parameter is specified in the URI route.
username -> username of the user whose willing to see its followings' recent posts-> type: string
HTTP_200_OK -> Posts of the followings are retrieved and returned as response successfully. Response contains posts and an advice.
- Example Response
{
"advice": "If it ain't broke don't fix it.",
"posts": [
{
"id": 4,
"lastEdit": " ",
"location": "Texas",
"multimedia": [
"photo_link_1"
],
"numberOfComments": 1,
"numberOfLikes": "1",
"owner_username": "ryan",
"postDate": "Sun, 23 Aug 2020 12:59:40 GMT",
"story": "When I was a child... 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": "Tue, 01 Jan 1980 00:00:00 GMT",
"start": "Tue, 01 Jan 1980 00:00:00 GMT"
},
"tags": [
"nostalgic",
"childhood"
],
"topic": "Remembering Childhood Days"
},
{
"id": 2,
"lastEdit": " ",
"location": "Ankara - Turkey",
"multimedia": [
"photo_link_1"
],
"numberOfComments": 1,
"numberOfLikes": "2",
"owner_username": "ryan",
"postDate": "Thu, 11 Jun 2020 19:59:40 GMT",
"story": "In my last visit to Ankara, I came across a strange cat... 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, 01 Apr 2011 00:00:00 GMT",
"start": "Sat, 01 Jan 2011 00:00:00 GMT"
},
"tags": [
"cat",
"strange"
],
"topic": "A Cat in Ankara"
},
{
"id": 1,
"lastEdit": " ",
"location": "Rome",
"multimedia": [
"photo_link_1",
"photo_link_2"
],
"numberOfComments": 2,
"numberOfLikes": "3",
"owner_username": "ryan",
"postDate": "Wed, 10 Jun 2020 12:00:40 GMT",
"story": "I was in Rome for about 3 months... 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": "Thu, 01 Apr 2010 00:00:00 GMT",
"start": "Fri, 01 Jan 2010 00:00:00 GMT"
},
"tags": [
"summer",
"bike"
],
"topic": "Great Day In Rome..."
}
]
}
HTTP_404_NOT_FOUND -> User with given username does not found in the database or user does not have followings or followings have no post.
- Example Response
{"error":"User does not have any post to see"}
{"error":"User not found"}