我需要使用PHP API在MS Dynamics CRM中进行身份验证和CURD操作。
我已经参考了 Reference1 Reference2 Reference3 Reference4
并按照以下步骤进行操作:
settings >
Administration >
system settings >
previews >
accept terms & conditions >
Web API Developer Preview >
Enable Dynamics CRM Web API Preview to yes
这个问题在 Reference4
链接中有详细解释。
当我访问:
https://<your organization name>.crm.dynamics.com/api/data/contacts
和
https://<your organization name>.crm.dynamics.com/api/data/accounts
我可以获取所有联系人和账户。
但现在我想通过php使用api访问它,
- 如何发送联系人和账户的请求?
- 如何创建一个没有提供信用卡详细信息的AAD试用版本应用程序?
我尝试了以下代码:
$ZDURL= 'https://www.microsoft.com/en-sg/dynamics/';
curlWrap("GET",$ZDURL);
function curlWrap($action,$ZDURL)
{
$ch = curl_init();
/* $data = array('accountType' => 'MICROSOFT DYNAMICS',
'id' => '83261c03-3a21-4c64-b62c-00d6c2127c64',
'source'=>'PHI-cUrl-Example',
'service'=>'lh2'); */
//curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "username:password");
curl_setopt($ch, CURLOPT_URL, $ZDURL);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$output = curl_exec($ch);
if($output===false)
{
echo "curl error >> ".curl_error($ch);
exit;
}
else
{
echo "No Curl error occurs";
echo "<pre>";print_r($output);
}
exit;
curl_close($ch);
$decoded = json_decode($output);
return $decoded;
}
它的显示如下: 最后,找到了这个使用Web API查询数据的链接,但不知道如何使用php传递请求。
需要帮助通过API检索CRM详细信息。