Delcom Open API Logo

Delcom

Lost & Founds

Dokumentasi API

Lost & Founds

Lost & Founds Endpoint

info: Mengolah data kehilangan dan temuan.


Base URL

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

Add New Lost & Found

Mencatat laporan barang hilang atau barang temuan baru.

  • URL
    • /lost-founds
  • Method
    • POST
  • Headers
    • Content-Type: application/json
    • Authorization: Bearer <token>
  • Request Body
    • title as string
    • description as string
    • status as lost | found
  • Contoh Request
    POST {{BaseURL}}/lost-founds
    Accept: application/json
    Authorization: Bearer <token>
    Content-Type: application/json
    
    {
        "title": "Contoh Judul",
        "description": "Contoh deskripsi",
        "status": "lost"
    }
    
  • Response Berhasil
    {
        "status": "success",
        "message": "Berhasil menambahkan data",
        "data": {
            "lost_found_id": 1
        }
    }
    
  • Response Gagal
    {
        "status": "fail",
        "message": "Data tidak valid",
        "data": {
            "field": [
                "Pesan validasi"
            ]
        }
    }
    

Change Cover Lost & Found

Mengunggah atau memperbarui foto bukti barang hilang/temuan.

  • URL
    • /lost-founds/:id/cover
  • Method
    • POST
  • Headers
    • Content-Type: multipart/form-data
    • Authorization: Bearer <token>
  • Request Body
    • cover as file
  • Contoh Request
    POST {{BaseURL}}/lost-founds/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 Lost & Found

Memperbarui status atau keterangan dari laporan barang hilang/temuan.

  • URL
    • /lost-founds/:id
  • Method
    • PUT
  • Headers
    • Content-Type: application/json
    • Authorization: Bearer <token>
  • Request Body
    • title as string
    • description as string
    • status as lost | found
    • is_completed as 1 | 0
      • Notes:
        • 1 as true
        • 0 as false
  • Contoh Request
    PUT {{BaseURL}}/lost-founds/1
    Accept: application/json
    Authorization: Bearer <token>
    Content-Type: application/json
    
    {
        "title": "Contoh Judul",
        "description": "Contoh deskripsi",
        "status": "lost",
        "is_completed": 0
    }
    
  • Response Berhasil
    {
        "status": "success",
        "message": "Berhasil mengubah data"
    }
    
  • Response Gagal
    {
        "status": "fail",
        "message": "Data tidak valid",
        "data": {
            "field": [
                "Pesan validasi"
            ]
        }
    }
    

Get All Lost & Founds

Mengambil seluruh daftar laporan barang hilang dan barang temuan.

  • URL
    • /lost-founds
  • Parameters
    • is_completed as 1 | 0
      • Notes:
        • 1 as true
        • 0 as false
    • is_me as 1
      • Notes:
        • 1 as retrieve all data created
    • status as lost | found
  • Method
    • GET
  • Headers
    • Authorization: Bearer <token>
  • Contoh Request
    GET {{BaseURL}}/lost-founds
    Accept: application/json
    Authorization: Bearer <token>
    
  • Response Berhasil
    {
        "status": "success",
        "message": "Berhasil mengambil data",
        "data": {
            "lost_founds": [
                {
                    "id": 8,
                    "user_id": 1,
                    "title": "Update judul 2",
                    "description": "Update deskripsi 2",
                    "status": "found",
                    "is_completed": 0,
                    "cover": "img/lost-founds/cover/1_1709106579.png",
                    "created_at": "2024-02-28T07:49:32.000000Z",
                    "updated_at": "2024-02-28T07:49:39.000000Z",
                    "author": {
                        "name": "Delcom Testing",
                        "photo": null
                    }
                },
                {
                    "id": 9,
                    "user_id": 1,
                    "title": "Testing Title 2",
                    "description": "Testing Deskripsi 2",
                    "status": "found",
                    "is_completed": 0,
                    "cover": null,
                    "created_at": "2024-02-28T07:50:37.000000Z",
                    "updated_at": "2024-02-28T07:50:37.000000Z",
                    "author": {
                        "name": "Delcom Testing",
                        "photo": null
                    }
                }
            ]
        }
    }
    
  • Response Gagal
    {
        "status": "fail",
        "message": "Data tidak valid",
        "data": {
            "field": [
                "Pesan validasi"
            ]
        }
    }
    

Detail Lost & Found

Melihat informasi lengkap detail laporan barang hilang/temuan berdasarkan ID.

  • URL
    • /lost-founds/:id
  • Method
    • GET
  • Headers
    • Authorization: Bearer <token>
  • Contoh Request
    GET {{BaseURL}}/lost-founds/1
    Accept: application/json
    Authorization: Bearer <token>
    
  • Response Berhasil
    {
        "status": "success",
        "message": "Berhasil mengambil data",
        "data": {
            "lost_found": {
                "id": 9,
                "user_id": 1,
                "title": "Testing Title 2",
                "description": "Testing Deskripsi 2",
                "status": "found",
                "is_completed": 0,
                "cover": null,
                "created_at": "2024-02-28T07:50:37.000000Z",
                "updated_at": "2024-02-28T07:50:37.000000Z",
                "author": {
                    "name": "Delcom Testing",
                    "photo": null
                }
            }
        }
    }
    
  • Response Gagal
    {
        "status": "fail",
        "message": "Data tidak valid",
        "data": {
            "field": [
                "Pesan validasi"
            ]
        }
    }
    

