1.8 KiB
API — Service Tokens
Base URL:
https://console.gisportal.id/api/v1Auth:Authorization: Bearer <token>
Service Token adalah token antar-service (bukan user token). Contoh: GeoNetAgent Collector menggunakan service token untuk POST laporan.
GET /service-tokens
List semua service tokens.
Response 200:
{
"data": [
{
"id": "uuid",
"name": "GeoNetAgent Production",
"service": "geonetagent",
"abilities": ["agent:report"],
"expires_at": "2027-06-29T00:00:00+07:00",
"last_used_at": "2026-06-29T09:00:00+07:00",
"revoked_at": null
}
]
}
POST /service-tokens
Buat service token baru.
Request:
{
"name": "GeoNetAgent Production",
"service": "geonetagent",
"abilities": ["agent:report"],
"expires_at": "2027-06-29"
}
Response 201: Token value hanya ditampilkan sekali saat create.
{
"id": "uuid",
"token": "plain-text-token-nilai-ini-simpan-sekarang",
"name": "GeoNetAgent Production"
}
POST /service-tokens/{id}/revoke
Revoke token (non-destructive, bisa di-unrevoce).
POST /service-tokens/{id}/regenerate
Generate token baru, token lama invalid.
DELETE /service-tokens/{id}
Hapus token permanen.
GET /service-tokens/active
Semua token aktif (tidak expired, tidak di-revoke).
GET /service-tokens/expired
Semua token yang sudah expired.
GET /service-tokens/by-service/{service}
Token berdasarkan nama service.
Contoh: GET /service-tokens/by-service/geonetagent
Sync ke GeoNetAgent DB
Token yang dibuat di geonet-console di-sync otomatis ke tabel agent_tokens di geonetagent_dev PostgreSQL via AgentTokenSyncService. GeoNetAgent Collector bisa validasi token dari DB-nya sendiri.