SugarCRM 5.5.2 Rest api -- 登录失败
我需要能够使用 SugarCRM 的 API 与其他几个应用程序交换信息。我找到了 api 文档,以及一些带有示例代码的好文章。我的代码的最终结果是发送以下命令:
http://localhost/sugarcrm/service/v2/rest.php?method=login&input_type=json&response_type=json&rest_data={%22user_name%22:%22rest%22,% 22password%22:%2265e8800b5c6800aad896f888b2a62afc%22,%22version%22:%22.01%22}
这会产生此错误 {"name":"无效登录","number":10,"description":"登录尝试失败,请检查用户名和密码"}null
我已在 google 上搜索了该错误,并发现其他几个人也存在此问题,但没有解决方案。
I need to be able to use the API for SugarCRM to exchange information with several other applications. I found the api docs, and some good articles with sample code. The end result of my code is to send this command:
http://localhost/sugarcrm/service/v2/rest.php?method=login&input_type=json&response_type=json&rest_data={%22user_name%22:%22rest%22,%22password%22:%2265e8800b5c6800aad896f888b2a62afc%22,%22version%22:%22.01%22}
Which produces this error
{"name":"Invalid Login","number":10,"description":"Login attempt failed please check the username and password"}null
I have googled the error and found several others with this issue, but no solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为正确的 REST 字符串如下:
method=login&input_type=json&response_type=json&rest_data={"user_auth": {"user_name":"user","password":"somemd5hash","version": "1.0"},"application_name":"RestTest"}
(当然应该进行 url 编码)
I think the proper REST string would be like:
method=login&input_type=json&response_type=json&rest_data={"user_auth": {"user_name":"user","password":"somemd5hash","version":"1.0"},"application_name":"RestTest"}
(should be url-encoded then of course)
对我来说,我需要使用以下内容:
method=login&input_type=JSON&response_type=JSON&rest_data=$REST_DATA
REST 数据是:
(URL 编码)
For me, I needed to use something along the lines of:
method=login&input_type=JSON&response_type=JSON&rest_data=$REST_DATA
The REST data is:
(URL encoded)
URL:http://mycrmurl.com/service/v4/rest.php
请求数据- 在 POST 方法中
method=login&input_type=JSON&response_type=JSON&rest_data={"user_auth":{"user_name":"username","password":"md5password","version":"1.0"}," application_name":"RestTest"}
来自 WS 的响应:
{"id":"someID","module_name":"Users","name_value_list":{"user_id":{"name":"user_id","value": "1"},"用户名":{"名称":"用户名","值":"用户名"},"用户语言":{"名称":"用户语言","值":"en_us"}," user_currency_id":{"name":"user_currency_id","value":"-99"},"user_is_admin":{"name":"user_is_admin","value":true},"user_default_team_id":{"name" :"user_default_team_id","value":null},"user_default_dateformat":{"name":"user_default_dateformat","value":"m/d/Y"},"user_default_timeformat":{"name":"user_default_timeformat" ,"value":"h:ia"},"user_number_seperator":{"name":"user_number_seperator","value":","},"user_decimal_seperator":{"name":"user_decimal_seperator","value" :"."},"mobile_max_list_entries":{"name":"mobile_max_list_entries","value":null},"mobile_max_subpanel_entries":{"name":"mobile_max_subpanel_entries","value":null},"user_currency_name": {"name":"user_currency_name","value":"美元"}}}
URL : http://mycrmurl.com/service/v4/rest.php
Request Data - in POST method
method=login&input_type=JSON&response_type=JSON&rest_data={"user_auth":{"user_name":"username","password":"md5password","version":"1.0"},"application_name":"RestTest"}
Response from WS:
{"id":"someID","module_name":"Users","name_value_list":{"user_id":{"name":"user_id","value":"1"},"user_name":{"name":"user_name","value":"username"},"user_language":{"name":"user_language","value":"en_us"},"user_currency_id":{"name":"user_currency_id","value":"-99"},"user_is_admin":{"name":"user_is_admin","value":true},"user_default_team_id":{"name":"user_default_team_id","value":null},"user_default_dateformat":{"name":"user_default_dateformat","value":"m/d/Y"},"user_default_timeformat":{"name":"user_default_timeformat","value":"h:ia"},"user_number_seperator":{"name":"user_number_seperator","value":","},"user_decimal_seperator":{"name":"user_decimal_seperator","value":"."},"mobile_max_list_entries":{"name":"mobile_max_list_entries","value":null},"mobile_max_subpanel_entries":{"name":"mobile_max_subpanel_entries","value":null},"user_currency_name":{"name":"user_currency_name","value":"US Dollars"}}}