-
Notifications
You must be signed in to change notification settings - Fork 1
2. APIs and Controller
Return ReMemri pins that are within a given threshold of the user's current location. If a username and authorization is provided and correct, private pins posted by the user's friends will also be returned. If no username is provided, only public pins will be returned.
Endpoint: GET /nearby_pins/
Request Parameters
| Key | Location | Type | Description |
|---|---|---|---|
username |
Request Parameter | String | Optional unique ID for the current user |
current_location |
Request Parameter | String | User's current location of the form latitude,longitude
|
radius |
Request Parameter | String | Optional maximum radius in miles of nearby pins to return |
Response Codes
| Code | Description |
|---|---|
200 |
Success |
400 |
No location provided |
401 |
User not found |
403 |
Unauthorized user |
Returns
Returns a list of objects of form:
When a user is provided and authenticated
| Key | Location | Type | Description |
|---|---|---|---|
comments |
JSON | JSON List | Optional List of comments (and their information) associated with the pin |
distance |
JSON | Float | Distance between the user and the pin |
is_friend |
JSON | Boolean | Represents whether or not the given user is friends with the pin owner |
is_public |
JSON | Boolean | Represents whether or not the pin is public |
location |
JSON | Array of Floats | Represents the latitude and longitude location of the pin |
media_url |
JSON | String | Base64 representation of the pin's image |
owner_id |
JSON | String | Username of the pin owner |
pin_id |
JSON | String | Unique ID for the pin |
timestamp |
JSON | String | Timestamp of when the pin was posted |
When a user is not provided
| Key | Location | Type | Description |
|---|---|---|---|
comments |
JSON | JSON List | Optional List of comments (and their information) associated with the pin |
distance |
JSON | Float | Distance between the user and the pin |
is_public |
JSON | Boolean | Represents whether or not the pin is public |
location |
JSON | Array of Floats | Represents the latitude and longitude location of the pin |
media_url |
JSON | String | Base64 representation of the pin's image |
owner_id |
JSON | String | Username of the pin owner |
pin_id |
JSON | String | Unique ID for the pin |
timestamp |
JSON | String | Timestamp of when the pin was posted |
Comment -- Nested JSON Object Description
| Key | Location | Type | Description |
|---|---|---|---|
owner_id |
JSON | String | Username of comment writer |
text |
JSON | String | Text of the given comment |
timestamp |
JSON | String | Time this pin was created |
Example
For provided user
[
{
"comments": [
{
"owner_id": "test user",
"text": "test text",
"timestamp": "Thu, 17 Mar 2022 21:11:19 GMT"
},
{
"owner_id": "user4",
"text": "test text 2",
"timestamp": "Sat, 26 Mar 2022 17:40:30 GMT"
},
...
],
"distance": 0.0,
"is_friend": false,
"is_public": true,
"location": [
42.292083,
-83.71588
],
"media_url": "/9j/4AAQSkZJRgABAQEBLAEsAAD/4hrESUNDX1BST0ZJTEUAAQE...",
"owner_id": "user0",
"pin_id": "1234",
"timestamp": "Thu, 17 Mar 2022 21:03:22 GMT"
}
]
Return information about a specific ReMemri pin. A pin contains one post with an image and comments.
Endpoint: GET /pin/pin_id/
Request Parameters
| Key | Location | Type | Description |
|---|---|---|---|
username |
Request Parameter | String | Optional username of requester |
comments_only |
Request Parameter | Boolean | Optional determines whether to return entire pin or just pin's comments |
pin_id |
Path Parameter | String | ID of requested pin |
Response Codes
| Code | Description |
|---|---|
200 |
Success |
401 |
User not found |
403 |
User cannot access pin |
404 |
Pin not found |
Returns
Pin without comments
| Key | Location | Type | Description |
|---|---|---|---|
is_public |
JSON | Boolean | Represents whether or not the pin is public |
location |
JSON | Array of Floats | Represents the latitude and longitude location of the pin |
media_url |
JSON | String | Base64 representation of the pin's image |
owner_id |
JSON | String | Username of the pin owner |
pin_id |
JSON | String | Unique ID for the pin |
timestamp |
JSON | String | Timestamp of when the pin was posted |
Only comments
Array of comment objects
| Key | Location | Type | Description |
|---|---|---|---|
owner_id |
JSON | String | Username of comment writer |
text |
JSON | String | Text of the given comment |
timestamp |
JSON | String | Time this pin was created |
Example
Pin only
{
"is_public": true,
"location": [
42.292083,
-83.71588
],
"media_url": "/9j/4AAQSkZJRgABAQEBLAEsAAD/4hrESUNDX1BST0Z...",
"owner_id": "user0",
"pin_id": "1234",
"timestamp": "Thu, 17 Mar 2022 21:03:22 GMT"
}
Comments only
[
{
"owner_id": "test user",
"text": "test text",
"timestamp": "Thu, 17 Mar 2022 21:11:19 GMT"
},
{
"owner_id": "user4",
"text": "test text 2",
"timestamp": "Sat, 26 Mar 2022 17:40:30 GMT"
},
...
]
Return a list of the current users friends. Note that mutual friendship status is required for one user to see and comment on another user's pins.
Endpoint: GET /friends/
Request Parameters
| Key | Location | Type | Description |
|---|---|---|---|
username |
Session Cookie | String | Current User |
Returns
| Key | Location | Type | Description |
|---|---|---|---|
friend_usernames |
JSON | List | Unique usernames for the user's friends |
Return a list of the current users pending incoming friend requests. The request and return fields are the same as in Get Friends.
Endpoint: GET /friend_requests/incoming/
Return a list of the current users pending outgoing friend requests. The request and return fields are the same as in Get Friends.
Endpoint: GET /friend_requests/outgoing/
Endpoint: POST /pin/
Make a new ReMemri pin and post it to the map. Note that only logged in users can make pins. When a pin is made an image is attached to it and the visibility is set (either public or only friends). Make post is it's own action detailed in the Post Photo section below.
Request Parameters
| Key | Location | Type | Description |
|---|---|---|---|
username |
Session Cookie | String | Current User |
is_public |
JSON | Boolean | Truth value for whether or not the pin has public visibility |
pin_location |
JSON | String | User's current location that the pin is being posted from |
Make and accept friend requests to/from other users in the ReMemri system. Note that only MUTUAL friends (i.e. both users have friended each other) will be able to view and comment on each other's pins. The JSON object that is used for making and accepting friend requests is the same and is detailed below.
Endpoint is: POST /friend_request/
Request Parameters
| Key | Location | Type | Description |
|---|---|---|---|
user1 |
Session Cookie | String | Current User |
user2 |
JSON | String | Target User |
action |
JSON | String | User's desired action regarding the friend request, can be either [accept], [reject], or [request] |
Post a comment on a pin in a nearby location. Note that only signed in users will be able to post comments. If a user is not signed in, comments will be displayed on public pins but the user cannot interact.
Endpoint: POST /comment/
Request Parameters
Note: this is similar to the comment object described in the Get Pin section
| Key | Location | Type | Description |
|---|---|---|---|
username |
Session Cookie | String | Current User |
comment_text |
JSON | String | Text of the given comment |
pin_id |
JSON | Integer | Unique ID for the pin this comment is associated with |
Endpoint: POST /accounts/sign_up/
Request Parameters
| Key | Location | Type | Description |
|---|---|---|---|
username |
JSON | String | Chosen username from sign up form |
password |
JSON | String | Chosen password from sign up form |
Endpoint: POST /accounts/sign_in/
Request Parameters
| Key | Location | Type | Description |
|---|---|---|---|
username |
JSON | String | Chosen username from sign in form |
password |
JSON | String | Chosen password from sign in form |
Our front end will be written using a combination of native Kotlin, ARCore, and a third-party SDK called Mapbox. We will also be using the Google Maps API.
Mapbox will be used for ReMemri's map view. The pins will be displayed on the map view and the user will be able to click on pins to view them in Augmented Reality mode.
ARCore will be used for ReMemri's Augmented Rreality view. When a user clicks on a pin in map view, AR view will launch and the user will be able to see the images at the given pin in AR.
We use Google Maps API on the back end to calculate distances between points as well as geocoding to retrieve address information from latitude and longitude data.