curl -X POST "http://localhost:5001/message" \
-H "Content-Type: application/json" \
-d '{
"message_id": 123456789
}'
const response = await fetch('http://localhost:5001/message', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
message_id: 123456789
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"message_id": 123456789
}
response = requests.post('http://localhost:5001/message', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"message_id": 123456789,
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/message",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"message_id": 123456789,
"message_seq": 1001,
"client_msg_no": "msg_123",
"from_uid": "user123",
"channel_id": "group123",
"channel_type": 2,
"timestamp": 1640995200,
"payload": "SGVsbG8gV29ybGQ="
}
{
"error": "Message not found"
}
消息管理
单条消息搜索
根据消息 ID 搜索单条消息
POST
/
message
curl -X POST "http://localhost:5001/message" \
-H "Content-Type: application/json" \
-d '{
"message_id": 123456789
}'
const response = await fetch('http://localhost:5001/message', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
message_id: 123456789
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"message_id": 123456789
}
response = requests.post('http://localhost:5001/message', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"message_id": 123456789,
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/message",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"message_id": 123456789,
"message_seq": 1001,
"client_msg_no": "msg_123",
"from_uid": "user123",
"channel_id": "group123",
"channel_type": 2,
"timestamp": 1640995200,
"payload": "SGVsbG8gV29ybGQ="
}
{
"error": "Message not found"
}
概述
根据消息 ID 搜索单条消息,适用于需要获取特定消息详情的场景。请求体
消息 ID
curl -X POST "http://localhost:5001/message" \
-H "Content-Type: application/json" \
-d '{
"message_id": 123456789
}'
const response = await fetch('http://localhost:5001/message', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
message_id: 123456789
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"message_id": 123456789
}
response = requests.post('http://localhost:5001/message', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"message_id": 123456789,
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/message",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"message_id": 123456789,
"message_seq": 1001,
"client_msg_no": "msg_123",
"from_uid": "user123",
"channel_id": "group123",
"channel_type": 2,
"timestamp": 1640995200,
"payload": "SGVsbG8gV29ybGQ="
}
{
"error": "Message not found"
}
响应字段
服务器生成的消息 ID
消息序列号
客户端消息编号
发送者用户 ID
频道 ID
频道类型
1- 个人频道2- 群组频道
消息时间戳(Unix 时间戳)
Base64 编码的消息内容
状态码
| 状态码 | 说明 |
|---|---|
| 200 | 消息搜索成功 |
| 400 | 请求参数错误 |
| 404 | 消息不存在 |
| 500 | 服务器内部错误 |
⌘I