Delete Lost & Found

Menghapus laporan barang hilang/temuan dari sistem.

  • URL
    • /lost-founds/:id
  • Method
    • DELETE
  • Headers
    • Authorization: Bearer <token>
  • Contoh Request
    DELETE {{BaseURL}}/lost-founds/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"
            ]
        }
    }
    

Get Stats Daily

Mendapatkan data statistik harian untuk laporan barang hilang dan temuan.

  • URL
    • /lost-founds/stats/daily
  • Request Body
    • end_date as timestamp, example: 2024-10-05 22:00:00
    • total_data as number
  • Method
    • GET
  • Headers
    • Authorization: Bearer <token>
  • Contoh Request
    GET {{BaseURL}}/lost-founds/stats/daily
    Accept: application/json
    Authorization: Bearer <token>
    
  • Response Berhasil
    {
        "status": "success",
        "message": "Berhasil mengambil data",
        "data": {
            "stats_losts": {
                "01-10-2024": 0,
                "02-10-2024": 0,
                "03-10-2024": 0,
                "04-10-2024": 0,
                "05-10-2024": 0,
                "06-10-2024": 1,
                "07-10-2024": 0
            },
            "stats_losts_completed": {
                "01-10-2024": 0,
                "02-10-2024": 0,
                "03-10-2024": 0,
                "04-10-2024": 0,
                "05-10-2024": 0,
                "06-10-2024": 0,
                "07-10-2024": 0
            },
            "stats_losts_process": {
                "01-10-2024": 0,
                "02-10-2024": 0,
                "03-10-2024": 0,
                "04-10-2024": 0,
                "05-10-2024": 0,
                "06-10-2024": 1,
                "07-10-2024": 0
            },
            "stats_founds": {
                "01-10-2024": 0,
                "02-10-2024": 0,
                "03-10-2024": 0,
                "04-10-2024": 0,
                "05-10-2024": 0,
                "06-10-2024": 1,
                "07-10-2024": 0
            },
            "stats_founds_completed": {
                "01-10-2024": 0,
                "02-10-2024": 0,
                "03-10-2024": 0,
                "04-10-2024": 0,
                "05-10-2024": 0,
                "06-10-2024": 0,
                "07-10-2024": 0
            },
            "stats_founds_process": {
                "01-10-2024": 0,
                "02-10-2024": 0,
                "03-10-2024": 0,
                "04-10-2024": 0,
                "05-10-2024": 0,
                "06-10-2024": 1,
                "07-10-2024": 0
            }
        }
    }
    
  • Response Gagal
    {
        "status": "fail",
        "message": "Data tidak valid",
        "data": {
            "field": [
                "Pesan validasi"
            ]
        }
    }
    

Get Stats Monthly

Mendapatkan data statistik bulanan untuk laporan barang hilang dan temuan.

  • URL
    • /lost-founds/stats/monthly
  • Request Body
    • end_date as timestamp, example: 2024-10-05 22:00:00
    • total_data as number
  • Method
    • GET
  • Headers
    • Authorization: Bearer <token>
  • Contoh Request
    GET {{BaseURL}}/lost-founds/stats/monthly
    Accept: application/json
    Authorization: Bearer <token>
    
  • Response Berhasil
    {
        "status": "success",
        "message": "Berhasil mengambil data",
        "data": {
            "stats_losts": {
                "06-2024": 0,
                "07-2024": 0,
                "08-2024": 0,
                "09-2024": 0,
                "10-2024": 1
            },
            "stats_losts_completed": {
                "06-2024": 0,
                "07-2024": 0,
                "08-2024": 0,
                "09-2024": 0,
                "10-2024": 0
            },
            "stats_losts_process": {
                "06-2024": 0,
                "07-2024": 0,
                "08-2024": 0,
                "09-2024": 0,
                "10-2024": 1
            },
            "stats_founds": {
                "06-2024": 0,
                "07-2024": 0,
                "08-2024": 0,
                "09-2024": 0,
                "10-2024": 1
            },
            "stats_founds_completed": {
                "06-2024": 0,
                "07-2024": 0,
                "08-2024": 0,
                "09-2024": 0,
                "10-2024": 0
            },
            "stats_founds_process": {
                "06-2024": 0,
                "07-2024": 0,
                "08-2024": 0,
                "09-2024": 0,
                "10-2024": 1
            }
        }
    }
    
  • Response Gagal
    {
        "status": "fail",
        "message": "Data tidak valid",
        "data": {
            "field": [
                "Pesan validasi"
            ]
        }
    }
    

Delete All Lost & Found

Menghapus semua data lost & found milik pengguna saat ini secara permanen beserta berkas covernya.

  • URL
    • /lost-founds
  • Method
    • DELETE
  • Headers
    • Authorization: Bearer <token>
  • Contoh Request
    DELETE {{BaseURL}}/lost-founds
    Accept: application/json
    Authorization: Bearer <token>
    
  • Response Berhasil
    {
        "status": "success",
        "message": "Berhasil menghapus semua data lost and found"
    }
    
  • Response Gagal
    {
        "status": "fail",
        "message": "Unauthenticated."
    }