บัญชี — อุปกรณ์เซสชัน
หน้า Account → Devices แสดง session เบราว์เซอร์ที่ผูกกับ user ที่ลงชื่อเข้าใช้ Integrator เรียก upstream เดียวกันด้วย access_token ของ user และ action list, register, rename, หรือ disable
ใช้ registration domain ใน form body — ไม่ใช่ hostname ของ API
Playground & Profile
Playground — Home feed → แพลตฟอร์ม → อุปกรณ์เซสชัน เมื่อรัน npm run docs:stack Profile → Account แสดงรายการสั้นเมื่อลงชื่อเข้าใช้แล้ว (list / disable — ไม่มี rename ใน UI)
Upstream API
POST https://api.gommo.net/api/v2/devices
Content-Type: application/x-www-form-urlencoded
| Field | จำเป็น | หมายเหตุ |
|---|---|---|
access_token | ใช่ | โทเคน session ของ user |
domain | ใช่ | Registration domain |
action | ใช่ | register | list | rename | disable |
device_id | ตาม action | UUID session — เป้า rename/disable (ไม่ใช่ id_base) |
device_name | rename | ชื่อใหม่ของแถวเป้าหมาย |
device_info | ไม่บังคับ | สตริง JSON (metadata เบราว์เซอร์) |
current_device_id | list/register | session id ของเบราว์เซอร์นี้ (dealer ส่งตอน list) |
language | ไม่บังคับ | เช่น EN, TH |
PowerShell (list — แทน domain; ใช้ token จริงเฉพาะใน session ที่ปลอดภัย):
$domain = $env:GOMMO_API_DOMAIN
if (-not $domain) { throw 'Set GOMMO_API_DOMAIN to your registration domain' }
$h = @{ 'Content-Type' = 'application/x-www-form-urlencoded' }
$body = "access_token=$env:TOKEN&domain=$domain&action=list&language=TH¤t_device_id=$env:DEVICE_ID&device_id=$env:DEVICE_ID&device_name=Browser%201"
Invoke-RestMethod -Method Post -Uri 'https://api.gommo.net/api/v2/devices' -Headers $h -Body $bodycurl.exe (list):
curl.exe -X POST "https://api.gommo.net/api/v2/devices" ^
-H "Content-Type: application/x-www-form-urlencoded" ^
--data-urlencode "access_token=%TOKEN%" ^
--data-urlencode "domain=%REGISTRATION_DOMAIN%" ^
--data-urlencode "action=list" ^
--data-urlencode "language=TH" ^
--data-urlencode "current_device_id=%DEVICE_ID%" ^
--data-urlencode "device_id=%DEVICE_ID%" ^
--data-urlencode "device_name=Browser 1"Response list
ตัวอย่าง success:
{
"success": true,
"message": "OK",
"data": {
"items": [
{
"id_base": "03883f3e0cbb4aaa",
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"device_name": "Browser 1",
"status": "active",
"is_current": true,
"browser_name": "Chrome",
"os_name": "Windows",
"last_seen_at": 1789442037
}
],
"current_device_id": "550e8400-e29b-41d4-a716-446655440000"
}
}Response mutation
register, rename, disable มักคืน { success, data: { …แถว device เดียว… } }
กฎ UI (แท็บ Devices ของ dealer)
| สถานะแถว | ป้าย | การกระทำ |
|---|---|---|
is_current | Current | Rename เท่านั้น |
status === 'active' และไม่ใช่ current | Inactive | Rename, Disable |
status === 'disabled' | Disabled | ไม่มีปุ่ม Disable |
Disable และ rename ใช้ field form device_id (UUID จาก list) ไม่ใช่ id_base
Mode B (gateway ทางเลือก)
POST {gateway}/gateway/devices — ต้องมี Bearer; JSON body:
{
"action": "list",
"language": "TH",
"current_device_id": "550e8400-e29b-41d4-a716-446655440000",
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"device_name": "Browser 1",
"device_info": "{\"device_type\":\"desktop\"}"
}สำหรับ rename / disable ตั้ง "action" และ "device_id" เป็น UUID session เป้าหมาย Gateway เติม access_token และ domain จาก Bearer + tenant ถ้า client ไม่ส่ง device_* gateway อาจเติมค่า default จากเซิร์ฟเวอร์; Playground ส่ง device fields จากเบราว์เซอร์
- JSON upstream ถูกต้อง → pass-through (
{ success, message?, data }) - validation error → gateway JSON
{ success: false, message, … }พร้อม HTTP 4xx
OpenAPI: openapi.yaml — /gateway/devices
SDK: @ai-gateway/client — auth.listDevices(), auth.registerDevice(), auth.renameDevice(), auth.disableDevice() ดู SDK authentication
→ ตั๋วซัพพอร์ต · โปรแกรมพาร์ทเนอร์ · Creator Rewards · เปลี่ยนรหัสผ่าน · โอน credit · ประวัติธุรกรรม · Endpoint map · Deploy → Self-host (advanced)
