Skip to content

Instantly share code, notes, and snippets.

@wyndmill
Created May 5, 2023 14:34
Show Gist options
  • Save wyndmill/e0844c46b5463f72527f37593b96bddb to your computer and use it in GitHub Desktop.
Save wyndmill/e0844c46b5463f72527f37593b96bddb to your computer and use it in GitHub Desktop.
# comment
/route
GET HEADERS: RESPONSE
DELETE HEADERS: RESPONSE
POST BODY HEADERS: RESPONSE
PUT BODY HEADERS: RESPONSE
/subroute?thing
QUERY thing: what the query does
GET HEADERS: RESPONSE
# comment
/[dynamicroute]
PARAM dynamicroute
# api base url: api.wasteof.money
# work in progress
/session
GET { Authorization }: returns user associated with Authorization token
POST { username, password }: returns a token to use in your Authorization header
DELETE { Authorization }: removes the session
/users/[user.name]
PARAM user.name: username of a regestered user
GET: returns user object
/name
GET: returns user's name (useless)
PUT { name } { Authorization }: sets user name (must be available)
/bio
GET: returns users bio
PUT { bio } { Authorization }: sets user bio
/posts?page
QUERY page: this api only returns 15 posts at a time, this offsets that so you can paginate through them
GET: returns 15 of a users posts, and a bool "last" that says if its the last page of posts.
/picture
GET: returns [user]'s avatar
/banner
GET: returns [user]'s banner
/followers?page
QUERY page: this api only returns 15 users at a time, this offsets that so you can paginate through them
GET: returns 15 of [user]'s followers, and a bool "last" that says if its the last page of followers.
/[follower.username]
PARAM follower.username: username of a potential follower
GET: returns either true or false depending on whether [follower] is following [user]
/following?page
QUERY page: this api only returns 15 users at a time, this offsets that so you can paginate through them
GET: returns 15 of a [user]'s following, and a bool "last" that says if its the last page of following.
/posts?page
QUERY page: this api only returns 15 posts at a time, this offsets that so you can paginate through them
GET: returns 15 of [user]'s following's posts, and a bool "last" that says if its the last page of posts.
/posts/[post.id]
PARAM post.id: the id of the post, its a MongoDB ObjectId
GET: returns post info
POST { Authorization } { post, repost }: post is the content and repost is the postid of what you are reposting if you are.
DELETE { Authorization }: deletes the post if it belongs to the account the token belongs to
/comments?post
QUERY page: this api only returns 15 comments at a time, this offsets that so you can paginate through them
GET: returns 15 of [post]'s comments, and a bool "last" that says if its the last page of comments.
/pin
POST { Authorization }: pins the post to [Authorization.token]'s profile if they own it
/unpin
POST { Authorization }: unpins the post to [Authorization.token]'s profile if its pinned
/loves
POST { Authorization }: toggles if [Authorization.token]'s user has loved the post
/[lover.name]
PARAM lover.name: user who may or may have not loved [post]
GET: returns a bool if [lover] has loved [post]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment