GET /quote_category_subgenres/index/genre_id:{id}.json
最後更新:2026-07-30
環境:Staging
進度:2 / 3
測試前設定
| 項目 | Staging 設定/確認方式 |
|---|---|
| Config key | quote_category_subgenres.existing_php8_api_key |
| Config value | 3C3A284DD02A3A6E237E7C44A56A34B4 |
| 設定位置 | Lib/Common/Configuration.php 的 ProConfig::$config |
| API key DB | 上述 key 必須存在於 Staging DB,且為可用狀態 |
| PHP 8 instances | 每台處理此 API 的 PHP 8 instance 都必須有相同設定 |
| 缺少或空值 | API 回 error999,不進入 Matching/Non-matching 分流 |
注意:
- Header
X-PRO360-Rest-Api-Key必須與 config value 完全相同,才會走 Matching key 行為。 Configuration.php已被.gitignore忽略;本地修改不會隨一般 commit/push 部署,Staging 與 Production 必須各自同步。- Production 不直接假設使用 Staging 值;上線前需以 Production ALB 的 matching key 與 Production DB 有效 key 為準,並同步所有 Production PHP 8 instances。
Caller 判斷
web-app現行程式與 Git 歷史都沒有呼叫/quote_category_subgenres/index/genre_id:{id}.json。web-app/modules/utils/api-manager.js:1455-1462的getSubGenres()呼叫的是/quote_category_subgenres/index.json,不是本 endpoint。web-app/modules/utils/api-manager.js:1435-1444雖有genre_id:{id},但資源是/quote_categories/index/...,不是quote_category_subgenres。- 依 Production API key 對應資料判斷,Matching key caller 為
ios_consumer 3.3.0。 - 因此本 endpoint 沒有可可靠觸發的
web-app畫面;上線 smoke test 使用下方 raw curl,或由對應 iOS client 驗證。
核心測試
| # | 案例 | 預期 | 狀態 |
|---|---|---|---|
| 1 | Matching key+有效 genre | 完整 PHP 8 object,包含 is_skip_pro_search | 已通過 |
| 2 | Non-matching key+有效 genre | Legacy-compatible array;沒有完整 tree 與 is_skip_pro_search | 已通過,命中 php82-staging-1 |
| 3 | Non-matching key+不存在的 genre | HTTP 200、text/html、body Not Found | 待測 |
Raw curl
1. Matching key+有效 genre
curl -i \
-H 'X-PRO360-Rest-Api-Key: 3C3A284DD02A3A6E237E7C44A56A34B4' \
'https://api-staging.pro360.com.tw/quote_category_subgenres/index/genre_id:1.json'預期:HTTP 200;完整 PHP 8 object,包含 is_skip_pro_search。
2. Non-matching key+有效 genre
curl -i \
-H 'X-PRO360-Rest-Api-Key: 34F4249749CDF7F8E295F535BC37C3B5' \
'https://api-staging.pro360.com.tw/quote_category_subgenres/index/genre_id:1.json'預期:HTTP 200;Legacy-compatible array,不包含完整 tree 與 is_skip_pro_search。
3. Non-matching key+不存在的 genre
curl -i \
-H 'X-PRO360-Rest-Api-Key: 34F4249749CDF7F8E295F535BC37C3B5' \
'https://api-staging.pro360.com.tw/quote_category_subgenres/index/genre_id:999999.json'預期:HTTP 200、text/html,body 為 Not Found。
完成條件
三個案例全部符合預期,即完成本 endpoint 的核心上線 smoke test。
missing key、slash path、genre_id:0 等案例由 PHPUnit 覆蓋,不列入這份核心 smoke test。