SugarCRM:获取“无效会话 ID” REST 调用出错

发布于 2024-09-30 09:08:56 字数 315 浏览 1 评论 0原文

我正在使用 SugarCRM CE 6.0.3。

当我进行像 get_entry_list() 这样的 REST API 调用时,我总是收到此错误:

{'description': 'The session ID is invalid',
 'name': 'Invalid Session ID',
 'number': 11}

我非常确定我已登录并使用正确的会话 ID。事实上,当我可以成功调用 get_user_id() 并检索我自己的用户 ID 时。

谷歌搜索没有产生任何有用的结果,其他人遇到过这个问题吗?

I'm using SugarCRM CE 6.0.3.

When I make REST API calls like get_entry_list(), I always get this error:

{'description': 'The session ID is invalid',
 'name': 'Invalid Session ID',
 'number': 11}

I am very sure that I am logged in and using the correct session ID. In fact, when I can successfully call get_user_id() and retrieve my own user ID.

Googling has not produced any helpful results, anyone else encountered this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我不会写诗 2024-10-07 09:08:56

我发现了这个问题,这实际上只是 SugarCRM 方面的文档不好的问题。本文档中的参数命名全部错误:

http://developers.sugarcrm.com/docs/OS/6.0/-docs-Developer_Guides-Sugar_Developer_Guide_6.0-Chapter%202%20Application%20Framework.html#9000259

简单修复对于此问题:在 SugarCRM 中进行 REST 调用时不要使用命名参数。即在 API 调用中对“rest_data”使用位置参数(JSON 数组)。

I have found the problem, it is really just a matter of bad documentation on SugarCRM's part. The parameter naming is all wrong in this document:

http://developers.sugarcrm.com/docs/OS/6.0/-docs-Developer_Guides-Sugar_Developer_Guide_6.0-Chapter%202%20Application%20Framework.html#9000259

Simple fix for this problem: Do not use named parameters when making REST calls in SugarCRM. i.e. Use positional parameters (JSON array) for 'rest_data' in API calls.

无言温柔 2024-10-07 09:08:56

我在 set_entry api 调用时遇到了这个问题。对我来说,问题是我提交给调用的值之一包含 api 无法处理的特殊字符。我的解决方案是对值进行urlencode,然后 Sugar 在其端对其进行解码。请参见下文:

$name = "abc's ; 10/10/2013";
$values = array(
                "name"=>$name
          );
$sugar->set_entry("Accounts", $values);

上面抛出了 Invalid session ID 错误。下面是有效的代码:

$name = urlencode("abc's ; 10/10/2013");
$values = array(
                "name"=>$name
          );
$sugar->set_entry("Accounts", $values);

I encountered this issue with the set_entry api call. For me the issue is one of the values that I was submitting to the call contained special characters that the api couldn't handle. My solution was to urlencode the value, and Sugar decodes it on their end. See below:

$name = "abc's ; 10/10/2013";
$values = array(
                "name"=>$name
          );
$sugar->set_entry("Accounts", $values);

The above threw the Invalid session ID error. Below is the code that works:

$name = urlencode("abc's ; 10/10/2013");
$values = array(
                "name"=>$name
          );
$sugar->set_entry("Accounts", $values);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文