Add a new todo API - Merevoli-DatLuu/entrace_test_to_do_api GitHub Wiki

/todo POST - Thêm một record todo mới

HTTP/1.1 POST /api/v1/todo

  • Permission: everyone
  • Require Logged In: true

Parameter:

Field Method Type Description Required
name POST string tên task todo *
description POST string mô tả *
user_id POST int id của user được assign *
date_of_completion POST string hạn hoàn thành todo * và theo format yyyy-mm-ddThh:mm

Success 200:

Field Type Description
status string Trạng thái
message string Thông báo chi tiết
data json Thông tin todo vừa tạo

Example:

Request body

{
    "name": "todo 7",
    "description": "description of todo 7",
    "user_id": 2,
    "date_of_completion: "2021-12-30T12:30"
}

Response

{
    "status": "success",
    "message": "add a new todo succesfully",
    "data": {
        "id": 5,
        "name": "todo 5",
        "description": "description of todo 5",
        "date_of_completion": "2021-12-30T12:30:00Z",
        "status": "NEW",
        "date_of_creation": "2021-07-01T13:23:53.637728Z",
        "date_of_modification": "2021-07-01T13:23:53.637728Z",
        "user_id": 2
    }
}