Files
nl-im-service/IM_API_Collection.postman_collection.json
2025-12-04 08:51:40 +08:00

893 lines
19 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"info": {
"_postman_id": "nl-im-api-collection",
"name": "IM系统 API 接口集合",
"description": "IM系统后端API接口测试集合包含认证、用户、联系人、房间、消息、附件等所有接口",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"variable": [
{
"key": "base_url",
"value": "http://localhost:12080",
"type": "string"
},
{
"key": "token",
"value": "",
"type": "string"
},
{
"key": "user_id",
"value": "10001",
"type": "string"
}
],
"item": [
{
"name": "认证模块",
"item": [
{
"name": "用户登录",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"account\": \"workerqi@163.com\",\n \"password\": \"12345678\",\n \"remember\": true\n}"
},
"url": {
"raw": "{{base_url}}/api/login",
"host": ["{{base_url}}"],
"path": ["api", "login"]
}
},
"event": [
{
"listen": "test",
"script": {
"exec": [
"if (pm.response.code === 200) {",
" const body = pm.response.json();",
" if (body.code === 0 && body.result && body.result.token) {",
" pm.environment.set(\"token\", body.result.token);",
" if (body.result.user && body.result.user.id) {",
" pm.environment.set(\"user_id\", body.result.user.id);",
" }",
" }",
"}"
]
}
}
]
},
{
"name": "用户注册",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"newuser@example.com\",\n \"phone\": \"13800138000\",\n \"password\": \"12345678\",\n \"confirm_password\": \"12345678\",\n \"code\": \"123456\",\n \"agree_terms\": true\n}"
},
"url": {
"raw": "{{base_url}}/api/register",
"host": ["{{base_url}}"],
"path": ["api", "register"]
}
}
},
{
"name": "发送邮箱验证码",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"target\": \"test@example.com\",\n \"type\": \"email\"\n}"
},
"url": {
"raw": "{{base_url}}/api/send-email-code",
"host": ["{{base_url}}"],
"path": ["api", "send-email-code"]
}
}
},
{
"name": "发送短信验证码",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"target\": \"13800138000\",\n \"type\": \"sms\"\n}"
},
"url": {
"raw": "{{base_url}}/api/send-sms-code",
"host": ["{{base_url}}"],
"path": ["api", "send-sms-code"]
}
}
},
{
"name": "检查Token有效性",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
}
],
"url": {
"raw": "{{base_url}}/api/check-token",
"host": ["{{base_url}}"],
"path": ["api", "check-token"]
}
}
}
]
},
{
"name": "会话管理",
"item": [
{
"name": "获取会话列表",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
}
],
"url": {
"raw": "{{base_url}}/api/conversations",
"host": ["{{base_url}}"],
"path": ["api", "conversations"]
}
}
},
{
"name": "重置会话未读数",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"target_id\": \"10002\"\n}"
},
"url": {
"raw": "{{base_url}}/api/conversations/reset-unread",
"host": ["{{base_url}}"],
"path": ["api", "conversations", "reset-unread"]
}
}
},
{
"name": "更新会话标记",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"target_id\": \"10002\",\n \"is_top\": true,\n \"is_muted\": false,\n \"is_special_care\": true\n}"
},
"url": {
"raw": "{{base_url}}/api/conversations/update",
"host": ["{{base_url}}"],
"path": ["api", "conversations", "update"]
}
}
},
{
"name": "删除会话",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"target_id\": \"10002\"\n}"
},
"url": {
"raw": "{{base_url}}/api/conversations/delete",
"host": ["{{base_url}}"],
"path": ["api", "conversations", "delete"]
}
}
}
]
},
{
"name": "用户管理",
"item": [
{
"name": "获取当前用户信息",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
}
],
"url": {
"raw": "{{base_url}}/api/user/my-info",
"host": ["{{base_url}}"],
"path": ["api", "user", "my-info"]
}
}
},
{
"name": "获取用户列表",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
}
],
"url": {
"raw": "{{base_url}}/api/user/list?page=1&page_size=20",
"host": ["{{base_url}}"],
"path": ["api", "user", "list"],
"query": [
{
"key": "page",
"value": "1"
},
{
"key": "page_size",
"value": "20"
}
]
}
}
},
{
"name": "创建用户",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"admin@example.com\",\n \"phone\": \"13900139000\",\n \"password\": \"12345678\",\n \"name\": \"管理员\",\n \"avatar\": \"A\",\n \"desc\": \"系统管理员\"\n}"
},
"url": {
"raw": "{{base_url}}/api/user/create",
"host": ["{{base_url}}"],
"path": ["api", "user", "create"]
}
}
},
{
"name": "更新用户信息",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": \"{{user_id}}\",\n \"updates\": {\n \"name\": \"新名称\",\n \"desc\": \"新签名\",\n \"region\": \"北京\"\n }\n}"
},
"url": {
"raw": "{{base_url}}/api/user/update",
"host": ["{{base_url}}"],
"path": ["api", "user", "update"]
}
}
}
]
},
{
"name": "联系人管理",
"item": [
{
"name": "获取联系人列表",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
}
],
"url": {
"raw": "{{base_url}}/api/contacts",
"host": ["{{base_url}}"],
"path": ["api", "contacts"]
}
}
},
{
"name": "搜索用户",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
}
],
"url": {
"raw": "{{base_url}}/api/contacts/search?keyword=10002",
"host": ["{{base_url}}"],
"path": ["api", "contacts", "search"],
"query": [
{
"key": "keyword",
"value": "10002"
}
]
}
}
},
{
"name": "添加好友",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"to_user_id\": \"10002\",\n \"message\": \"你好,我想加你为好友\"\n}"
},
"url": {
"raw": "{{base_url}}/api/contacts/add-friend",
"host": ["{{base_url}}"],
"path": ["api", "contacts", "add-friend"]
}
}
},
{
"name": "获取好友申请列表",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
}
],
"url": {
"raw": "{{base_url}}/api/contacts/friend-requests",
"host": ["{{base_url}}"],
"path": ["api", "contacts", "friend-requests"]
}
}
},
{
"name": "接受好友申请",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"request_id\": 1\n}"
},
"url": {
"raw": "{{base_url}}/api/contacts/accept-request",
"host": ["{{base_url}}"],
"path": ["api", "contacts", "accept-request"]
}
}
},
{
"name": "拒绝好友申请",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"request_id\": 1\n}"
},
"url": {
"raw": "{{base_url}}/api/contacts/reject-request",
"host": ["{{base_url}}"],
"path": ["api", "contacts", "reject-request"]
}
}
},
{
"name": "获取分组列表",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
}
],
"url": {
"raw": "{{base_url}}/api/contacts/groups",
"host": ["{{base_url}}"],
"path": ["api", "contacts", "groups"]
}
}
},
{
"name": "创建分组",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"group_name\": \"家人\"\n}"
},
"url": {
"raw": "{{base_url}}/api/contacts/groups",
"host": ["{{base_url}}"],
"path": ["api", "contacts", "groups"]
}
}
},
{
"name": "更新分组",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"group_name\": \"朋友\",\n \"sort_order\": 1\n}"
},
"url": {
"raw": "{{base_url}}/api/contacts/groups/update/1",
"host": ["{{base_url}}"],
"path": ["api", "contacts", "groups", "update", "1"]
}
}
},
{
"name": "删除分组",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
}
],
"url": {
"raw": "{{base_url}}/api/contacts/groups/delete/1",
"host": ["{{base_url}}"],
"path": ["api", "contacts", "groups", "delete", "1"]
}
}
},
{
"name": "获取好友详情",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
}
],
"url": {
"raw": "{{base_url}}/api/contacts/10002",
"host": ["{{base_url}}"],
"path": ["api", "contacts", "10002"]
}
}
},
{
"name": "更新好友信息",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"remark_name\": \"备注名称\",\n \"group_id\": 1,\n \"is_top\": true,\n \"is_muted\": false\n}"
},
"url": {
"raw": "{{base_url}}/api/contacts/update/10002",
"host": ["{{base_url}}"],
"path": ["api", "contacts", "update", "10002"]
}
}
},
{
"name": "删除好友",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
}
],
"url": {
"raw": "{{base_url}}/api/contacts/delete/10002",
"host": ["{{base_url}}"],
"path": ["api", "contacts", "delete", "10002"]
}
}
}
]
},
{
"name": "房间管理",
"item": [
{
"name": "创建房间",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"room_type\": \"p2p\",\n \"members\": [\"{{user_id}}\", \"10002\"]\n}"
},
"url": {
"raw": "{{base_url}}/api/rooms",
"host": ["{{base_url}}"],
"path": ["api", "rooms"]
}
}
},
{
"name": "获取房间信息",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
}
],
"url": {
"raw": "{{base_url}}/api/rooms/10001_10002",
"host": ["{{base_url}}"],
"path": ["api", "rooms", "10001_10002"]
}
}
}
]
},
{
"name": "消息管理",
"item": [
{
"name": "发送消息",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-User-ID",
"value": "{{user_id}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"receiver_user_id\": \"10002\",\n \"room_id\": \"10001_10002\",\n \"message_type\": 0,\n \"content\": \"这是一条测试消息\",\n \"duration\": 0\n}"
},
"url": {
"raw": "{{base_url}}/api/send",
"host": ["{{base_url}}"],
"path": ["api", "send"]
}
}
},
{
"name": "获取历史消息",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
}
],
"url": {
"raw": "{{base_url}}/api/messages?room_id=10001_10002&page=1&page_size=50",
"host": ["{{base_url}}"],
"path": ["api", "messages"],
"query": [
{
"key": "room_id",
"value": "10001_10002"
},
{
"key": "page",
"value": "1"
},
{
"key": "page_size",
"value": "50"
}
]
}
}
}
]
},
{
"name": "附件管理",
"item": [
{
"name": "上传附件",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "file",
"type": "file",
"src": []
},
{
"key": "type",
"value": "image",
"type": "text"
}
]
},
"url": {
"raw": "{{base_url}}/api/attachments/upload",
"host": ["{{base_url}}"],
"path": ["api", "attachments", "upload"]
}
}
},
{
"name": "获取附件信息",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
}
],
"url": {
"raw": "{{base_url}}/api/attachments/1",
"host": ["{{base_url}}"],
"path": ["api", "attachments", "1"]
}
}
},
{
"name": "获取附件列表",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
}
],
"url": {
"raw": "{{base_url}}/api/attachments?type=image&page=1&page_size=20",
"host": ["{{base_url}}"],
"path": ["api", "attachments"],
"query": [
{
"key": "type",
"value": "image"
},
{
"key": "page",
"value": "1"
},
{
"key": "page_size",
"value": "20"
}
]
}
}
},
{
"name": "删除附件",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}"
}
],
"url": {
"raw": "{{base_url}}/api/attachments/delete/1",
"host": ["{{base_url}}"],
"path": ["api", "attachments", "delete", "1"]
}
}
}
]
},
{
"name": "系统接口",
"item": [
{
"name": "健康检查",
"request": {
"method": "GET",
"url": {
"raw": "{{base_url}}/api/health",
"host": ["{{base_url}}"],
"path": ["api", "health"]
}
}
},
{
"name": "获取ICE服务器配置",
"request": {
"method": "GET",
"url": {
"raw": "{{base_url}}/api/ice-servers?user_id={{user_id}}",
"host": ["{{base_url}}"],
"path": ["api", "ice-servers"],
"query": [
{
"key": "user_id",
"value": "{{user_id}}"
}
]
}
}
},
{
"name": "检查用户在线状态",
"request": {
"method": "GET",
"url": {
"raw": "{{base_url}}/api/check-user-online?user_id=10002",
"host": ["{{base_url}}"],
"path": ["api", "check-user-online"],
"query": [
{
"key": "user_id",
"value": "10002"
}
]
}
}
}
]
}
]
}