gpt4 book ai didi

php - 通过 PHP API 访问 MS Dynamics CRM

转载 作者:可可西里 更新时间:2023-10-31 23:29:18 25 4
gpt4 key购买 nike

我需要使用 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 访问它,

  1. 如何发送联系人和帐户请求?
  2. 如何在不提供信用卡详细信息的情况下使用 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;
}

显示如下:

enter image description here

最后,得到这个 Query Data using the Web API链接,但不知道如何使用 php 传递请求。

需要帮助以使用 api 检索 CRM 详细信息。

最佳答案

这是关于从 PHP 连接到 Office365 rest api 的相当全面的教程。对于新的 CRM 2016/CRM 2015 WebApi 预览版,工作原理相同,只是端点和查询不同。

https://dev.outlook.com/RestGettingStarted/Tutorial/php

至于第 2 期,如果您通过 Azure 门户,则需要信用卡。您可能想查看新的 Office365 应用程序注册门户 http://dev.office.com/app-registration .我不确定它是否支持 Dynamics CRM。

关于php - 通过 PHP API 访问 MS Dynamics CRM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34127776/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com