sugarcrm REST获取\u条目

sugarcrm REST获取\u条目,rest,sugarcrm,Rest,Sugarcrm,有人能看看我是如何设置这个REST呼叫的吗?我还没有找到一个这样的例子,我无法让它发挥作用 可能是空白的“Link KnNeMexToFieldStAsple数组”参数。我已经阅读了文档,但并不真正理解该参数。我不知道这是否造成了我的问题 任何帮助都将被告知 //SET UP CURL $curl = curl_init($url); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_HEADER, false)

有人能看看我是如何设置这个REST呼叫的吗?我还没有找到一个这样的例子,我无法让它发挥作用

可能是空白的“Link KnNeMexToFieldStAsple数组”参数。我已经阅读了文档,但并不真正理解该参数。我不知道这是否造成了我的问题

任何帮助都将被告知

//SET UP CURL
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

//parameters for get_entry call (I received a session id from a call to the login function.  Using it here)
//I manually got this user 'id' form the sugarcrm database
$parameters = array(
         'session'=>$result->id,
         'module_name' => 'users',
         'id' => '21a6a633-40de-9bf4-aa14-4f8753ea5aa2',
         'select_fields' => array('user_name'),
         'link_name_to_fields_array'=> array()
 );


$json = json_encode($parameters);
$postArgs='method=get_entry&input_type=JSON&response_type=JSON$rest_data=' . $json;
curl_setopt($curl,CURLOPT_POSTFIELDS, $postArgs);
$result2 = curl_exec( $curl );
echo("<pre>" . print_r($result2,true) . "</pre>");
//设置卷曲
$curl=curl\u init($url);
curl_setopt($curl,CURLOPT_POST,true);
curl_setopt($curl,CURLOPT_头,false);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
//get_entry调用的参数(我从对登录函数的调用中收到一个会话id。在这里使用它)
//我从sugarcrm数据库中手动获取了此用户“id”
$parameters=数组(
“会话”=>$result->id,
“模块名称”=>“用户”,
“id”=>“21a6a633-40de-9bf4-aa14-4f8753ea5aa2”,
'选择字段'=>数组('用户名'),
“链接\u名称\u到\u字段\u数组”=>array()
);
$json=json_encode($parameters);
$postArgs='method=get_entry&input_type=JSON&response_type=JSON$rest_data='$json;
curl_setopt($curl,CURLOPT_POSTFIELDS,$postArgs);
$result2=curl\u exec($curl);
echo(“.print_r($result2,true)。”);

输出为“传入的错误数据;返回主页”

您在postArgs行中有错误(将
$rest\u data
替换为
&rest\u data
)。试试这个:

$postArgs='method=get_entry&input_type=JSON&response_type=JSON&rest_data=' . $json;