有关api发送好友请求

winchen 16天前 89

在https://docs.wildfirechat.cn/server/admin_api/user_relation.html 的 6.0.1里面有 发送好友请求Api说明, http://domain:18080/admin/friend/send_request

但我没有得到任何回应,其它的几个api接口操作,我都有得到正确回应,所以在组合签名规则这部分应该肯定没有错误的。 可为什么 /admin/friend/send_request 没有任何响应,在App客户端也没有任何添加好友的提示,就如石沉大海,我该如何纠错?我是专业版IM 我的响应打印如下 HTTP/1.1 500 Internal Server Error connection: keep-alive content-type: application/json;charset=utf-8 content-encoding: utf-8 content-length: 0

最新回复 (7)
  • x86 16天前
    引用 2
    应当是参数错了吧,看下 im-server 的日志,并把请求参数贴出来
  • winchen 16天前
    引用 3
    请求参数如下
    ```
    {"nonce":330860,"SECRET_KEY":"123456","timestamp":1747153084820,"sign":"cbca7924c4ee1d5259077a69a3ea6aba9a0c7ac5","url":"http:\/\/wfcpro.jcimchat.com:18080\/friend\/send_request","post":{"userId":"e60e02242ebb4aa2895a3c26617ace82","friendUid":"qygqmws2k","reason":"hello","force":true},"json":"{\"userId\":\"e60e02242ebb4aa2895a3c26617ace82\",\"friendUid\":\"qygqmws2k\",\"reason\":\"hello\",\"force\":true}"}

    ```
     im-server 的日志,没有报错信息
  • winchen 16天前
    引用 4
    {"nonce":313947,"SECRET_KEY":"123456","timestamp":1747183565351,"sign":"14b43526501a490b3ce4b6891d08bf2266ca7aeb","url":"http:\/\/wfcpro.jcimchat.com:18080\/admin\/friend\/list","post":{"userId":"e60e02242ebb4aa2895a3c26617ace82","friendUid":"qygqmws2k","status":0},"json":"{\"userId\":\"e60e02242ebb4aa2895a3c26617ace82\",\"friendUid\":\"qygqmws2k\",\"status\":0}"}
    对/admin/friend/list 发送以上有得到正确回应
    {"nonce":380431,"SECRET_KEY":"123456","timestamp":1747183644435,"sign":"3a58446658c5a9545917dd0d73c4dc1a2b6ab77c","url":"http:\/\/wfcpro.jcimchat.com:18080\/friend\/send_request","post":{"userId":"e60e02242ebb4aa2895a3c26617ace82","friendUid":"qygqmws2k","reason":"hello","force":true},"json":"{\"userId\":\"e60e02242ebb4aa2895a3c26617ace82\",\"friendUid\":\"qygqmws2k\",\"reason\":\"hello\",\"force\":true}"}
    但对/friend/send_request 但发送这样得到500的报错
    HTTP/1.1 500 Internal Server Error connection: keep-alive content-type: application/json;charset=utf-8 content-encoding: utf-8 content-length: 0
    是不是 /friend/send_request 这个Api接口本身就有问题呀
  • HeavyRain 15天前
    引用 5
    文档上,下面是好友请求的示例
    curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"userId\":\"a\",\"friendUid\":\"b\",\"reason\":\"hello\",\"force\":true}" http://localhost:18080/admin/friend/send_request

    {
      "code":0,
      "msg":"success"
    }
  • HeavyRain 15天前
    引用 6
    winchen {"nonce":313947,"SECRET_KEY":"123456","timestamp":1747183565 ...
    你回复的格式我没有见过,可能是格式有问题。请看一下我5楼回复的格式。你们后端使用java吗,如果使用java可以用java sdk。
  • winchen 14天前
    引用 7
    我知道我的错误在哪了,请求的URL我前面漏了admin。/admin/friend/send_request这样才是正确的,另请问如果不想要对方有请求好友的提示,不需要对方同意,就是偷偷强制性的变成他的好友,怎操作呢?
  • HeavyRain 14天前
    引用 8
    https://docs.wildfirechat.cn/server/admin_api/user_relation.html  这里第一个api就是设置好友的
返回