跳转到内容

获取浏览器 UA

Request

生成与请求的操作系统和浏览器类型匹配的 User-Agent。

  • 前置条件:Firefox 只能配 Windows 或 macOS,且 osVersion 必须是受支持的版本之一。
  • 副作用:无,但结果不是确定性的——同样的请求每次返回不同的 User-Agent。不要把它当缓存键。
  • 完成信号:同步。可安全重试。
Bodyapplication/jsonrequired
osintegerrequired

操作系统类型:

1 = Windows,2 = macOS,3 = Android,4 = iOS

Enum:1234
Example:1
osVersionstring

操作系统版本(例如,“Windows 11”、“macOS 14”)。

Example:"Windows 11"
vendorinteger

浏览器类型:

1 = Chrome,2 = Firefox

Enum:12
Example:1
curl -i -X POST \
  http://127.0.0.1:40000/api/env/advanced/ua/get \
  -H 'Content-Type: application/json' \
  -d '{
    "os": 1,
    "osVersion": "Windows 11",
    "vendor": 1
  }'

Responses

成功。该接口的 data 恒为 null,结果由 code 表达。

Headers
any
Bodyapplication/json
codeinteger
msgstring or null
datanull
resolutionobjectrequired
uastringrequired
requestIdstring
errorobject
Response
{ "code": 0, "msg": null, "data": null, "resolution": { "id": "1673823102599682", "value": "string" }, "ua": "string", "requestId": "0d8b6f1c-9f4e-4d02-9d1a-7c3f5a1b2c3d", "error": {} }