我的java应用程序生成:
{"application":"lukasync","user_auth":{"user_name":"admin","password":"03535a5ae1b5bff4401a7283c4570d8c"}}
发送方式:
http://<My_Site>/service/v4_1/rest.php?method=login&input_type=json&response_type=json&rest_data={"application":"lukasync","user_auth":{"user_name":"admin","password":"03535a5ae1b5bff4401a7283c4570d8c"}}
但它得到的答案是:
{"name":"Invalid Login","number":10,"description":"Login attempt failed please check the username and password"}
预期答案是包含 session ID 的 JSON 字符串。
我已检查用户名和哈希值是否与数据库中的相匹配。 我还尝试对 JSON 进行 URL 编码,但最终得到相同的结果。
这是 SugarCRM 版本 6.5.15(内部版本 1083)
我犯了一些基本的实现错误吗?
更新: 显然 SugarCRM 需要 JSON 来订购,并且根据 Sugarcrm.com/support/bugs.html?caseID=34925#issue_34925 他们似乎认为这也是正确的方法。因此 user_auth 需要是 JSON 字符串中的第一个对象。
我被告知他们已经修复了 SugarCRM 7 的问题,但要到明年年中(2014 年)左右才会发布。
最佳答案
尝试使用这个 JSON 结构。它应该可以工作。
{
"user_auth": {
"user_name": "admin",
"password": "03535a5ae1b5bff4401a7283c4570d8c",
"version": "1"
},
"application_name": "RestCall",
"name_value_list": []
}
新 URL 将为:http://crm-shiruslabs.dontesta.it:8888/sugarcrm_dev_WebServices/service/v4_1/rest.php?method=login&input_type=JSON&response_type=JSON&rest_data={"user_auth": {“user_name”:“admin”,“password”:“03535a5ae1b5bff4401a7283c4570d8c”,“version”:“1”},“application_name”:“RestCall”,“name_value_list”:[]}
关于java - 通过 REST 登录 SugarCRM 无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18863849/