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 Current User
current_location JSON String User's current location
friend_list JSON JSON List User's list of friend usernames

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

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 can include one post, or multiple posts in a stack. A post contains an image and comments attached to that image. All posts in a stack belong to the same user.

Endpoint: GET/pin/pin_id/

Request Parameters

Key Location Type Description
username Session Cookie String Current User
current_location JSON String User's current location

Returns
A JSON object with several nested JSON objects as fields will be returned, the nested fields are detailed below this initial table

Key Location Type Description
pin_id JSON Integer Unique ID for the given pin
owner_id JSON String Unique username for the owner of the pin
is_public JSON Boolean Truth value for whether or not the pin is public
is_owned_by_user JSON Boolean Truth value for whether or not the pin is owned by the signed in use
pin_location JSON String GPS location of the pin
posts JSON JSON Object List of post objects containing the posts associated with the pin

Post -- Nested JSON Object Description

Key Location Type Description
post_id JSON Integer Unique ID for the post
pin_id JSON Integer Unique ID for the pin this post 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 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 and pending follow requests (both incoming and outgoing). 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
Returns a list of Friend JSON Objects, described below

Key Location Type Description
friend_username JSON String Unique username for the given friend
follow_status JSON String Can be either [requested], [requesting], [mutual], or [none]

Post Pin

Endpoint: POST/pin/pin_id/

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
pin_id JSON Integer Unique id for new pin
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_info JSON JSON Object Information about the post attached to the new pin (the JSON object is of the same format as the other post object detailed in the Get Pin section)

Make Post

Make a new post to be attached to a ReMemri pin. This will be called automatically when a new pin is created and also when the user wants to add a post to a stack of posts at an existing pin. The information contained in the JSON object for making a post is the same as the one detailed in the Get Pin section above.

Endpoint: POST/post_id/

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.

If the user is making a friend request, the endpoint is: POST/friend_request/

If the user is accepting a friend request, the endpoint is: POST/accept_friend_request/

Request Parameters
Note: this is similar to the friend object described in the Get Friends section

Key Location Type Description
username Session Cookie String Current User
friend_username JSON String Unique username for the user that is to being requested as a friend
follow_status JSON String Can be either [requested], [requesting], [mutual], or [none]

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_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

Third-Party SDKs

Our front end will be written using a combination of native Kotlin and two third-party SDKs. These are Mapbox and ARCore.

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.

Clone this wiki locally