# Format Response Standar Semua response API geonet-console menggunakan format JSON konsisten. --- ## Response Sukses — Single Resource ```json { "data": { "id": "uuid", "field": "value" } } ``` ## Response Sukses — Collection ```json { "data": [ { "id": "uuid-1", "field": "value" }, { "id": "uuid-2", "field": "value" } ] } ``` ## Response Sukses — Action (revoke, delete, dll.) ```json { "message": "Operasi berhasil." } ``` ## Response Sukses — Create (dengan token sekali tampil) ```json { "data": { "id": "uuid", "token": "plain_token_hanya_tampil_sekali", "token_prefix": "Col5FUFl34dVXgyB" }, "message": "Token created. Save it now — it will not be shown again." } ``` --- ## Response Error ```json { "error": { "code": "ERROR_CODE", "message": "Deskripsi error yang dapat dibaca manusia." } } ``` ## Response Error — Validation ```json { "message": "The given data was invalid.", "errors": { "name": ["The name field is required."], "service": ["The service field is required."] } } ``` --- ## HTTP Status Codes | Code | Kondisi | |------|---------| | `200` | OK — request berhasil | | `201` | Created — resource baru dibuat | | `204` | No Content — delete berhasil | | `400` | Bad Request — request tidak valid | | `401` | Unauthorized — tidak ada / token invalid | | `403` | Forbidden — token valid tapi tidak punya akses | | `404` | Not Found — resource tidak ditemukan | | `422` | Unprocessable Entity — validasi gagal | | `429` | Too Many Requests — rate limit | | `500` | Internal Server Error — error server |