API Centra Demo - Endpoint Documentation

Deskripsi

Endpoint ini digunakan untuk mengambil data CentraDemo yang telah difilter dan siap digunakan untuk visualisasi peta (map, tracking, playback).


[GET] Filtered CentraDemo Records


Query Parameters

Parameter Type Required Description
hasLatitude boolean No Filter records that have latitude data (index 2 in the CSV data).
hasLongitude boolean No Filter records that have longitude data (index 3 in the CSV data).
hasCoordinates boolean No Filter records that have both latitude and longitude data.
deviceId string No Filter records by a specific device ID (index 1 in the CSV data).
cursor string (UUID) No The ID of the last record from the previous request for pagination.
take number No Number of records to retrieve (default: 10, min: 1).
orderBy string No Sort order by created_at. Values: asc, desc (default: desc).
days number No Limit results to records from the last N days.

Response Structure

The response follows a standard format:


Contoh Request:

GET /api/centra-demo/map/filtered?hasCoordinates=true&take=100&orderBy=desc

Response:

{
  "status": "success",
  "message": "Filtered CentraDemo records retrieved successfully",
  "data": {
    "items": [
      {
        "id": "02684108-6107-42ac-bebe-8fcddb23edf8",
        "data": "11:32:38 2026-01-30,111102,-6.190965,106.764906,56.40,0.11,,,1,1",
        "created_at": "2026-01-30T04:34:18.495Z",
        "updated_at": "2026-01-30T04:34:18.495Z",
        "parsedData": {
          "timestamp": "11:32:38 2026-01-30",
          "id": "111102",
          "latitude": -6.190965,
          "longitude": 106.764906,
          "altitude": 56.4,
          "imei": "111102111111111",
          "speed": 0.11,
          "additionalData": [
            "56.40",
            "0.11",
            "",
            "",
            "1",
            "1"
          ]
        }
      },
      {
        "id": "e40718ae-7614-4dba-87dc-f0b72d0976aa",
        "data": "09:50:41 2026-01-29,111100,-6.190979,106.764928,50.00,0.15,,,1,1",
        "created_at": "2026-01-29T02:52:20.647Z",
        "updated_at": "2026-01-29T02:52:20.647Z",
        "parsedData": {
          "timestamp": "09:50:41 2026-01-29",
          "id": "111100",
          "latitude": -6.190979,
          "longitude": 106.764928,
          "altitude": 50,
          "imei": "111100111111111",
          "speed": 0.15,
          "additionalData": [
            "50.00",
            "0.15",
            "",
            "",
            "1",
            "1"
          ]
        }
      },
      {
        "id": "dea08500-dd4c-454b-88b9-88fbe0168776",
        "data": "15:07:22 2026-01-28,,-6.190922,106.764912,46.50,0.30,,,1,1",
        "created_at": "2026-01-28T08:09:01.348Z",
        "updated_at": "2026-01-28T08:09:01.348Z",
        "parsedData": {
          "timestamp": "15:07:22 2026-01-28",
          "id": null,
          "latitude": -6.190922,
          "longitude": 106.764912,
          "altitude": 46.5,
          "imei": "111111111111111",
          "speed": 0.3,
          "additionalData": [
            "46.50",
            "0.30",
            "",
            "",
            "1",
            "1"
          ]
        }
      },
      {
        "id": "6fc416ee-0246-4ebf-a02b-cb423ebebb86",
        "data": "1768474211,111101,-2.160722,103.717386,54.50,0.00,,,1,1",
        "created_at": "2026-01-27T09:37:19.228Z",
        "updated_at": "2026-01-27T09:37:19.228Z",
        "parsedData": {
          "timestamp": "1768474211",
          "id": "111101",
          "latitude": -2.160722,
          "longitude": 103.717386,
          "altitude": 54.5,
          "imei": "111101111111111",
          "speed": 0,
          "additionalData": [
            "54.50",
            "0.00",
            "",
            "",
            "1",
            "1"
          ]
        }
      }
    ],
    "meta": {
      "take": 100,
      "orderBy": "desc",
      "cursor": null,
      "hasMore": false,
      "nextCursor": null,
      "filters": {
        "hasCoordinates": true,
        "days": null
      },
      "totalFiltered": 4,
      "totalBeforeGrouping": 825
    }
  }
}

[GET] CentraDemo History


Deskripsi

Endpoint ini digunakan untuk mengembalikan data kronologis untuk perangkat tertentu tanpa pengelompokan, berguna untuk pemutaran ulang jejak (track playback).


Query Parameters

Parameter Type Required Description
deviceId string Yes Device ID (DMR ID) to retrieve history for.
cursor string (UUID) No The ID of the last record from the previous request for pagination.
take number No Number of records to retrieve (default: 10, min: 1).
orderBy string No Sort order by created_at. Values: asc, desc (default: desc).
days number No Limit history to records from the last N days.

Response Structure

The response follows a standard format:

Contoh Request:

GET /api/centra-demo/map/history?deviceId=171008&take=50&orderBy=asc

Response:

