GET /quote_category_subgenres/index/genre_id:{id}.json

最後更新:2026-07-30
環境:Staging
進度:2 / 3

測試前設定

項目Staging 設定/確認方式
Config keyquote_category_subgenres.existing_php8_api_key
Config value3C3A284DD02A3A6E237E7C44A56A34B4
設定位置Lib/Common/Configuration.phpProConfig::$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-1462getSubGenres() 呼叫的是 /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 驗證。

核心測試

#案例預期狀態
1Matching key+有效 genre完整 PHP 8 object,包含 is_skip_pro_search已通過
2Non-matching key+有效 genreLegacy-compatible array;沒有完整 tree 與 is_skip_pro_search已通過,命中 php82-staging-1
3Non-matching key+不存在的 genreHTTP 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。