Skip to content

API Backend Routes

James Ko edited this page Feb 2, 2024 · 1 revision

User Authentication / Authorization

Get the Current User

GET: api/session

  • Successful Response when there is a User (200)
  • Successful Response when there is NO User (200)

Log in a User

A User should be able to Log in with visible confirmation and without causing any crashes.

POST: api/session

  • Successful Response (200)
  • Error Response: Invalid Credentials (401)
  • Error Response: Body Validation Error (400)

Sign Up a User

A User should be able to Sign Up for TheHobbyist without any crashes or bugs.

POST: api/users

  • Successful Response (201)
  • Error Response: User already exists with specified Email (500)
  • Error Response: User already exists with specified Username (500)
  • Error Response: Body Validation Error (400)

Profiles

Signed Up User will create a Profile (Create)

POST: api/profiles

  • Successful Response (201)
  • Error Response: Body Validation Error (400)

Logged in User can view their Profile (Read)

GET: api/profiles/:profileId

  • Successful Response (200)
  • Error Response: Profile not Found (404)

Logged in User can edit their Profile (Update)

PUT: api/profiles/:profileId

  • Successful Response (200)
  • Error Response: Body Validation Error (400)

Logged in User can delete their Profile (Delete)

DELETE: api/profiles/:profileId

  • Successful Response (200)
  • Error Response: Profile not Found (404)

Hobbies

Signed Up User can Create a New Hobby (Create)

POST: api/hobbies

  • Successful Response (201)
  • Error Response: Body Validation Error (400)

Signed up User can view all hobbies (READ)

GET: api/hobbies

  • Successful Response (200)

Signed up User can view a hobby detail (READ)

GET: api/hobbies/:hobbyId

  • Successful Response (200)
  • Error Response: Hobby not Found (404)

Signed up User can update the hobby they’ve created (UPDATE)

PUT: api/hobbies/:hobbyId

  • Successful Response (200)
  • Error Response: Body Validation Error (400)
  • Error Response: Hobby not Found (404)

Signed up User can delete the hobby they’ve created (DELETE)

DELETE: api/hobbies/:hobbyId

  • Successful Response (200)
  • Error Response: Hobby not Found (404)

Bookmarks

Signed up User can create a new bookmark (CREATE)

POST: api/bookmarks

  • Successful Response (201)
  • Error Response: Body Validation Error (400)

Signed Up User can view all of their bookmarks (READ)

GET: api/bookmarks

  • Successful Response (200)

Signed up User can Update their Bookmarks (UPDATE)

PUT: api/bookmarks/:bookmarkId

  • Successful Response (200)
  • Error Response: Bookmark not found (404)

Signed up User can Delete their Bookmarks (DELETE)

DELETE: api/bookmarks/:bookmarkId

  • Successful Response (200)
  • Error Response: Bookmark not found (404)

Reviews

Signed up User can Create a new Review for a hobby (CREATE)

POST: api/hobbies/:hobbyId/reviews

  • Successful Response (201)
  • Error Response: Body Validation Error (400)

Signed up User can view all Reviews for a hobby (READ)

GET: api/hobbies/:hobbyId/reviews

  • Successful Response (200)

Signed up User can Update a Review

PUT: api/hobbies/:hobbyId/reviews/:reviewId

  • Successful Response (200)
  • Error Response: Body Validation Error (400)
  • Error Response: Review not Found (404)

Signed up User can Delete their reviews (DELETE)

DELETE: api/hobbies/:hobbyId/reviews/:reviewId

  • Successful Response (200)
  • Error Response: Review not Found (404)