-
Notifications
You must be signed in to change notification settings - Fork 0
Get a list of posts
hman25 edited this page May 9, 2022
·
2 revisions
Used to get a list of posts based on a certain location
URL : /api/posts/
Query Parameters : lat=[integer]
where lat
is the latitude for the location to get posts from, long=[integer]
where long
is the longitude for the location to get posts from, range=[integer]
where range
is the search radius (km) from location, numberOfPosts=[integer]
where numberOfPosts
is the number of posts to be retrieved (defaults to 10 if unspecified or less than 10)
Method : GET
Auth required : NO
Code : 200 OK
Content example
[
{
"_id": "6270b67f8d4768ebf7d75893",
"foodName": "Ollies Burgers & Ice Cream",
"bodyText": "Ollies Burgers & Ice Cream",
"tags": [
"Ollies Burgers & Ice Cream",
"Restaurant",
"Food"
],
"dietryRequirements": [],
"restaurant": {
"coordinates": {
"lat": -36.9122379,
"long": 174.7764292
},
"_id": "626374c488465216dbe5651f",
"name": "Ollies Burgers & Ice Cream",
"address": "802 Manukau Road, Royal Oak, Auckland 1061, New Zealand",
"googlePlaceId": "ChIJqxoAV6ZIDW0Ra89JAnJRESQ",
"googleMapsURL": "https://maps.google.com/?cid=2598948010076000107",
"openHours": [
"Monday: 11:00 AM – 10:00 PM",
"Tuesday: 11:00 AM – 10:00 PM",
"Wednesday: 11:00 AM – 10:00 PM",
"Thursday: 11:00 AM – 10:00 PM",
"Friday: 11:00 AM – 11:00 PM",
"Saturday: 11:00 AM – 11:00 PM",
"Sunday: 11:00 AM – 10:00 PM"
],
"__v": 0
},
"numberOfLikes": 4,
"rating": 0,
"numberOfReviews": 0,
"imageURLs": [
"https://lh3.googleusercontent.com/places/AAcXr8owGp_spJ5Ifo0JUNPPhVaSDoe_RXvWe_kv9erIQZhwKiDlcsqH02leC_66iVvcf3vcdfT5lwWkEM-Z_XjxX0QrZdn-Kls6y30=s1600-w400"
],
"__v": 0,
"updatedAt": "2022-05-09T03:36:54.159Z"
},
{
"_id": "6270b6808d4768ebf7d75898",
"foodName": "Ollies Burgers & Ice Cream",
"bodyText": "Ollies Burgers & Ice Cream",
"tags": [
"Ollies Burgers & Ice Cream",
"Restaurant",
"Food"
],
"dietryRequirements": [],
"restaurant": {
"coordinates": {
"lat": -36.9122379,
"long": 174.7764292
},
"_id": "626374c488465216dbe5651f",
"name": "Ollies Burgers & Ice Cream",
"address": "802 Manukau Road, Royal Oak, Auckland 1061, New Zealand",
"googlePlaceId": "ChIJqxoAV6ZIDW0Ra89JAnJRESQ",
"googleMapsURL": "https://maps.google.com/?cid=2598948010076000107",
"openHours": [
"Monday: 11:00 AM – 10:00 PM",
"Tuesday: 11:00 AM – 10:00 PM",
"Wednesday: 11:00 AM – 10:00 PM",
"Thursday: 11:00 AM – 10:00 PM",
"Friday: 11:00 AM – 11:00 PM",
"Saturday: 11:00 AM – 11:00 PM",
"Sunday: 11:00 AM – 10:00 PM"
],
"__v": 0
},
"numberOfLikes": 16,
"rating": 0,
"numberOfReviews": 0,
"imageURLs": [
"https://lh3.googleusercontent.com/places/AAcXr8qd5OFfNCJJl-ui49QyEJEe99BDQlb2QtCHVgWv7JRPMwVK65yVn3LdeZ2jdGKmD00IeycmRU_tP21Be2YcZYwbUnkevw2wU0U=s1600-w400"
],
"__v": 0,
"updatedAt": "2022-05-09T03:50:14.634Z"
},
. . . (And other posts returned)
]
Condition : If something went wrong.
Code : 500 Internal Server Error
Content : {}
- Home
- Requirements
- Technologies
- Project management strategy
- Tasks breakdown
- Member contributions
- Meeting minutes
- API endpoints summary
- Users
-
Create a new user :
POST /api/users/
-
Get a single user :
GET /api/users/:id
-
Get a single user (firebase ID) :
GET /api/users/firebase/:id
-
Update a user:
PUT /api/users/:id
-
Create a new user :
- Posts
-
Get a single post
GET /api/posts/:id
-
Get a list of posts :
GET /api/posts/
-
Search for a post :
GET /api/posts/search
-
Create a new post :
POST /api/posts/
-
Like a post :
POST /api/posts/like-post
-
Unlike a post :
POST /api/posts/unlike-post
-
Upload an image for a post :
POST /api/posts/image
-
Get a single post
- Restaurant
-
Get restaurant :
GET /api/restaurants/
-
Get restaurant :