Skip to content

API Documentation

Kimi-Zou edited this page Dec 1, 2020 · 2 revisions

The ChoreScore API is organized around REST. Our API has predictable resource oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes and verbs.

API routes are not user-facing and should only be used by developers.

Resources:


USERS

Endpoints for the Users resource:

  • Log In - POST /chorescore/api/session
  • Sign Up - POST /chorescore/api/users
  • Log Out - DELETE /chorescore/api/session
  • Retrieve Single User - GET /chorescore/api/users/:id
  • Delete User - DELETE /chorescore/api/users/:id

Log In

POST /chorescore/api/session

Parameter Type Description Notes
credential string username or email of the user logging in required
password string password of the user logging in required

Returns a current user object if successful and sets an HTTP-only auth cookie, and returns an error otherwise.

// Current User Object
{
  "id": 1,
  "username": "zagreus",
  "email": "zagreus@bluebird.com"
}

Sign up

POST /chorescore/api/users

Parameter Type Description Notes
username string Desired username of the new user required
email string Desired email of the new user required
password string Desired password of the new user required
confirmPassword string Repeated password of the new user required, same as password

Returns a current user object if successful and sets an HTTP-only auth cookie, and returns an error otherwise.

// Current User Object
{
  "id": 1,
  "username": "zagreus",
  "email": "zagreus@bluebird.com"
}

Log Out

DELETE /chorescore/api/session

Parameter Type Description Notes
username string Desired username of the new user required
email string Desired email of the new user required
password string Desired password of the new user required
confirmPassword string Repeated password of the new user required, same as password

Returns a success message and remove the HTTP-only auth cookie if successful, and returns an error otherwise.

// Success Message
{
  "message": "success"
}

Retrieve Single User

GET /chorescore/api/users/:id

Parameter Type Description Notes
id ID id of the user required

Returns a user object if successful, and returns an error otherwise.

// User Object
{
  "id": 1,
  "username": "zagreus"
}

Delete User

DELETE /chorescore/api/users/:id

Parameter Type Description Notes
id ID id of the user to delete required

Returns a success message if successful, and returns an error otherwise.

// Success Message
{
  "message": "success"
}

LISTS

Endpoints for the Lists resource:

  • Create List - POST /chorescore/api/lists
  • Retrieve List - GET /chorescore/api/lists/:id
  • Edit List - PUT /chorescore/api/lists/:id
  • Delete List - DELETE /chorescore/api/lists/:id

CHORES

Endpoints for the Chores resource:

  • Create Chore - POST /chorescore/api/chores
  • Retrieve Chore - GET /chorescore/api/chores/:id
  • Edit chore - PUT /chorescore/api/chores/:id
  • Complete Chore - PUT /chorescore/api/chores/:id
  • Delete Chore - DELETE /chorescore/api/chores/:id

BONUS - REWARDS

Endpoints for the Rewards resource:

  • Create Reward - POST /chorescore/api/rewards
  • Retrieve Reward - GET /chorescore/api/rewards/:id
  • Edit Reward - PUT /chorescore/api/rewards/:id
  • Redeem Reward - PUT /chorescore/api/rewards/:id
  • Delete Reward - DELETE /chorescore/api/rewards/:id

Clone this wiki locally