Dokumentasi API
Todos
Todos Endpoint
info: Mengolah data todo.
- Base URL
- Add New Todo
- Change Cover Todo
- Update Todo
- Get All Todo
- Detail Todo
- Delete Todo
- Delete All Todos
Base URL
https://open-api.delcom.org/api/v1
Add New Todo
Menambahkan data todo atau catatan tugas baru.
- URL
/todos
- Method
- POST
- Headers
Content-Type:application/jsonAuthorization:Bearer <token>
- Request Body
titleasstringdescriptionasstring
- Contoh Request
POST {{BaseURL}}/todos Accept: application/json Authorization: Bearer <token> Content-Type: application/json { "title": "Contoh Judul", "description": "Contoh deskripsi" } - Response Berhasil
{ "status": "success", "message": "Berhasil menambahkan data", "data": { "todo_id": 1 } } - Response Gagal
{ "status": "fail", "message": "Data tidak valid", "data": { "field": [ "Pesan validasi" ] } }
Change Cover Todo
Mengunggah atau memperbarui gambar sampul (cover) pada todo tertentu.
- URL
/todos/:id/cover
- Method
- POST
- Headers
Content-Type:multipart/form-dataAuthorization:Bearer <token>
- Request Body
coverasfile
- Contoh Request
POST {{BaseURL}}/todos/1/cover Accept: application/json Authorization: Bearer <token> Content-Type: multipart/form-data; boundary=----DelcomFormBoundary ------DelcomFormBoundary Content-Disposition: form-data; name="cover"; filename="cover.jpg" Content-Type: image/jpeg < ./cover.jpg ------DelcomFormBoundary-- - Response Berhasil
{ "status": "success", "message": "Berhasil mengubah cover" } - Response Gagal
{ "status": "fail", "message": "Data tidak valid", "data": { "field": [ "Pesan validasi" ] } }
Update Todo
Memperbarui judul, deskripsi, atau status penyelesaian (is_finished) pada todo.
- URL
/todos/:id
- Method
- PUT
- Headers
Content-Type:application/jsonAuthorization:Bearer <token>
- Request Body
titleasstringdescriptionasstringis_finishedas1 | 0- Notes:
1astrue0asfalse
- Notes:
- Contoh Request
PUT {{BaseURL}}/todos/1 Accept: application/json Authorization: Bearer <token> Content-Type: application/json { "title": "Contoh Judul", "description": "Contoh deskripsi", "is_finished": 0 } - Response Berhasil
{ "status": "success", "message": "Berhasil mengubah data" } - Response Gagal
{ "status": "fail", "message": "Data tidak valid", "data": { "field": [ "Pesan validasi" ] } }
Get All Todos
Mengambil daftar seluruh data todo milik pengguna, dengan opsi filter status selesai.
- URL
/todos
- Parameters
is_finishedas1 | 0- Notes:
1astrue0asfalse
- Notes:
- Method
- GET
- Headers
Authorization:Bearer <token>
- Contoh Request
GET {{BaseURL}}/todos Accept: application/json Authorization: Bearer <token> - Response Berhasil
{ "status": "success", "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" } ] } } - Response Gagal
{ "status": "fail", "message": "Data tidak valid", "data": { "field": [ "Pesan validasi" ] } }
Detail Todo
Mendapatkan informasi lengkap dari satu todo berdasarkan ID.
- URL
/todos/:id
- Method
- GET
- Headers
Authorization:Bearer <token>
- Contoh Request
GET {{BaseURL}}/todos/1 Accept: application/json Authorization: Bearer <token> - Response Berhasil
{ "status": "success", "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" } } } - Response Gagal
{ "status": "fail", "message": "Data tidak valid", "data": { "field": [ "Pesan validasi" ] } }
Delete Todo
Menghapus data todo yang dipilih dari sistem secara permanen.
- URL
/todos/:id
- Method
- DELETE
- Headers
Authorization:Bearer <token>
- Contoh Request
DELETE {{BaseURL}}/todos/1 Accept: application/json Authorization: Bearer <token> - Response Berhasil
{ "status": "success", "message": "Berhasil menghapus data" } - Response Gagal
{ "status": "fail", "message": "Data tidak valid", "data": { "field": [ "Pesan validasi" ] } }
Delete All Todos
Menghapus semua data todo milik pengguna saat ini secara permanen beserta berkas covernya.
- URL
/todos
- Method
- DELETE
- Headers
Authorization:Bearer <token>
- Contoh Request
DELETE {{BaseURL}}/todos Accept: application/json Authorization: Bearer <token> - Response Berhasil
{ "status": "success", "message": "Berhasil menghapus semua data todo" } - Response Gagal
{ "status": "fail", "message": "Unauthenticated." }