You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Stream REST API正确构造请求体创建双人Distinct Channel?

关于Stream REST API创建专属Distinct Channel的请求体格式问题

我正尝试通过Stream REST API创建一个新频道,由于架构限制必须使用REST API而非客户端工具。官方文档中将“members”字段定义为“PaginationParams”,但我不清楚这具体指什么。在其他客户端调用中,仅需提交成员ID数组即可,但我尝试了两种格式均请求失败,因找不到更详细的文档只能反复尝试。

尝试1

  • 请求地址:https://chat.stream-io-api.com/channels/messaging/query?api_key=mykeyhere
  • 请求体:{"members":["userid1","userid2"]}
  • 错误信息:GetOrCreateChannel failed with error: "expected object for field "members" but got array"
  • 状态码:400

尝试2

  • 请求地址:https://chat.stream-io-api.com/channels/messaging/query?api_key=mykeyhere
  • 请求体:{"members":{"userid1":{"id":"userid1"},"userid2":{"id":"userid2"}}}
  • 错误信息:GetOrCreateChannel failed with error: "When using member based IDs specify at least 2 members"
  • 状态码:400

有没有人知道该调用的正确请求体格式?我需要为这两个已存在的用户创建一个专属Distinct Channel,且已确认认证配置无误,其他API调用均可正常执行。

内容的提问来源于stack exchange,提问作者Zach Whelchel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 02:25:00