Todos Endpoint

{info} Mengolah data todo.


Base URL

https://public-api.delcom.org/api/v1

Add New Todo

  • URL
    • /todos
  • Method
    • POST
  • Headers
    • Content-Type: application/x-www-form-urlencoded
    • Authorization: Bearer <token>
  • Request Body
    • title as string
    • description as string
  • Response
    {
        "success": true,
        "message": "Berhasil menambahkan data",
        "data": {
            "todo_id": 1
        }
    }

Change Cover Todo

  • URL
    • /todos/:id/cover
  • Method
    • POST
  • Headers
    • Content-Type: multipart/form-data
    • Authorization: Bearer <token>
  • Request Body
    • cover as file
  • Response
    {
        "success": true,
        "message": "Berhasil mengubah cover"
    }

Update Todo

  • URL
    • /todos/:id
  • Method
    • PUT
  • Headers
    • Content-Type: application/x-www-form-urlencoded
    • Authorization: Bearer <token>
  • Request Body
    • title as string
    • description as string
    • is_finished as 1 | 0
      • Notes:
        • 1 as true
        • 0 as false
  • Response
    {
        "success": true,
        "message": "Berhasil mengubah data"
    }

Get All Todos

  • URL
    • /todos
  • Parameters
    • is_finished as 1 | 0
      • Notes:
        • 1 as true
        • 0 as false
  • Method
    • GET
  • Headers
    • Authorization: Bearer <token>
  • Response
    {
        "success": true,
        "message": "Berhasil mengambil data",
        "data": {
            "todos": [
                {
                    "id": 1,
                    "title": "Update judul",
                    "description": "Update deskripsi",
                    "is_finished": 1,
                    "cover": null,
                    "created_at": "2024-02-26T02:34:26.000000Z",
                    "updated_at": "2024-02-26T02:44:47.000000Z"
                },
                {
                    "id": 2,
                    "title": "Update judul 2",
                    "description": "Update deskripsi 2",
                    "is_finished": 0,
                    "cover": "img/cover/1_1708916270.png",
                    "created_at": "2024-02-26T02:45:59.000000Z",
                    "updated_at": "2024-02-26T02:58:28.000000Z"
                }
            ]
        }
    }

Detail Todo

  • URL
    • /todos/:id
  • Method
    • GET
  • Headers
    • Authorization: Bearer <token>
  • Response
    {
        "success": true,
        "message": "Berhasil mengambil data",
        "data": {
            "todo": {
                "id": 2,
                "title": "Update judul 2",
                "description": "Update deskripsi 2",
                "is_finished": 0,
                "cover": "img/cover/1_1708916270.png",
                "created_at": "2024-02-26T02:45:59.000000Z",
                "updated_at": "2024-02-26T02:58:28.000000Z"
            }
        }
    }

Delete Todo

  • URL
    • /todos/:id
  • Method
    • DELETE
  • Headers
    • Authorization: Bearer <token>
  • Response
    {
        "success": true,
        "message": "Berhasil menghapus data"
    }