How the services fit together
- 8011 /public — NDC reference & inventori data (sektor, matrix, emisi GRK). Used by the home site via
NUXT_API_PUBLIC_BASE. - 8015 /api/public — Registri aksi mitigasi & capaian from data aktivitas. Used by the home site via
NUXT_API_TRACKING_BASE(Docker:http://backend:80/index.php). - 8014 — Nuxt home front-end; browser calls
/api/*routes that proxy to 8011 or 8015.
Public API (8011)
Sub Nasional
CRUD operations for sub-national (provincial) records.
URL
http://localhost:8011/public/sub_nasional.php
Query Parameters
| Name | Type | Required | Used in | Description |
|---|---|---|---|---|
| id | integer | optional | GET, PUT, DELETE | Record ID. Required for PUT and DELETE. |
| status | string | optional | GET | Filter by status: active or not active. |
Request Body (JSON)
| Field | Description |
|---|---|
| kode | (integer, required) Province code |
| nama | (string, required) Province name |
| status | (string, optional) "active" or "not active". Default: active |
| created_by | (string, optional) Creator identifier |
| Field | Description |
|---|---|
| kode | (integer, optional) Province code |
| nama | (string, optional) Province name |
| status | (string, optional) "active" or "not active" |
| created_by | (string, optional) Creator identifier |
Examples
-
GET all
GET /public/sub_nasional.php -
GET active
GET /public/sub_nasional.php?status=active -
GET by ID
GET /public/sub_nasional.php?id=1 -
POST
POST /public/sub_nasional.php { "kode": 31, "nama": "DKI Jakarta" } -
PUT
PUT /public/sub_nasional.php?id=1 { "nama": "Updated Name" } -
DELETE
DELETE /public/sub_nasional.php?id=1
Example Response
{
"status": "success",
"total": 2,
"data": [
{ "id": 1, "kode": 31, "nama": "DKI Jakarta", "status": "active", "created_by": null },
{ "id": 2, "kode": 32, "nama": "Jawa Barat", "status": "active", "created_by": null }
]
}
Public API (8011)
Sektor
Retrieve sector (emission sector) records.
URL
http://localhost:8011/public/sektor.php
Query Parameters
| Name | Type | Required | Used in | Description |
|---|---|---|---|---|
| id | integer | optional | GET | Filter by sector ID. |
| status | string | optional | GET | Filter by status: active or not active. |
Examples
-
GET all
GET /public/sektor.php -
GET active
GET /public/sektor.php?status=active -
GET by ID
GET /public/sektor.php?id=2
Example Response
{
"status": "success",
"total": 5,
"data": [
{ "id": 1, "nama": "Energi", "status": "active" },
{ "id": 2, "nama": "Transportasi", "status": "active" },
{ "id": 3, "nama": "IPPU", "status": "active" },
{ "id": 4, "nama": "Pertanian", "status": "active" },
{ "id": 5, "nama": "Kehutanan & Lahan", "status": "active" }
]
}
Public API (8011)
Sub Sektor
Sub-sector reference rows (optionally filtered by parent sector). Used by the public home site filters.
URL
http://localhost:8011/public/sub_sektor.php
Query Parameters
| Name | Type | Required | Used in | Description |
|---|---|---|---|---|
| id | integer | optional | GET | Return a single sub sektor by ID. |
| sektor_id | integer | optional | GET | Filter by parent sektor ID. |
| status | string | optional | GET | Filter by status (e.g. active). |
Examples
-
GET all active
GET /public/sub_sektor.php?status=active -
GET by sektor
GET /public/sub_sektor.php?status=active&sektor_id=5 -
GET by ID
GET /public/sub_sektor.php?id=14
Example Response
{
"status": "success",
"total": 2,
"data": [
{
"id": 14,
"nama": "Sub Sektor Kehutanan",
"id_sektor": 5,
"status": "active",
"sektor_nama": "Kehutanan dan Lahan"
}
]
}
Public API (8011)
Jenis Aksi Mitigasi (katalog)
Read-only catalog of mitigation action types (reference aksi_mitigasi). Only rows with status aktif. Detail by id includes HTML formula/help fields.
URL
http://localhost:8011/public/aksi_mitigasi.php
Query Parameters
| Name | Type | Required | Used in | Description |
|---|---|---|---|---|
| id | integer | optional | GET | Single catalog row by ID (includes rumus_html, etc.). |
| sektor_id | integer | optional | GET | Filter by sektor. |
| sub_sektor_id | integer | optional | GET | Filter by sub sektor. |
| sort | string | optional | GET | Sort column: kode, nama, jenis, sub_sektor, sektor, gas_grk, tipe_hasil. Default kode. |
| dir | string | optional | GET | asc or desc. Default asc. |
Examples
-
GET catalog
GET /public/aksi_mitigasi.php -
GET by sub sektor
GET /public/aksi_mitigasi.php?sub_sektor_id=14 -
GET detail
GET /public/aksi_mitigasi.php?id=3
Example Response
{
"status": "success",
"total": 1,
"data": [
{
"id": 3,
"kode": "FOLU-1",
"nama": "Pencegahan Deforestasi",
"jenis": "ndc",
"jenis_label": "NDC",
"sub_sektor_id": 14,
"sub_sektor_nama": "Sub Sektor Kehutanan",
"sektor_id": 5,
"sektor_nama": "Kehutanan dan Lahan",
"gas_grk": "CO2",
"tipe_hasil": "kurangi_emisi",
"tipe_hasil_label": "Kurangi emisi"
}
]
}
Public API (8011)
NDC Matrix (Nasional)
Emission scenario matrix for national-level data. Returns pivoted data grouped by scenario and sector across all available years.
URL
http://localhost:8011/public/ndc_matrix.php
Query Parameters
| Name | Type | Required | Used in | Description |
|---|---|---|---|---|
| sektor_id | integer | optional | GET | Filter results to a single sector. |
Examples
-
GET all sectors
GET /public/ndc_matrix.php -
GET one sector
GET /public/ndc_matrix.php?sektor_id=1
Example Response
{
"status": "success",
"years": [2010, 2026, 2027, 2028, 2029, 2030],
"unit": "000 tCO2e",
"sektor_id": null,
"data": [
{
"scenario_id": 1,
"scenario_kode": "BAU",
"scenario_nama": "Business as Usual",
"rows": [
{ "sektor_id": 1, "sektor_nama": "Energi", "values": { "2010": 123.4, "2026": 200.1 } }
],
"total": { "2010": 123.4, "2026": 200.1 }
}
]
}
Public API (8011)
Emisi GRK Nasional (Inventori)
Historical greenhouse gas (GRK) emission inventory at national level, broken down by sector.
URL
http://localhost:8011/public/emisi_grk_nasional.php
Query Parameters
| Name | Type | Required | Used in | Description |
|---|---|---|---|---|
| years | string | optional | GET | Comma-separated list of years to include. E.g. 2010,2011,2012. Returns all years if omitted. |
Examples
-
GET all years
GET /public/emisi_grk_nasional.php -
GET specific years
GET /public/emisi_grk_nasional.php?years=2010,2020,2024
Example Response
{
"status": "success",
"years": [2010, 2011, 2012],
"unit": "kt CO2e",
"sectors": [
{ "sektor_id": 1, "sektor_nama": "Energi", "values": { "2010": 456.7, "2011": 478.2, "2012": 490.0 } }
]
}
Public API (8011)
Emisi GRK Sub Nasional (Inventori)
Provincial GRK emission inventory by sector and year (ndc_subnas_emisi_grk).
URL
http://localhost:8011/public/emisi_grk_subnasional.php
Query Parameters
| Name | Type | Required | Used in | Description |
|---|---|---|---|---|
| provinsi_id | integer | required | GET | Province ID from sub_nasional. Required. |
| sektor_id | integer | optional | GET | Optional filter to one sector. |
| years | string | optional | GET | Comma-separated years to include. |
Examples
-
GET province
GET /public/emisi_grk_subnasional.php?provinsi_id=1 -
GET province+sector
GET /public/emisi_grk_subnasional.php?provinsi_id=1&sektor_id=2 -
GET years filter
GET /public/emisi_grk_subnasional.php?provinsi_id=1&years=2010,2020
Example Response
{
"status": "success",
"provinsi_id": 1,
"provinsi": "Aceh",
"years": [2010, 2011],
"unit": "kt CO2e",
"sektor_id": null,
"sectors": [
{ "sektor_id": 1, "sektor_nama": "Energi", "values": { "2010": 12.3, "2011": 13.1 } }
]
}
Public API (8011)
NDC Matrix (Sub Nasional)
Emission scenario matrix filtered to a specific province. Returns BAU and CM1 scenarios only.
URL
http://localhost:8011/public/subnas_matrix.php
Query Parameters
| Name | Type | Required | Used in | Description |
|---|---|---|---|---|
| provinsi_id | integer | required | GET | Province ID (from sub_nasional). REQUIRED. |
| sektor_id | integer | optional | GET | Optional filter to a single sector. |
Examples
-
GET province data
GET /public/subnas_matrix.php?provinsi_id=1 -
GET province + sector data
GET /public/subnas_matrix.php?provinsi_id=1&sektor_id=2
Example Response
{
"status": "success",
"provinsi_id": 1,
"provinsi": "DKI Jakarta",
"years": [2010, 2026, 2027, 2028, 2029, 2030],
"unit": "000 tCO2e",
"sektor_id": null,
"data": [
{
"scenario_id": 1,
"scenario_kode": "BAU",
"scenario_nama": "Business as Usual",
"rows": [
{ "sektor_id": 1, "sektor_nama": "Energi", "values": { "2010": 50.1, "2026": 80.3 } }
],
"total": { "2010": 50.1, "2026": 80.3 }
}
]
}
Public API (8011)
Kontak Kami
Submit a contact message from the public website. Stores submission with optional GeoIP metadata.
URL
http://localhost:8011/public/kontak_kami.php
Request Body (JSON)
| Field | Description |
|---|---|
| nama_lengkap | (string, required) Full name, 2–150 characters. Alias field: nama. |
| (string, required) Valid email, max 150 characters. | |
| subjek | (string, required) Subject, max 255 characters. |
| pesan | (string, required) Message, min 10 characters. |
Examples
-
POST message
POST /public/kontak_kami.php { "nama_lengkap": "Ada", "email": "ada@example.com", "subjek": "Info", "pesan": "Pesan contoh minimal sepuluh karakter." }
Example Response
{
"status": "success",
"message": "Pesan berhasil dikirim."
}
Tracking API (8015)
Capaian Aksi Mitigasi
Registered mitigation actions (aksi) with target/capaian pengurangan emisi from data aktivitas for a selected reference year. Powers the public /capaian page (via Nuxt proxy /api/capaian).
URL
http://localhost:8015/index.php/api/public/capaian
Query Parameters
| Name | Type | Required | Used in | Description |
|---|---|---|---|---|
| tahun | integer | optional | GET | Reference year (tahun table, active). Defaults to newest active year if omitted or invalid. |
| kategori | string | optional | GET | all, ndc, or beyond_ndc. Default all. |
| skala | string | optional | GET | all, nasional, or sub_nasional. Default all. |
| sub_nasional_id | integer | optional | GET | When skala is sub_nasional, filter by province ID. |
| sektor_id | integer | optional | GET | Filter by sektor ID. |
| sub_sektor_id | integer | optional | GET | Filter by sub sektor ID. |
Examples
-
GET default year
GET /index.php/api/public/capaian -
GET tahun + filter
GET /index.php/api/public/capaian?tahun=2024&kategori=all&skala=all&sektor_id=5 -
Nuxt proxy
GET http://localhost:8014/api/capaian?tahun=2024 (server calls backend via NUXT_API_TRACKING_BASE)
Example Response
{
"status": "success",
"unit": "t CO₂",
"available_years": [2024, 2023],
"filters": {
"kategori": "all",
"skala": "all",
"sub_nasional_id": null,
"sektor_id": 5,
"sub_sektor_id": null,
"tahun": 2024
},
"summary": {
"count": 14,
"count_with_metrics": 2,
"target": 1310441.55,
"capaian": 122
},
"rows": [
{
"uuid": "7c855511-1443-44c0-844e-be1edf412219",
"nomor_registri": "REG-123",
"judul": "Aksi Mitigasi Kehutanan",
"kategori_aksi": "NDC",
"skala_label": "nasional",
"sektor_nama": "Kehutanan dan Lahan",
"sub_sektor_nama": "Sub Sektor Kehutanan",
"jenis_aksi_mitigasi": "FOLU-1 — Pencegahan Deforestasi",
"tahun_data": 2024,
"target": 1054207.25,
"capaian": 122,
"pct_target": 0.01
}
]
}