接口状态
检查本机接口是否在监听,以及客户端是否已登录。此接口不校验 API Key。
GET /api/v1/status
请求参数
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| ok | boolean | 进程已在监听时为 true |
| port | number | 实际监听端口 |
| loggedIn | boolean | 客户端当前是否已登录 |
| authRequired | boolean | 是否开启了安全校验 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"ok": true,
"port": 52702,
"loggedIn": true,
"authRequired": false
}
}
请求示例
curl -X GET 'http://127.0.0.1:52702/api/v1/status' \
-H 'X-API-Key: YOUR_API_KEY'
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/status", nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/status"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/status"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder.GET().build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/status");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/status", {
method: "GET",
headers: {
'X-API-Key': "YOUR_API_KEY",
},
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/status");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
"X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/status' \
-H 'X-API-Key: YOUR_API_KEY'
启动浏览器
按环境配置在本机拉起浏览器。未安装对应内核时会失败,需先调用下载内核。
POST /api/v1/browser/start
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| profileId | Body | string | 是 | 环境 ID |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| profileId | string | 环境 ID |
| pid | number | 浏览器进程 PID |
| debugPort | number | CDP / Marionette 调试端口 |
| webSocketDebuggerUrl | string | null | 浏览器级 WebSocket 调试地址,Firefox 可能为空 |
| statusSynced | boolean | 是否已把运行状态同步到云端 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"profileId": "cmxxxxxxxx",
"pid": 12345,
"debugPort": 9222,
"webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/browser/xxxx",
"statusSynced": true
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/browser/start' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "profileId": "cmxxxxxxxx"}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"profileId\": \"cmxxxxxxxx\"}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/browser/start", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/browser/start"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"profileId":"cmxxxxxxxx"}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/browser/start"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"profileId\": \"cmxxxxxxxx\"}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/start");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"profileId\": \"cmxxxxxxxx\"}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/browser/start", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"profileId":"cmxxxxxxxx"}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/start");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"profileId\": \"cmxxxxxxxx\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/browser/start' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "profileId": "cmxxxxxxxx"}'
关闭浏览器
关闭指定环境的浏览器进程,并把云端状态改为未打开。
POST /api/v1/browser/stop
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| profileId | Body | string | 是 | 环境 ID |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| profileId | string | 环境 ID |
| stopped | boolean | 本次是否关闭了一个正在运行的进程 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"profileId": "cmxxxxxxxx",
"stopped": true
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/browser/stop' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "profileId": "cmxxxxxxxx"}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"profileId\": \"cmxxxxxxxx\"}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/browser/stop", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/browser/stop"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"profileId":"cmxxxxxxxx"}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/browser/stop"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"profileId\": \"cmxxxxxxxx\"}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/stop");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"profileId\": \"cmxxxxxxxx\"}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/browser/stop", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"profileId":"cmxxxxxxxx"}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/stop");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"profileId\": \"cmxxxxxxxx\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/browser/stop' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "profileId": "cmxxxxxxxx"}'
浏览器状态
查询某个环境当前是否已在本机打开,以及调试端口。
GET /api/v1/browser/status
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| profileId | Query | string | 是 | 环境 ID |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| profileId | string | 环境 ID |
| opened | boolean | 是否已打开 |
| pid | number | null | 进程 PID,未打开时为 null |
| debugPort | number | null | 调试端口 |
| webSocketDebuggerUrl | string | null | WebSocket 调试地址 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"profileId": "cmxxxxxxxx",
"opened": true,
"pid": 12345,
"debugPort": 9222,
"webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/browser/xxxx"
}
}
请求示例
curl -X GET 'http://127.0.0.1:52702/api/v1/browser/status?profileId=cmxxxxxxxx' \
-H 'X-API-Key: YOUR_API_KEY'
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/browser/status?profileId=cmxxxxxxxx", nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/browser/status?profileId=cmxxxxxxxx"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/browser/status?profileId=cmxxxxxxxx"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder.GET().build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/status?profileId=cmxxxxxxxx");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/browser/status?profileId=cmxxxxxxxx", {
method: "GET",
headers: {
'X-API-Key': "YOUR_API_KEY",
},
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/status?profileId=cmxxxxxxxx");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
"X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/browser/status?profileId=cmxxxxxxxx' \
-H 'X-API-Key: YOUR_API_KEY'
环境已被打开
环境已在本机打开时返回成功;未打开时 code 非 0,msg 为「环境未被打开」。
GET /api/v1/browser/opened
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| profileId | Query | string | 是 | 环境 ID |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| profileId | string | 环境 ID |
| debugPort | number | 调试端口 |
| pid | number | 进程 PID |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"profileId": "cmxxxxxxxx",
"debugPort": 9222,
"pid": 12345
}
}
请求示例
curl -X GET 'http://127.0.0.1:52702/api/v1/browser/opened?profileId=cmxxxxxxxx' \
-H 'X-API-Key: YOUR_API_KEY'
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/browser/opened?profileId=cmxxxxxxxx", nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/browser/opened?profileId=cmxxxxxxxx"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/browser/opened?profileId=cmxxxxxxxx"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder.GET().build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/opened?profileId=cmxxxxxxxx");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/browser/opened?profileId=cmxxxxxxxx", {
method: "GET",
headers: {
'X-API-Key': "YOUR_API_KEY",
},
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/opened?profileId=cmxxxxxxxx");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
"X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/browser/opened?profileId=cmxxxxxxxx' \
-H 'X-API-Key: YOUR_API_KEY'
环境未被打开
环境未打开时返回成功;已经打开时 code 非 0,msg 为「环境已被打开」。
GET /api/v1/browser/closed
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| profileId | Query | string | 是 | 环境 ID |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| profileId | string | 环境 ID |
| opened | boolean | 固定为 false |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"profileId": "cmxxxxxxxx",
"opened": false
}
}
请求示例
curl -X GET 'http://127.0.0.1:52702/api/v1/browser/closed?profileId=cmxxxxxxxx' \
-H 'X-API-Key: YOUR_API_KEY'
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/browser/closed?profileId=cmxxxxxxxx", nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/browser/closed?profileId=cmxxxxxxxx"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/browser/closed?profileId=cmxxxxxxxx"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder.GET().build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/closed?profileId=cmxxxxxxxx");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/browser/closed?profileId=cmxxxxxxxx", {
method: "GET",
headers: {
'X-API-Key': "YOUR_API_KEY",
},
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/closed?profileId=cmxxxxxxxx");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
"X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/browser/closed?profileId=cmxxxxxxxx' \
-H 'X-API-Key: YOUR_API_KEY'
查询已启动浏览器
列出当前这台电脑上已启动的全部环境。
GET /api/v1/browser/started
请求参数
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| list | array | 已启动环境 |
| list[].profileId | string | 环境 ID |
| list[].pid | number | 进程 PID |
| list[].debugPort | number | 调试端口 |
| list[].webSocketDebuggerUrl | string | null | WebSocket 调试地址 |
| list[].startedAt | number | 启动时间戳(毫秒) |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"list": [
{
"profileId": "cmxxxxxxxx",
"pid": 12345,
"debugPort": 9222,
"webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/browser/xxxx",
"startedAt": 1710000000000
}
]
}
}
请求示例
curl -X GET 'http://127.0.0.1:52702/api/v1/browser/started' \
-H 'X-API-Key: YOUR_API_KEY'
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/browser/started", nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/browser/started"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/browser/started"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder.GET().build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/started");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/browser/started", {
method: "GET",
headers: {
'X-API-Key': "YOUR_API_KEY",
},
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/started");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
"X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/browser/started' \
-H 'X-API-Key: YOUR_API_KEY'
查询环境
分页查询当前账号可见的浏览器环境。
GET /api/v1/profiles
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| page | Query | number | 否 | 页码,从 1 开始 |
| pageSize | Query | number | 否 | 每页条数,1–500,默认 50 |
| keyword | Query | string | 否 | 按名称、备注、序号搜索 |
| groupId | Query | string | 否 | 分组 ID |
| status | Query | string | 否 | idle 或 running |
| kernelBrand | Query | string | 否 | chrome 或 firefox |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| list | array | 环境列表,字段见下 |
| list[].id | string | 环境 ID |
| list[].serial | number | 环境序号 |
| list[].shortId | string | 短 ID,缓存目录与启动页使用 |
| list[].name | string | 环境名称 |
| list[].groupId | string | null | 分组 ID,未分组为 null |
| list[].groupName | string | null | 分组名称 |
| list[].tags | string[] | 标签名 |
| list[].status | string | idle 未打开,running 运行中 |
| list[].kernelBrand | string | 内核品牌:chrome / firefox |
| list[].kernelVersion | number | null | 内核主版本,null 表示智能匹配 |
| list[].cacheDirName | string | 本地缓存目录名 |
| total | number | 符合条件的总数 |
| page | number | 当前页 |
| pageSize | number | 每页条数 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"list": [
{
"id": "cmxxxxxxxx",
"serial": 1,
"shortId": "kabcd123",
"name": "店铺A",
"groupId": null,
"groupName": null,
"tags": [
"常用"
],
"status": "idle",
"kernelBrand": "chrome",
"kernelVersion": 120,
"cacheDirName": "kabcd123_tenant"
}
],
"total": 1,
"page": 1,
"pageSize": 20
}
}
请求示例
curl -X GET 'http://127.0.0.1:52702/api/v1/profiles?page=1&pageSize=20' \
-H 'X-API-Key: YOUR_API_KEY'
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/profiles?page=1&pageSize=20", nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/profiles?page=1&pageSize=20"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/profiles?page=1&pageSize=20"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder.GET().build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles?page=1&pageSize=20");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/profiles?page=1&pageSize=20", {
method: "GET",
headers: {
'X-API-Key': "YOUR_API_KEY",
},
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles?page=1&pageSize=20");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
"X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/profiles?page=1&pageSize=20' \
-H 'X-API-Key: YOUR_API_KEY'
新建浏览器
新建一个或多个环境。未传指纹时按内核与操作系统自动生成。
POST /api/v1/profiles
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| name | Body | string | 否 | 环境名称 |
| groupId | Body | string | null | 否 | 分组 ID |
| tags | Body | string[] | 否 | 标签名,不存在的会自动写入标签字典 |
| remark | Body | string | 否 | 备注 |
| kernelBrand | Body | string | 否 | chrome 或 firefox,默认 chrome |
| kernelVersion | Body | number | null | 否 | 内核主版本,null 为智能匹配 |
| fingerprint | Body | object | 否 | 指纹补丁,可只传需要覆盖的字段,例如 os |
| proxy | Body | object | 否 | 代理。type 可为 http / https / socks5 / ssh,host、port、username、password |
| cookies | Body | string | 否 | Cookie,JSON 数组或 Netscape 文本 |
| startUrls | Body | string[] | 否 | 启动时打开的网址 |
| count | Body | number | 否 | 一次创建的数量,1–100,默认 1 |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| id | string | 新建环境 ID。count>1 时 data 为环境数组 |
| name | string | 名称 |
| serial | number | 序号 |
| kernelBrand | string | 内核品牌 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"id": "cmxxxxxxxx",
"name": "店铺A",
"serial": 12,
"kernelBrand": "chrome"
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "name": "店铺A", "kernelBrand": "chrome", "kernelVersion": 120, "fingerprint": { "os": "Windows" }, "proxy": { "type": "http", "host": "127.0.0.1", "port": 7890 }, "count": 1}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"name\": \"店铺A\", \"kernelBrand\": \"chrome\", \"kernelVersion\": 120, \"fingerprint\": { \"os\": \"Windows\" }, \"proxy\": { \"type\": \"http\", \"host\": \"127.0.0.1\", \"port\": 7890 }, \"count\": 1}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/profiles", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/profiles"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"name":"店铺A","kernelBrand":"chrome","kernelVersion":120,"fingerprint":{"os":"Windows"},"proxy":{"type":"http","host":"127.0.0.1","port":7890},"count":1}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/profiles"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"name\": \"店铺A\", \"kernelBrand\": \"chrome\", \"kernelVersion\": 120, \"fingerprint\": { \"os\": \"Windows\" }, \"proxy\": { \"type\": \"http\", \"host\": \"127.0.0.1\", \"port\": 7890 }, \"count\": 1}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"name\": \"店铺A\", \"kernelBrand\": \"chrome\", \"kernelVersion\": 120, \"fingerprint\": { \"os\": \"Windows\" }, \"proxy\": { \"type\": \"http\", \"host\": \"127.0.0.1\", \"port\": 7890 }, \"count\": 1}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/profiles", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"name":"店铺A","kernelBrand":"chrome","kernelVersion":120,"fingerprint":{"os":"Windows"},"proxy":{"type":"http","host":"127.0.0.1","port":7890},"count":1}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"name\": \"店铺A\", \"kernelBrand\": \"chrome\", \"kernelVersion\": 120, \"fingerprint\": { \"os\": \"Windows\" }, \"proxy\": { \"type\": \"http\", \"host\": \"127.0.0.1\", \"port\": 7890 }, \"count\": 1}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "name": "店铺A", "kernelBrand": "chrome", "kernelVersion": 120, "fingerprint": { "os": "Windows" }, "proxy": { "type": "http", "host": "127.0.0.1", "port": 7890 }, "count": 1}'
更新环境
按环境 ID 更新名称、备注、代理、指纹、标签、Cookie、启动页等。只传需要修改的字段。
POST /api/v1/profiles/update
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| profileId | Body | string | 是 | 环境 ID |
| name | Body | string | 否 | 名称 |
| remark | Body | string | 否 | 备注 |
| groupId | Body | string | null | 否 | 分组,null 表示移出分组 |
| tags | Body | string[] | 否 | 标签,整体替换 |
| kernelBrand | Body | string | 否 | 内核品牌 |
| kernelVersion | Body | number | null | 否 | 内核主版本 |
| proxy | Body | object | 否 | 与现有代理合并 |
| fingerprint | Body | object | 否 | 与现有指纹合并 |
| cookies | Body | string | 否 | Cookie |
| startUrls | Body | string[] | 否 | 启动网址 |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| id | string | 环境 ID |
| name | string | 更新后的名称 |
| updatedAt | string | 更新时间 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"id": "cmxxxxxxxx",
"name": "店铺A-已改",
"updatedAt": "2026-09-22T08:00:00.000Z"
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/update' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "profileId": "cmxxxxxxxx", "name": "店铺A-已改", "remark": "备注"}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"profileId\": \"cmxxxxxxxx\", \"name\": \"店铺A-已改\", \"remark\": \"备注\"}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/profiles/update", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/profiles/update"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"profileId":"cmxxxxxxxx","name":"店铺A-已改","remark":"备注"}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/profiles/update"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"profileId\": \"cmxxxxxxxx\", \"name\": \"店铺A-已改\", \"remark\": \"备注\"}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/update");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"profileId\": \"cmxxxxxxxx\", \"name\": \"店铺A-已改\", \"remark\": \"备注\"}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/profiles/update", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"profileId":"cmxxxxxxxx","name":"店铺A-已改","remark":"备注"}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/update");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"profileId\": \"cmxxxxxxxx\", \"name\": \"店铺A-已改\", \"remark\": \"备注\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/update' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "profileId": "cmxxxxxxxx", "name": "店铺A-已改", "remark": "备注"}'
删除环境
把环境移入回收站。若账号开启了删除环境的双重验证,需要额外带验证码。
POST /api/v1/profiles/delete
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| profileIds | Body | string[] | 是 | 环境 ID 列表 |
| channel | Body | string | 否 | 双重验证通道:email 或 sms,按需 |
| sensitiveCode | Body | string | 否 | 邮箱或短信验证码,按需 |
| twoFactorCode | Body | string | 否 | 身份验证器动态码,按需 |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"count": 1
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/delete' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "profileIds": [ "cmxxxxxxxx" ]}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"profileIds\": [ \"cmxxxxxxxx\" ]}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/profiles/delete", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/profiles/delete"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"profileIds":["cmxxxxxxxx"]}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/profiles/delete"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"profileIds\": [ \"cmxxxxxxxx\" ]}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/delete");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"profileIds\": [ \"cmxxxxxxxx\" ]}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/profiles/delete", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"profileIds":["cmxxxxxxxx"]}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/delete");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"profileIds\": [ \"cmxxxxxxxx\" ]}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/delete' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "profileIds": [ "cmxxxxxxxx" ]}'
移动环境
把环境移动到指定分组。groupId 传 null 表示移出分组。
POST /api/v1/profiles/move
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| profileIds | Body | string[] | 是 | 环境 ID 列表 |
| groupId | Body | string | null | 是 | 目标分组 ID,null 为未分组 |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"count": 1
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/move' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "profileIds": [ "cmxxxxxxxx" ], "groupId": "grpxxxxxxxx"}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"profileIds\": [ \"cmxxxxxxxx\" ], \"groupId\": \"grpxxxxxxxx\"}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/profiles/move", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/profiles/move"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"profileIds":["cmxxxxxxxx"],"groupId":"grpxxxxxxxx"}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/profiles/move"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"profileIds\": [ \"cmxxxxxxxx\" ], \"groupId\": \"grpxxxxxxxx\"}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/move");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"profileIds\": [ \"cmxxxxxxxx\" ], \"groupId\": \"grpxxxxxxxx\"}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/profiles/move", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"profileIds":["cmxxxxxxxx"],"groupId":"grpxxxxxxxx"}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/move");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"profileIds\": [ \"cmxxxxxxxx\" ], \"groupId\": \"grpxxxxxxxx\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/move' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "profileIds": [ "cmxxxxxxxx" ], "groupId": "grpxxxxxxxx"}'
清除缓存
删除该环境在本机的缓存目录。环境正在运行时会拒绝。
POST /api/v1/profiles/clear-cache
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| profileId | Body | string | 是 | 环境 ID |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| profileId | string | 环境 ID |
| cacheDirName | string | 被删除的缓存目录名 |
| cleared | boolean | 是否已清除 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"profileId": "cmxxxxxxxx",
"cacheDirName": "kabcd123_tenant",
"cleared": true
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/clear-cache' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "profileId": "cmxxxxxxxx"}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"profileId\": \"cmxxxxxxxx\"}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/profiles/clear-cache", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/profiles/clear-cache"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"profileId":"cmxxxxxxxx"}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/profiles/clear-cache"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"profileId\": \"cmxxxxxxxx\"}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/clear-cache");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"profileId\": \"cmxxxxxxxx\"}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/profiles/clear-cache", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"profileId":"cmxxxxxxxx"}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/clear-cache");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"profileId\": \"cmxxxxxxxx\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/clear-cache' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "profileId": "cmxxxxxxxx"}'
分享环境
把环境复制给另一个账号。跨团队时不带分组;同一团队会保留原分组。
POST /api/v1/profiles/share
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| profileId | Body | string | 是 | 环境 ID |
| username | Body | string | 是 | 对方登录用户名 |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| id | string | 对方账号下新建的环境 ID |
| name | string | 名称 |
| serial | number | 对方团队内的序号 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"id": "cmyyyyyyyy",
"name": "店铺A",
"serial": 3
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/share' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "profileId": "cmxxxxxxxx", "username": "demo"}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"profileId\": \"cmxxxxxxxx\", \"username\": \"demo\"}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/profiles/share", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/profiles/share"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"profileId":"cmxxxxxxxx","username":"demo"}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/profiles/share"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"profileId\": \"cmxxxxxxxx\", \"username\": \"demo\"}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/share");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"profileId\": \"cmxxxxxxxx\", \"username\": \"demo\"}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/profiles/share", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"profileId":"cmxxxxxxxx","username":"demo"}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/share");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"profileId\": \"cmxxxxxxxx\", \"username\": \"demo\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/share' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "profileId": "cmxxxxxxxx", "username": "demo"}'
查询环境 cookies
读取云端保存的 Cookie 文本。
GET /api/v1/profiles/cookies
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| profileId | Query | string | 是 | 环境 ID |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| profileId | string | 环境 ID |
| cookies | string | Cookie 原文,可能为空字符串 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"profileId": "cmxxxxxxxx",
"cookies": "[]"
}
}
请求示例
curl -X GET 'http://127.0.0.1:52702/api/v1/profiles/cookies?profileId=cmxxxxxxxx' \
-H 'X-API-Key: YOUR_API_KEY'
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/profiles/cookies?profileId=cmxxxxxxxx", nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/profiles/cookies?profileId=cmxxxxxxxx"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/profiles/cookies?profileId=cmxxxxxxxx"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder.GET().build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/cookies?profileId=cmxxxxxxxx");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/profiles/cookies?profileId=cmxxxxxxxx", {
method: "GET",
headers: {
'X-API-Key': "YOUR_API_KEY",
},
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/cookies?profileId=cmxxxxxxxx");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
"X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/profiles/cookies?profileId=cmxxxxxxxx' \
-H 'X-API-Key: YOUR_API_KEY'
查询环境 User-Agent
读取该环境指纹里的 User-Agent。
GET /api/v1/profiles/user-agent
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| profileId | Query | string | 是 | 环境 ID |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| profileId | string | 环境 ID |
| userAgent | string | User-Agent |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"profileId": "cmxxxxxxxx",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/120.0.0.0 Safari/537.36"
}
}
请求示例
curl -X GET 'http://127.0.0.1:52702/api/v1/profiles/user-agent?profileId=cmxxxxxxxx' \
-H 'X-API-Key: YOUR_API_KEY'
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/profiles/user-agent?profileId=cmxxxxxxxx", nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/profiles/user-agent?profileId=cmxxxxxxxx"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/profiles/user-agent?profileId=cmxxxxxxxx"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder.GET().build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/user-agent?profileId=cmxxxxxxxx");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/profiles/user-agent?profileId=cmxxxxxxxx", {
method: "GET",
headers: {
'X-API-Key': "YOUR_API_KEY",
},
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/user-agent?profileId=cmxxxxxxxx");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
"X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/profiles/user-agent?profileId=cmxxxxxxxx' \
-H 'X-API-Key: YOUR_API_KEY'
关闭所有环境
关闭本机当前账号拉起的全部浏览器,并同步云端状态。
POST /api/v1/browser/stop-all
请求参数
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| count | number | 关闭的环境数量 |
| profileIds | string[] | 被关闭的环境 ID |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"count": 1,
"profileIds": [
"cmxxxxxxxx"
]
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/browser/stop-all' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/browser/stop-all", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/browser/stop-all"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/browser/stop-all"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/stop-all");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/browser/stop-all", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/stop-all");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/browser/stop-all' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{}'
生成新指纹
按当前内核与操作系统重新生成指纹并写回该环境。
POST /api/v1/profiles/fingerprint
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| profileId | Body | string | 是 | 环境 ID |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| profileId | string | 环境 ID |
| userAgent | string | 新的 User-Agent |
| os | string | 操作系统 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"profileId": "cmxxxxxxxx",
"userAgent": "Mozilla/5.0 ...",
"os": "Windows"
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/fingerprint' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "profileId": "cmxxxxxxxx"}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"profileId\": \"cmxxxxxxxx\"}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/profiles/fingerprint", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/profiles/fingerprint"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"profileId":"cmxxxxxxxx"}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/profiles/fingerprint"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"profileId\": \"cmxxxxxxxx\"}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/fingerprint");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"profileId\": \"cmxxxxxxxx\"}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/profiles/fingerprint", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"profileId":"cmxxxxxxxx"}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/fingerprint");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"profileId\": \"cmxxxxxxxx\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/fingerprint' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "profileId": "cmxxxxxxxx"}'
内核列表
查询云端可下载的内核,并标记本机是否已安装。platform 默认跟随当前系统。
GET /api/v1/kernels
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| platform | Query | string | 否 | win32 / darwin / linux,默认当前系统 |
| arch | Query | string | 否 | 架构,默认 x64 |
| brand | Query | string | 否 | 只看某个品牌:chrome 或 firefox |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| platform | string | 查询使用的平台 |
| arch | string | 架构 |
| list | array | 按品牌分组 |
| list[].brand | string | 品牌 |
| list[].versions | array | 版本 |
| list[].versions[].majorVersion | number | 主版本 |
| list[].versions[].installed | boolean | 本机是否已安装 |
| list[].versions[].recommended | boolean | 是否推荐版本 |
| list[].versions[].fullVersion | string | 完整版本号 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"platform": "win32",
"arch": "x64",
"list": [
{
"brand": "chrome",
"versions": [
{
"majorVersion": 120,
"installed": true,
"recommended": true,
"fullVersion": "120.0.6099.71"
}
]
}
]
}
}
请求示例
curl -X GET 'http://127.0.0.1:52702/api/v1/kernels?platform=win32&arch=x64' \
-H 'X-API-Key: YOUR_API_KEY'
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/kernels?platform=win32&arch=x64", nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/kernels?platform=win32&arch=x64"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/kernels?platform=win32&arch=x64"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder.GET().build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/kernels?platform=win32&arch=x64");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/kernels?platform=win32&arch=x64", {
method: "GET",
headers: {
'X-API-Key': "YOUR_API_KEY",
},
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/kernels?platform=win32&arch=x64");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
"X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/kernels?platform=win32&arch=x64' \
-H 'X-API-Key: YOUR_API_KEY'
下载内核
把指定内核下载并解压到本机。文件较大时请求会一直保持到完成。
POST /api/v1/kernels/download
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| brand | Body | string | 是 | chrome 或 firefox |
| majorVersion | Body | number | 是 | 主版本 |
| platform | Body | string | 否 | win32 / darwin / linux,默认当前系统 |
| arch | Body | string | 否 | 默认 x64 |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| brand | string | 品牌 |
| majorVersion | number | 主版本 |
| dirName | string | 安装目录名 |
| installed | boolean | 完成后为 true |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"brand": "chrome",
"majorVersion": 120,
"dirName": "chrome_120",
"installed": true
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/kernels/download' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "brand": "chrome", "majorVersion": 120}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"brand\": \"chrome\", \"majorVersion\": 120}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/kernels/download", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/kernels/download"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"brand":"chrome","majorVersion":120}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/kernels/download"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"brand\": \"chrome\", \"majorVersion\": 120}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/kernels/download");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"brand\": \"chrome\", \"majorVersion\": 120}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/kernels/download", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"brand":"chrome","majorVersion":120}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/kernels/download");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"brand\": \"chrome\", \"majorVersion\": 120}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/kernels/download' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "brand": "chrome", "majorVersion": 120}'
创建标签
新建标签。同名标签已存在时直接返回已有记录。
POST /api/v1/tags
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| name | Body | string | 是 | 标签名,1–50 字 |
| color | Body | string | 否 | 颜色,默认 #409eff |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| id | string | 标签 ID |
| name | string | 名称 |
| color | string | 颜色 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"id": "tagxxxxxxxx",
"name": "常用",
"color": "#409eff"
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/tags' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "name": "常用", "color": "#409eff"}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"name\": \"常用\", \"color\": \"#409eff\"}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/tags", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/tags"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"name":"常用","color":"#409eff"}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/tags"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"name\": \"常用\", \"color\": \"#409eff\"}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/tags");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"name\": \"常用\", \"color\": \"#409eff\"}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/tags", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"name":"常用","color":"#409eff"}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/tags");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"name\": \"常用\", \"color\": \"#409eff\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/tags' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "name": "常用", "color": "#409eff"}'
更新标签
修改标签名称或颜色。
POST /api/v1/tags/update
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| id | Body | string | 是 | 标签 ID |
| name | Body | string | 否 | 新名称 |
| color | Body | string | 否 | 新颜色 |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| id | string | 标签 ID |
| name | string | 名称 |
| color | string | 颜色 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"id": "tagxxxxxxxx",
"name": "重点",
"color": "#f56c6c"
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/tags/update' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "id": "tagxxxxxxxx", "name": "重点", "color": "#f56c6c"}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"id\": \"tagxxxxxxxx\", \"name\": \"重点\", \"color\": \"#f56c6c\"}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/tags/update", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/tags/update"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"id":"tagxxxxxxxx","name":"重点","color":"#f56c6c"}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/tags/update"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"id\": \"tagxxxxxxxx\", \"name\": \"重点\", \"color\": \"#f56c6c\"}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/tags/update");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"id\": \"tagxxxxxxxx\", \"name\": \"重点\", \"color\": \"#f56c6c\"}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/tags/update", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"id":"tagxxxxxxxx","name":"重点","color":"#f56c6c"}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/tags/update");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"id\": \"tagxxxxxxxx\", \"name\": \"重点\", \"color\": \"#f56c6c\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/tags/update' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "id": "tagxxxxxxxx", "name": "重点", "color": "#f56c6c"}'
删除标签
删除标签字典中的一项。仅主账号可删除。不会自动改掉环境上已写的标签名。
POST /api/v1/tags/delete
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| id | Body | string | 是 | 标签 ID |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"id": "tagxxxxxxxx"
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/tags/delete' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "id": "tagxxxxxxxx"}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"id\": \"tagxxxxxxxx\"}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/tags/delete", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/tags/delete"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"id":"tagxxxxxxxx"}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/tags/delete"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"id\": \"tagxxxxxxxx\"}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/tags/delete");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"id\": \"tagxxxxxxxx\"}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/tags/delete", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"id":"tagxxxxxxxx"}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/tags/delete");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"id\": \"tagxxxxxxxx\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/tags/delete' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "id": "tagxxxxxxxx"}'
查询标签
查询当前团队的标签字典。
GET /api/v1/tags
请求参数
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| list | array | 标签列表 |
| list[].id | string | 标签 ID |
| list[].name | string | 名称 |
| list[].color | string | 颜色 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"list": [
{
"id": "tagxxxxxxxx",
"name": "常用",
"color": "#409eff"
}
]
}
}
请求示例
curl -X GET 'http://127.0.0.1:52702/api/v1/tags' \
-H 'X-API-Key: YOUR_API_KEY'
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/tags", nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/tags"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/tags"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder.GET().build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/tags");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/tags", {
method: "GET",
headers: {
'X-API-Key': "YOUR_API_KEY",
},
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/tags");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
"X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/tags' \
-H 'X-API-Key: YOUR_API_KEY'
查询分组
查询当前账号可见的环境分组。
GET /api/v1/groups
请求参数
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| groups | array | 分组 |
| groups[].id | string | 分组 ID |
| groups[].name | string | 名称 |
| groups[].remark | string | 备注 |
| groups[].sort | number | 排序 |
| groups[].profileCount | number | 组内环境数 |
| ungroupedCount | number | 未分组环境数 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"groups": [
{
"id": "grpxxxxxxxx",
"name": "默认",
"remark": "",
"sort": 0,
"profileCount": 2
}
],
"ungroupedCount": 1
}
}
请求示例
curl -X GET 'http://127.0.0.1:52702/api/v1/groups' \
-H 'X-API-Key: YOUR_API_KEY'
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/groups", nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/groups"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/groups"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder.GET().build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/groups");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/groups", {
method: "GET",
headers: {
'X-API-Key': "YOUR_API_KEY",
},
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/groups");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
"X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/groups' \
-H 'X-API-Key: YOUR_API_KEY'
创建分组
新建环境分组。需要主账号或团队管理员权限。
POST /api/v1/groups
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| name | Body | string | 是 | 分组名称,1–30 字 |
| remark | Body | string | 否 | 备注 |
| sort | Body | number | 否 | 排序,默认 0 |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| id | string | 分组 ID |
| name | string | 名称 |
| remark | string | 备注 |
| sort | number | 排序 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"id": "grpxxxxxxxx",
"name": "美国站",
"remark": "",
"sort": 0
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/groups' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "name": "美国站", "remark": "", "sort": 0}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"name\": \"美国站\", \"remark\": \"\", \"sort\": 0}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/groups", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/groups"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"name":"美国站","remark":"","sort":0}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/groups"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"name\": \"美国站\", \"remark\": \"\", \"sort\": 0}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/groups");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"name\": \"美国站\", \"remark\": \"\", \"sort\": 0}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/groups", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"name":"美国站","remark":"","sort":0}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/groups");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"name\": \"美国站\", \"remark\": \"\", \"sort\": 0}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/groups' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "name": "美国站", "remark": "", "sort": 0}'
修改分组
修改分组名称、备注或排序。需要主账号或团队管理员权限。
POST /api/v1/groups/update
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| id | Body | string | 是 | 分组 ID |
| name | Body | string | 否 | 名称 |
| remark | Body | string | 否 | 备注 |
| sort | Body | number | 否 | 排序 |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| id | string | 分组 ID |
| name | string | 名称 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"id": "grpxxxxxxxx",
"name": "欧洲站"
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/groups/update' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "id": "grpxxxxxxxx", "name": "欧洲站"}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"id\": \"grpxxxxxxxx\", \"name\": \"欧洲站\"}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/groups/update", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/groups/update"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"id":"grpxxxxxxxx","name":"欧洲站"}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/groups/update"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"id\": \"grpxxxxxxxx\", \"name\": \"欧洲站\"}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/groups/update");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"id\": \"grpxxxxxxxx\", \"name\": \"欧洲站\"}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/groups/update", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"id":"grpxxxxxxxx","name":"欧洲站"}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/groups/update");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"id\": \"grpxxxxxxxx\", \"name\": \"欧洲站\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/groups/update' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "id": "grpxxxxxxxx", "name": "欧洲站"}'
创建代理
在代理库中新增一条代理。
POST /api/v1/proxies
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| name | Body | string | 否 | 备注名 |
| type | Body | string | 是 | http / https / socks5 / ssh |
| host | Body | string | 是 | 主机 |
| port | Body | number | 是 | 端口 1–65535 |
| username | Body | string | 否 | 用户名 |
| password | Body | string | 否 | 密码 |
| refreshUrl | Body | string | 否 | 刷新 IP 的 URL |
| ipChannel | Body | string | 否 | IP 查询渠道 key,可空 |
| remark | Body | string | 否 | 备注 |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| id | string | 代理 ID |
| type | string | 类型 |
| host | string | 主机 |
| port | number | 端口 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"id": "pxyxxxxxxxx",
"type": "http",
"host": "127.0.0.1",
"port": 7890
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/proxies' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "name": "本地", "type": "http", "host": "127.0.0.1", "port": 7890, "username": "", "password": ""}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"name\": \"本地\", \"type\": \"http\", \"host\": \"127.0.0.1\", \"port\": 7890, \"username\": \"\", \"password\": \"\"}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/proxies", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/proxies"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"name":"本地","type":"http","host":"127.0.0.1","port":7890,"username":"","password":""}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/proxies"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"name\": \"本地\", \"type\": \"http\", \"host\": \"127.0.0.1\", \"port\": 7890, \"username\": \"\", \"password\": \"\"}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/proxies");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"name\": \"本地\", \"type\": \"http\", \"host\": \"127.0.0.1\", \"port\": 7890, \"username\": \"\", \"password\": \"\"}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/proxies", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"name":"本地","type":"http","host":"127.0.0.1","port":7890,"username":"","password":""}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/proxies");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"name\": \"本地\", \"type\": \"http\", \"host\": \"127.0.0.1\", \"port\": 7890, \"username\": \"\", \"password\": \"\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/proxies' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "name": "本地", "type": "http", "host": "127.0.0.1", "port": 7890, "username": "", "password": ""}'
更新代理
更新代理库中的一条记录。只传需要修改的字段。
POST /api/v1/proxies/update
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| id | Body | string | 是 | 代理 ID |
| name | Body | string | 否 | 备注名 |
| type | Body | string | 否 | 类型 |
| host | Body | string | 否 | 主机 |
| port | Body | number | 否 | 端口 |
| username | Body | string | 否 | 用户名 |
| password | Body | string | 否 | 密码 |
| refreshUrl | Body | string | 否 | 刷新 URL |
| remark | Body | string | 否 | 备注 |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| id | string | 代理 ID |
| host | string | 主机 |
| port | number | 端口 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"id": "pxyxxxxxxxx",
"host": "127.0.0.1",
"port": 7891
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/proxies/update' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "id": "pxyxxxxxxxx", "port": 7891}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"id\": \"pxyxxxxxxxx\", \"port\": 7891}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/proxies/update", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/proxies/update"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"id":"pxyxxxxxxxx","port":7891}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/proxies/update"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"id\": \"pxyxxxxxxxx\", \"port\": 7891}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/proxies/update");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"id\": \"pxyxxxxxxxx\", \"port\": 7891}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/proxies/update", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"id":"pxyxxxxxxxx","port":7891}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/proxies/update");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"id\": \"pxyxxxxxxxx\", \"port\": 7891}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/proxies/update' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "id": "pxyxxxxxxxx", "port": 7891}'
查询代理
查询当前团队的代理库。
GET /api/v1/proxies
请求参数
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| list | array | 代理列表 |
| list[].id | string | 代理 ID |
| list[].name | string | 备注名 |
| list[].type | string | 类型 |
| list[].host | string | 主机 |
| list[].port | number | 端口 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"list": [
{
"id": "pxyxxxxxxxx",
"name": "本地",
"type": "http",
"host": "127.0.0.1",
"port": 7890
}
]
}
}
请求示例
curl -X GET 'http://127.0.0.1:52702/api/v1/proxies' \
-H 'X-API-Key: YOUR_API_KEY'
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/proxies", nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/proxies"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/proxies"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder.GET().build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/proxies");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/proxies", {
method: "GET",
headers: {
'X-API-Key': "YOUR_API_KEY",
},
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/proxies");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
"X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/proxies' \
-H 'X-API-Key: YOUR_API_KEY'
删除代理
从代理库删除一条代理。已引用它的环境不会自动改代理配置。
POST /api/v1/proxies/delete
请求参数
| 字段 | 位置 | 类型 | 必填 | 说明 |
| id | Body | string | 是 | 代理 ID |
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"id": "pxyxxxxxxxx"
}
}
请求示例
curl -X POST 'http://127.0.0.1:52702/api/v1/proxies/delete' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "id": "pxyxxxxxxxx"}'package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader("{ \"id\": \"pxyxxxxxxxx\"}")
req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/proxies/delete", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/proxies/delete"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"id":"pxyxxxxxxxx"}, timeout=120)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/proxies/delete"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{ \"id\": \"pxyxxxxxxxx\"}"))
.build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/proxies/delete");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{ \"id\": \"pxyxxxxxxxx\"}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/proxies/delete", {
method: "POST",
headers: {
'X-API-Key': "YOUR_API_KEY",
'Content-Type': 'application/json',
},
body: JSON.stringify({"id":"pxyxxxxxxxx"}),
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/proxies/delete");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
"X-API-Key: YOUR_API_KEY",
'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"id\": \"pxyxxxxxxxx\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/proxies/delete' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "id": "pxyxxxxxxxx"}'
应用分类列表
查询应用中心推荐应用的分类,顺序与客户端一致。
GET /api/v1/extensions/categories
请求参数
响应 data 字段
HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。
| 字段 | 类型 | 说明 |
| list | array | 分类 |
| list[].id | string | 分类 ID |
| list[].name | string | 名称 |
| list[].sort | number | 排序,小的在前 |
响应示例
{
"code": 0,
"msg": "Success",
"data": {
"list": [
{
"id": "catxxxxxxxx",
"name": "工具",
"sort": 0
}
]
}
}
请求示例
curl -X GET 'http://127.0.0.1:52702/api/v1/extensions/categories' \
-H 'X-API-Key: YOUR_API_KEY'
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/extensions/categories", nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(raw))
}import requests
url = "http://127.0.0.1:52702/api/v1/extensions/categories"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class LocalApiDemo {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("http://127.0.0.1:52702/api/v1/extensions/categories"))
.header("X-API-Key", "YOUR_API_KEY");
HttpRequest request = builder.GET().build();
HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (!curl) return 1;
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/extensions/categories");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return rc == CURLE_OK ? 0 : 1;
}const res = await fetch("http://127.0.0.1:52702/api/v1/extensions/categories", {
method: "GET",
headers: {
'X-API-Key': "YOUR_API_KEY",
},
});
console.log(res.status, await res.text());<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/extensions/categories");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
"X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/extensions/categories' \
-H 'X-API-Key: YOUR_API_KEY'