Category


POST api/categories

This route allows users to create new category buckets for easier organization of tasks. All tasks are initially placed in an 'uncategorized' category, and then can be dragged/dropped into newly made category buckets.

Expected Headers:

"Content-Type": "application/json"
"Authorization": "Bearer <token>"

Expected Body:

{
    "name": "<sring>",
    "user": "user id"
}

Expected Response:

{
  "__v": 0,
  "name": "Today",
  "user": "58f5a7cdc0fc830554454e9b",
  "_id": "58f5a99abf992807e74929c2"
}

GET api/categories

This route will retrieve the user's existing categories

Expected Headers:

"Authorization": "Bearer <token>"

Expected Response:

[
  {
    "_id": "58f5a7cdc0fc830554454e9c",
    "name": "uncategorized",
    "user": "58f5a7cdc0fc830554454e9b",
    "__v": 0
  },
  {
    "_id": "58f5ac2bbf992807e74929c4",
    "name": "Today",
    "user": "58f5a7cdc0fc830554454e9b",
    "__v": 0
  }
]

PUT api/categories/:id

This route allows the user to update the name of existing category buckets

Expected Headers:

"Authorization": "Bearer <token>"

Expected Body:

{
    "name": "<string>",
}

Expected Response:

[
  {
    "_id": "58f5a7cdc0fc830554454e9c",
    "name": "uncategorized",
    "user": "58f5a7cdc0fc830554454e9b",
    "__v": 0
  },
  {
    "_id": "58f5ac2bbf992807e74929c4",
    "name": "Tomorrow",
    "user": "58f5a7cdc0fc830554454e9b",
    "__v": 0
  }
]

DELETE api/categories/:id

This route allows users to delete an existing category bucket. Upon success, no body will be returned

Expected Headers:

"Authorization": "Bearer <token>"

results matching ""

    No results matching ""