跳转到内容
Local API代理管理

创建代理 ​

版本概览
POST
/api/v1/proxies

创建 custom 或 api 代理并返回创建后的完整详情。API 代理需提供 auth_type(缺省为 whitelist);选择 credential 时 username、password 均必填。Local API 会在本机解析当前 IP 和端口;integ、syt 不能通过该接口创建。用户名、密码和提取地址属于敏感字段,不应写入调用方日志。

请求参数

Authorization Bearer Token

在请求头 Authorization 中使用 Bearer Token 传入 API Key。

Authorization: Bearer <api-key>

Body 参数

必填application/jsonProxyCreateRequest
字段说明
object
示例

根据数据模型生成,非实际请求结果。

{
  "name": "string",
  "mode": "custom",
  "config": {
    "host": "string",
    "port": 0
  }
}

请求示例代码

JavaScript / TypeScript 使用 Node.js 18+ 内置 fetch;PHP 需启用 cURL 扩展;Go 需 1.16+;Java 需 JDK 11+。运行前请替换 Token 和示例参数值。

curl -X POST -H 'Authorization: Bearer <TOKEN>' -H 'Content-Type: application/json' -d '{
  "name": "string",
  "mode": "custom",
  "config": {
    "host": "string",
    "port": 0
  }
}' 'http://local.zhongyibrowser.com:39025/api/v1/proxies'

返回响应

成功时 code = 0,失败时 code > 0。选择状态码查看对应字段和示例,展开对象可查看嵌套字段;可选字段可能不返回。

创建后的代理详情

Body

application/jsonProxyDetailSuccessResponse
字段说明
number必填
业务状态码;成功固定为 0
枚举值
string必填
业务状态信息;成功固定为 success
枚举值
object必填
接口业务数据
示例

根据数据模型生成,非实际请求结果。

{
  "code": 0,
  "message": "success",
  "data": {
    "id": "string",
    "name": "string",
    "remark": "string",
    "status": "unchecked",
    "checked_at": "2024-01-15T09:30:00Z",
    "browser_count": 0,
    "is_expired": true,
    "created_at": "2024-01-15T09:30:00Z",
    "updated_at": "2024-01-15T09:30:00Z",
    "mode": "custom",
    "config": {
      "protocol": "http",
      "ip_protocol": "ipv4",
      "host": "string",
      "port": 0,
      "username": "string",
      "password": "string"
    },
    "browser_ids": [
      "env_01JABCDEF1234567890"
    ]
  }
}

查看全部业务错误码与 HTTP 状态码

中屹浏览器 Local API 文档