Thông tin setting-service (Dịch vụ cài đặt của người dùng)
Mục đích: dùng neon api database postgres để người dùng có thể GET và POST (key, value) cài đặt một số thông tin.
Trong giao diện web của Neon có thông tin URL ví dụ https://ep-cool-snow-a1l0bwdn.apirest.ap-southeast-1.aws.neon.tech/neondb/rest/v1
Thêm mới hoặc cập nhật thông tin cài đặt của người dùng
REQUEST:
curl -X POST "https://ep-cool-snow-a1l0bwdn.apirest.ap-southeast-1.aws.neon.tech/neondb/rest/v1/settings?on_conflict=user_id, key" \ -H "Authorization: Bearer ..." \ -H "Content-Type: application/json" \ -H "Prefer: resolution=merge-duplicates" \ -d '[ {"key": "language", "value": "vi"}, {"key": "notifications", "value": "true"} ]'
RESPONSE:
[ { "id": 1, "user_id": "54b49784-e5ab-4ad4-bcce-5a915d09d67c", "key": "language", "value": "vi", "updated_at": "2026-04-12T07:56:31.675172+00:00" }, { "id": 2, "user_id": "54b49784-e5ab-4ad4-bcce-5a915d09d67c", "key": "notifications", "value": "true", "updated_at": "2026-04-12T07:56:31.675172+00:00" } ]
Lấy thông tin cài đặt của người dùng
REQUEST:
curl --location 'https://ep-cool-snow-a1l0bwdn.apirest.ap-southeast-1.aws.neon.tech/neondb/rest/v1/settings' \ --header 'Authorization: Bearer ...'
RESPONSE:
[ { "id": 1, "user_id": "54b49784-e5ab-4ad4-bcce-5a915d09d67c", "key": "language", "value": "vi", "updated_at": "2026-04-12T07:56:31.675172+00:00" }, { "id": 2, "user_id": "54b49784-e5ab-4ad4-bcce-5a915d09d67c", "key": "notifications", "value": "true", "updated_at": "2026-04-12T07:56:31.675172+00:00" } ]