2

我的 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"}

预期的答案是包含会话 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 年)左右才会发布。

4

1 回答 1

2

尝试使用这个 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":[]}

在此处输入图像描述

于 2013-09-18T14:38:53.610 回答