PostMan API 调用示例
本示例提供 CosLogin 客户端 Local API 的 Postman 集合,导入后配置 baseUrl、localApiToken 等变量即可在本地测试浏览器窗口的查询、打开、关闭、创建、批量创建、编辑及删除等接口。所有请求仅监听 127.0.0.1,需保持客户端登录。
{
"info": {
"_postman_id": "coslogin-local-api-examples",
"name": "CosLogin Local API 示例",
"description": "CosLogin 客户端 Local API 的 Postman 调用示例。导入后先在 Collection Variables 中设置 baseUrl、localApiToken,以及需要测试的 browserUuid、browserId、groupId、tagId 等变量。Local API 只监听本机 127.0.0.1,客户端需保持登录状态。",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"auth": {
"type": "apikey",
"apikey": [
{
"key": "key",
"value": "X-Cos-Local-Token",
"type": "string"
},
{
"key": "value",
"value": "{{localApiToken}}",
"type": "string"
},
{
"key": "in",
"value": "header",
"type": "string"
}
]
},
"item": [
{
"name": "浏览器窗口接口",
"item": [
{
"name": "查询窗口列表",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"page\": 0,\n \"pageSize\": 20,\n \"keyword\": \"Amazon\",\n \"groupId\": {{groupId}},\n \"currentPlatform\": \"windows\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browser/list",
"host": [
"{{baseUrl}}"
],
"path": [
"browser",
"list"
]
},
"description": "查询浏览器窗口列表。page 传 0 时 Local API 会归一为第一页。"
},
"response": []
},
{
"name": "查询窗口详情",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"uuid\": \"{{browserUuid}}\",\n \"currentPlatform\": \"windows\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browser/detail",
"host": [
"{{baseUrl}}"
],
"path": [
"browser",
"detail"
]
},
"description": "按窗口 UUID 查询窗口详情。也可改用 id/browserId。"
},
"response": []
},
{
"name": "打开浏览器窗口",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"uuid\": \"{{browserUuid}}\",\n \"appendLaunchArgs\": [\n \"--start-debugger-server=6000\",\n \"--remote-allow-origins=*\"\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browser/open",
"host": [
"{{baseUrl}}"
],
"path": [
"browser",
"open"
]
},
"description": "打开一个浏览器窗口。该接口一次只支持一个窗口。appendLaunchArgs 为本次打开追加到浏览器启动命令尾部的参数,不会写入窗口配置。"
},
"response": []
},
{
"name": "关闭浏览器窗口",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"uuid\": \"{{browserUuid}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browser/close",
"host": [
"{{baseUrl}}"
],
"path": [
"browser",
"close"
]
},
"description": "关闭一个浏览器窗口。该接口一次只支持一个窗口。"
},
"response": []
},
{
"name": "创建窗口",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"Postman 创建窗口\",\n \"groupId\": {{groupId}},\n \"tagIds\": [{{tagId}}, {{tagId2}}],\n \"remark\": \"Local API Postman 示例\",\n \"proxyMethod\": 2,\n \"proxyType\": \"socks5\",\n \"host\": \"127.0.0.1\",\n \"port\": 1080,\n \"proxyUserName\": \"user\",\n \"proxyPassword\": \"pass\",\n \"windowPlatform\": \"windows\",\n \"browserFingerPrint\": {\n \"ostype\": \"PC\",\n \"os\": \"Windows\"\n },\n \"config\": {\n \"raw\": {\n \"name\": \"Postman 创建窗口\",\n \"syncCookies\": true\n }\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browser/update",
"host": [
"{{baseUrl}}"
],
"path": [
"browser",
"update"
]
},
"description": "未传窗口 id/uuid 时会创建窗口。创建类接口可传 windowPlatform/window_platform。"
},
"response": []
},
{
"name": "编辑窗口",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"uuid\": \"{{browserUuid}}\",\n \"name\": \"Postman 修改后的窗口名称\",\n \"groupId\": {{groupId}},\n \"remark\": \"Postman 修改备注\",\n \"tagIds\": [{{tagId}}, {{tagId2}}],\n \"currentPlatform\": \"windows\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browser/update",
"host": [
"{{baseUrl}}"
],
"path": [
"browser",
"update"
]
},
"description": "传窗口 id/uuid 时会编辑窗口。已有窗口操作可传 currentPlatform/current_platform。"
},
"response": []
},
{
"name": "批量创建窗口",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"createCount\": 2,\n \"namePrefix\": \"Postman批量窗口-\",\n \"groupId\": {{groupId}},\n \"tagIds\": [{{tagId}}, {{tagId2}}],\n \"windowPlatform\": \"windows\",\n \"config\": {\n \"raw\": {\n \"syncCookies\": true\n }\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browser/create/batch",
"host": [
"{{baseUrl}}"
],
"path": [
"browser",
"create",
"batch"
]
},
"description": "按 createCount 和 namePrefix 批量创建窗口。"
},
"response": []
},
{
"name": "批量创建窗口 - 指定 items",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"items\": [\n {\n \"name\": \"Postman 批量窗口 A\",\n \"groupId\": {{groupId}},\n \"windowPlatform\": \"windows\",\n \"config\": {\n \"raw\": {\n \"syncCookies\": true\n }\n }\n },\n {\n \"name\": \"Postman 批量窗口 B\",\n \"groupId\": {{groupId}},\n \"proxyMethod\": 2,\n \"proxyType\": \"socks5\",\n \"host\": \"127.0.0.1\",\n \"port\": 1080,\n \"windowPlatform\": \"windows\",\n \"config\": {\n \"raw\": {\n \"syncCookies\": true\n }\n }\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browser/create/batch",
"host": [
"{{baseUrl}}"
],
"path": [
"browser",
"create",
"batch"
]
},
"description": "通过 items 指定每个窗口的创建参数。"
},
"response": []
},
{
"name": "局部/批量更新窗口",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"uuids\": [\"{{browserUuid}}\", \"{{browserUuid2}}\"],\n \"remark\": \"Postman 批量备注\",\n \"tagIds\": [{{tagId}}, {{tagId2}}],\n \"currentPlatform\": \"windows\",\n \"config\": {\n \"syncCookies\": true\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browser/update/partial",
"host": [
"{{baseUrl}}"
],
"path": [
"browser",
"update",
"partial"
]
},
"description": "批量或局部修改窗口配置。建议显式传 config,避免辅助字段被并入配置片段。"
},
"response": []
},
{
"name": "删除窗口",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"uuid\": \"{{browserUuid}}\",\n \"currentPlatform\": \"windows\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browser/delete",
"host": [
"{{baseUrl}}"
],
"path": [
"browser",
"delete"
]
},
"description": "将窗口移入回收站。"
},
"response": []
},
{
"name": "批量删除窗口",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"ids\": [{{browserId}}, {{browserId2}}],\n \"currentPlatform\": \"windows\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browser/delete/ids",
"host": [
"{{baseUrl}}"
],
"path": [
"browser",
"delete",
"ids"
]
},
"description": "批量将窗口移入回收站。ids 也可传英文逗号分隔字符串。"
},
"response": []
},
{
"name": "批量修改窗口分组",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"ids\": [{{browserId}}, {{browserId2}}],\n \"groupId\": {{groupId}},\n \"currentPlatform\": \"windows\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browser/group/update",
"host": [
"{{baseUrl}}"
],
"path": [
"browser",
"group",
"update"
]
},
"description": "批量修改窗口所属分组。"
},
"response": []
},
{
"name": "批量修改窗口备注",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"ids\": [{{browserId}}, {{browserId2}}],\n \"remark\": \"Postman 新备注\",\n \"currentPlatform\": \"windows\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browser/remark/update",
"host": [
"{{baseUrl}}"
],
"path": [
"browser",
"remark",
"update"
]
},
"description": "批量修改窗口备注。"
},
"response": []
},
{
"name": "批量修改窗口代理",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"ids\": [{{browserId}}, {{browserId2}}],\n \"proxyMethod\": 2,\n \"proxyType\": \"socks5\",\n \"host\": \"127.0.0.1\",\n \"port\": 1080,\n \"proxyUserName\": \"user\",\n \"proxyPassword\": \"pass\",\n \"ipCheckService\": \"ip-api\",\n \"currentPlatform\": \"windows\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browser/proxy/update",
"host": [
"{{baseUrl}}"
],
"path": [
"browser",
"proxy",
"update"
]
},
"description": "批量修改窗口代理配置。"
},
"response": []
},
{
"name": "批量创建窗口 - 兼容路径 /browser/batch-create",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"createCount\": 1,\n \"namePrefix\": \"Postman兼容路径-\",\n \"windowPlatform\": \"windows\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browser/batch-create",
"host": [
"{{baseUrl}}"
],
"path": [
"browser",
"batch-create"
]
},
"description": "/browser/create/batch 的兼容路径。"
},
"response": []
},
{
"name": "批量创建窗口 - 兼容路径 /browser/createBatch",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"createCount\": 1,\n \"namePrefix\": \"Postman兼容路径-\",\n \"windowPlatform\": \"windows\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browser/createBatch",
"host": [
"{{baseUrl}}"
],
"path": [
"browser",
"createBatch"
]
},
"description": "/browser/create/batch 的兼容路径。"
},
"response": []
}
]
},
{
"name": "浏览器分组接口",
"item": [
{
"name": "查询分组列表",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"page\": 0,\n \"pageSize\": 100,\n \"keyword\": \"Amazon\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/group/list",
"host": [
"{{baseUrl}}"
],
"path": [
"group",
"list"
]
},
"description": "查询浏览器分组列表。"
},
"response": []
},
{
"name": "新增分组",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"groupName\": \"Postman 分组\",\n \"sortNum\": 0,\n \"parentCode\": 0\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/group/add",
"host": [
"{{baseUrl}}"
],
"path": [
"group",
"add"
]
},
"description": "新增浏览器分组。Local API 会固定补 id: 0。"
},
"response": []
},
{
"name": "编辑分组",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": {{groupId}},\n \"groupName\": \"Postman 分组-已改名\",\n \"sortNum\": 10,\n \"parentCode\": 0\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/group/edit",
"host": [
"{{baseUrl}}"
],
"path": [
"group",
"edit"
]
},
"description": "编辑浏览器分组。"
},
"response": []
},
{
"name": "删除分组",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": {{groupId}}\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/group/delete",
"host": [
"{{baseUrl}}"
],
"path": [
"group",
"delete"
]
},
"description": "删除浏览器分组。"
},
"response": []
},
{
"name": "查询分组详情",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": {{groupId}}\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/group/detail",
"host": [
"{{baseUrl}}"
],
"path": [
"group",
"detail"
]
},
"description": "查询分组详情。Local API 实际调用分组列表并取第一条作为详情,建议调用方校验返回 id。"
},
"response": []
}
]
},
{
"name": "浏览器标签接口",
"item": [
{
"name": "查询标签列表",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"page\": 0,\n \"pageSize\": 10000,\n \"keyword\": \"重点\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browserTag/list",
"host": [
"{{baseUrl}}"
],
"path": [
"browserTag",
"list"
]
},
"description": "查询浏览器标签列表。"
},
"response": []
},
{
"name": "创建标签",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"tagName\": \"Postman 标签\",\n \"tagColor\": \"#66CCFF\",\n \"sortNum\": 0\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browserTag/create",
"host": [
"{{baseUrl}}"
],
"path": [
"browserTag",
"create"
]
},
"description": "创建浏览器标签。"
},
"response": []
},
{
"name": "编辑标签",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": {{tagId}},\n \"tagName\": \"Postman 标签-已改名\",\n \"tagColor\": \"#ECC2F3\",\n \"sortNum\": 10\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browserTag/update",
"host": [
"{{baseUrl}}"
],
"path": [
"browserTag",
"update"
]
},
"description": "编辑浏览器标签。"
},
"response": []
},
{
"name": "删除标签",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": {{tagId}}\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browserTag/delete",
"host": [
"{{baseUrl}}"
],
"path": [
"browserTag",
"delete"
]
},
"description": "删除单个浏览器标签。"
},
"response": []
},
{
"name": "批量删除标签",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"ids\": [{{tagId}}, {{tagId2}}]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browserTag/delete",
"host": [
"{{baseUrl}}"
],
"path": [
"browserTag",
"delete"
]
},
"description": "批量删除浏览器标签。Local API 会逐个调用云端删除接口。"
},
"response": []
},
{
"name": "更新窗口标签关系",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"uuid\": \"{{browserUuid}}\",\n \"addTagIds\": [{{tagId}}],\n \"removeTagIds\": [{{tagId2}}],\n \"currentPlatform\": \"windows\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/browserTag/updateRelation",
"host": [
"{{baseUrl}}"
],
"path": [
"browserTag",
"updateRelation"
]
},
"description": "增量更新窗口标签关系。Local API 会先读取窗口详情,再合并 addTagIds/removeTagIds 后更新。"
},
"response": []
}
]
}
],
"variable": [
{
"key": "baseUrl",
"value": "http://127.0.0.1:54345",
"type": "string"
},
{
"key": "localApiToken",
"value": "替换为系统设置/Local API 页面中的本机访问令牌",
"type": "string"
},
{
"key": "browserUuid",
"value": "browser-config-uuid",
"type": "string"
},
{
"key": "browserUuid2",
"value": "browser-config-uuid-2",
"type": "string"
},
{
"key": "browserId",
"value": "101",
"type": "string"
},
{
"key": "browserId2",
"value": "102",
"type": "string"
},
{
"key": "groupId",
"value": "12",
"type": "string"
},
{
"key": "tagId",
"value": "3",
"type": "string"
},
{
"key": "tagId2",
"value": "5",
"type": "string"
}
]
}