Skip to content

2. APIs and Controller

David Sanabria edited this page Feb 9, 2022 · 49 revisions

Get Nearby Pins

Return ReMemri pins that are within a given threshold of the user's current location. If the current user is logged in, the user will be able to see their friend's nearby posts as well as public posts (if they so choose). If no user is logged in, only public posts will be able to be seen.

Endpoint: GET/nearby_pins/

Request Parameters

Key Location Type Description
username Session Cookie String Unique ID for the current User
current_location JSON String User's current location

Returns
If a user is signed in

Key Location Type Description
friend_nearby_pins JSON JSON List List of pin objects that are nearby and owned by the user's friends
public_nearby_pins JSON JSON List List of nearby pin objects that are public and NOT owned by the user's friends

[TODO: figure out whether having two lists or one makes sense]

If no user is signed in

Key Location Type Description
public_nearby_pins JSON JSON List List of nearby pin objects that are public

Get Pin

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 Session Cookie String Current User

Returns
A JSON object with a nested JSON object for comments, the nested field is detailed below this initial table

Key Location Type Description
pin_id JSON Integer Unique ID for the post
owner_id JSON String Unique username for the owner of the post
is_owned_by_user JSON Boolean Truth value for whether or not the post is owned by the signed in user
image_url JSON String URL for the given image
timestamp JSON String Time this post was created
comments JSON JSON Object List of comments (and their information) associated with the post

Comment -- Nested JSON Object Description

Key Location Type Description
comment_id JSON Integer Unique ID for the comment
comment_text JSON String Text of the given comment
comment_timestamp JSON String Time this post was created
post_id JSON Integer Unique ID for the post this comment is associated with
owner_id JSON String Unique username for the owner of the post
is_owned_by_user JSON Boolean Truth value for whether or not the post is owned by the signed in use

Get Friends

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 posts.

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

Get Incoming Friend Requests

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/

Get Outgoing Friend Requests

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/

Post Pin

Endpoint: POST/pin/

Make a new ReMemri pin and post it to the map. Note that only logged in users can make posts. When a post 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 post has public visibility
pin_location JSON String User's current location that the pin is being posted from
post_id JSON Integer Unique ID for the attached post

Post Friends

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 posts. 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
username Session Cookie String Current User
action JSON String User's desired action regarding the friend request, can be either [accept], [reject], or [request]

Post Comment

Post a comment on a post within 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 posts 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
post_id JSON Integer Unique ID for the post this comment is associated with

Third-Party SDKs

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

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

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.

Google Maps API

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.

Clone this wiki locally