{
  "success": true,
  "message": "CentraDemo history retrieved successfully",
  "data": {
    "items": [
      {
        "id": "uuid-asli-1",
        "data": "1696536762,171008,-6.191000,106.764776,76.00,,,1,1",
        "created_at": "2024-01-01T00:00:00.000Z",
        "interpolated": false,
        "parsedData": {
          "latitude": -6.191,
          "longitude": 106.764776
        }
      },
      {
        "id": "interpolated-uuid-asli-1-1",
        "data": "1696536772,171008,,106.764800:-6.191050:interpolated",
        "created_at": "2024-01-01T00:00:10.000Z",
        "interpolated": true,
        "parsedData": {
          "latitude": -6.19105,
          "longitude": 106.7648
        }
      }
    ],
    "meta": {
      "take": 50,
      "orderBy": "asc",
      "deviceId": "171008",
      "totalMatched": 120,
      "totalAfterInterpolation": 155
    }
  }
}

[POST] /api/centra-demo/


Deskripsi

Endpoint ini digunakan untuk menyimpan data CentraDemo baru ke database.


Request Body

Field Type Required Description
data string Yes The content string to be saved. Typically in CSV format for GPS data.

Response Structure


Example

Request Body:

{
  "data": "1696536762,171008,-6.191000,106.764776,76.00,15.5,270,1,1"
}

Response:

{
  "success": true,
  "message": "CentraDemo record created successfully",
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "data": "1696536762,171008,-6.191000,106.764776,76.00,15.5,270,1,1",
    "created_at": "2024-01-01T00:00:00.000Z",
    "updated_at": "2024-01-01T00:00:00.000Z"
  }
}

[GET] All CentraDemo Records

Mengambil daftar seluruh data CentraDemo dalam bentuk halaman (pagination). Endpoint ini mendukung pagination berbasis halaman sederhana serta pemfilteran berdasarkan ID perangkat.


Query Parameters

Parameter Type Required Description
cursor string No Page number for pagination (default: “1”).
take number No Number of records per page (default: 10).
orderBy string No Sort order by created_at. Values: asc, desc (default: desc).
deviceId string No Filter records by a specific device ID (DMR ID).

Response Structure


Example

Request:
GET /api/centra-demo?cursor=1&take=2&orderBy=desc

Response:

{
  "status": "success",
  "message": "CentraDemo records retrieved successfully",
  "data": {
    "items": [
      {
        "id": "68c7b81a-d28c-4732-8deb-d23d70787223",
        "data": "10:10:36 2026-02-02,111102,-6.190949,106.764919,47.10,0.24,,,1,1",
        "created_at": "2026-02-02T03:12:18.232Z",
        "updated_at": "2026-02-02T03:12:18.232Z",
        "parsedData": {
          "timestamp": "10:10:36 2026-02-02",
          "id": "111102",
          "latitude": -6.190949,
          "longitude": 106.764919,
          "additionalData": [
            "47.10",
            "0.24",
            "",
            "",
            "1",
            "1"
          ]
        }
      },
      {
        "id": "f55e6b5e-5191-4d8c-848a-7ffc8849087e",
        "data": "10:10:34 2026-02-02,111102,-6.190946,106.764918,47.70,0.13,,,1,1",
        "created_at": "2026-02-02T03:12:14.248Z",
        "updated_at": "2026-02-02T03:12:14.248Z",
        "parsedData": {
          "timestamp": "10:10:34 2026-02-02",
          "id": "111102",
          "latitude": -6.190946,
          "longitude": 106.764918,
          "additionalData": [
            "47.70",
            "0.13",
            "",
            "",
            "1",
            "1"
          ]
        }
      }
    ],
    "meta": {
      "take": 2,
      "orderBy": "desc",
      "cursor": "1",
      "hasMore": true,
      "nextCursor": "2",
      "totalCount": 843294,
      "currentPage": 1
    }
  }
}

Get CentraDemo Record by ID

Mengambil detail satu record menggunakan UUID unik.

Path Parameters

Parameter Type Required Description
id string (UUID) Yes The unique identifier of the record.

Response Example

{
  "success": true,
  "message": "CentraDemo record found successfully",
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "data": "1696536762,171008,-6.191000,106.764776,76.00,15.5,270,1,1",
    "created_at": "2024-01-01T00:00:00.000Z",
    "updated_at": "2024-01-01T00:00:00.000Z"
  }
}

Update CentraDemo Record

Melakukan update pada record yang sudah ada

Request Body

Field Type Required Description
data string No The updated content string.

Response Example

{
  "success": true,
  "message": "CentraDemo record updated successfully",
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "data": "Updated content string",
    "created_at": "2024-01-01T00:00:00.000Z",
    "updated_at": "2024-01-01T10:00:00.000Z"
  }
}

Delete CentraDemo Record

Menghapus record secara permanen dari database.

Response Example

{
  "success": true,
  "message": "CentraDemo record deleted successfully",
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "data": "Data that was deleted",
    "created_at": "2024-01-01T00:00:00.000Z",
    "updated_at": "2024-01-01T00:00:00.000Z"
  }
}