kanban

Creating fancy kanban

  • RESTful endpoint for Kanban's CRUD operation
  • JSON formatted response

RESTful endpoints

POST /register

user Register

Request Header

not needed

Request Body

{
  email : <posted-email>,
  password : <posted-password>,
  first_name : <posted-first_name>,
  last_name : <posted-last_name>
}

Response (201)

[
    {
    "id": <Automatically generated by database>,
    "email": <posted-email>,
    "first_name" : <posted-first_name>,
    "last_name" : <posted-last_name>,
    "password": <hashed posted-password>,
    "updatedAt": "2020-05-08T11:26:59.712Z",
    "createdAt": "2020-05-08T11:26:59.712Z"
    }
]

Response (400 - Bad Request)

{
  "errorCode" = 'VALIDATION_ERROR'
  "message": "<returned error message>"
}

Response (500 - Internal Server Error)

{
  "message": "<returned error message>"
}

POST /login

user Login

Request Header

not needed

Request Body

{
  email : <posted-email>,
  password : <posted-password>
}

Response (201)

[
    {
    "access_token": <This access token generated automatically when you Log-in>
    }
]

Response (400 - Bad Request)

{
  "errorCode" = 'INVALID_EMAIL_OR_PASSWORD'
  "message": "<returned error message>"
}

Response (500 - Internal Server Error)

{
  "message": "<returned error message>"
}

GET /task

Get all task

Request Header

{
    "access_token": <This access token generated automatically when you Log-in>
}

Request Body

not needed

Response (200)

[
    {
        "id": <Automatically generated by database>,
        "title": "<task title>",
        "category": "<task category>",
        "UserId": "<id of creator of this task>",
        "organization": "<"Hacktiv8" by default>",
        "createdAt": "2020-05-08T07:20:33.949Z",
        "updatedAt": "2020-05-08T07:20:33.949Z"
    },
        "id": <Automatically generated by database>,
        "title": "<task title>",
        "category": "<task category>",
        "UserId": "<id of creator of this task>",
        "organization": "<"Hacktiv8" by default>",
        "createdAt": "2020-05-08T07:20:33.949Z",
        "updatedAt": "2020-05-08T07:20:33.949Z"
    },
        "id": <Automatically generated by database>,
        "title": "<task title>",
        "category": "<task category>",
        "UserId": "<id of creator of this task>",
        "organization": "<"Hacktiv8" by default>",
        "createdAt": "2020-05-08T07:20:33.949Z",
        "updatedAt": "2020-05-08T07:20:33.949Z"
    }
]

Response (500 - Internal Server Error)

{
  "message": "<returned error message>"
}

GET /task /:id

Find Task by id

Request Header

{
    "access_token": <This access token generated automatically when you Log-in>
}

Request Body

not needed

Request Params

{ id: ':id' }

Response (200 - Ok)

[
    {
        "id": 1 <if req.params.id is '1'>,
        "title": "<task title>",
        "category": "<task category>",
        "status": "<todos status after create or update>",
        "UserId": "<req.userData.id>",
        "organization": "<'Hacktiv8' by default>",
        "createdAt": "2020-05-08T07:20:33.949Z",
        "updatedAt": "2020-05-08T07:20:33.949Z"
    }
]

Response (404 - Not Found)

{
    "message": "Data not found"
}

Response (500 - Internal Server Error)

{
  "message": "<returned error message>"
}

POST /task

Create new task

Request Header

{
    "access_token": <This access token generated automatically when you Log-in>
}

Request Body

{
  "title": "<posted title of Kanban>",
  "category": "<posted category of Kanban>"
}

Request userData

{
    "id" : <id after access_token decoded by authentication>,
    "first_name" : <first_name after access_token decoded by authentication>,
    "last_name" : <last_name after access_token decoded by authentication>,
    "email" : <email> after access_token decoded by authentication>,
    "organization" : <organization after access_token decoded by authentication>,
}

Response (201 - Created)

{
    "id": <given id by system>,
    "title": "<posted title>",
    "category": "<posted category>",
    "UserId": "<req.userData.id>",
    "organization": "<'Hacktiv8' by default>"
    "updatedAt": "2020-05-08T11:19:26.267Z",
    "createdAt": "2020-05-08T11:19:26.267Z"
}

Response (400 - Bad Request)

{
    "message": [
        'Title task should not empty' <if title column is empty>,
        'Category task should not empty' <if category column is empty>
    ]
}

Response (500 - Internal Server Error)

{
  "message": "<returned error message>"
}

PUT /task/:id

Update task Id

Request Header

{
    "access_token": <This access token generated automatically when you Log-in>
}

Request Body

{
  "title": "<updated title of task>",
  "category": "<updated category of task>"
}

Request Params

{ id: ':id' }

Response (200 - Ok)

{
    "id": <given id by system>,
    "title": "<updated title>",
    "category": "<updated category>",
    "UserId": "<req.userData.id>",
    "organization": "<'Hacktiv8' by default>",
    "updatedAt": "2020-05-08T11:19:26.267Z",
    "createdAt": "2020-05-08T11:19:26.267Z"
}

Response (400 - Bad Request)

{
    "message": [
        'Title task should not empty' <if title column is empty>,
        'Category task should not empty' <if category column is empty>
    ]
}

Response (404 - Not Found)

{
    "message": "Data not found"
}

Response (500 - Internal Server Error)

{
  "message": "<returned error message>"
}

DELETE /task/:id

Delete task by id

Request Header

{
    "access_token": <This access token generated automatically when you Log-in>
}

Request Body

not needed

Request Params

{ id: ':id' }

Response (200 - Ok)

{
    "message": "data succesfully deleted"
}

Response (404 - Not Found)

{
    "message": "Data not found"
}

Response (500 - Internal Server Error)

{
  "message": "<returned error message>"
}