简体   繁体   English

通过PHP API访问MS Dynamics CRM

[英]MS Dynamics CRM access through PHP API

I need to authenticate and perform CURD operations in MS Dynamics CRM using PHP API. 我需要使用PHP API在MS Dynamics CRM中进行身份验证和执行CURD操作。

I have referred Reference1 Reference2 Reference3 Reference4 我已经参考了 Reference1 Reference2 Reference3 Reference4

and using the below steps: 并使用以下步骤:

settings > 
Administration > 
system settings >
previews > 
accept terms & conditions > 
Web API Developer Preview  >
Enable Dynamics CRM Web API Preview to yes

which is given in Reference4 link. Reference4链接中给出。

When I access, 当我访问时,

https://<your organization name>.crm.dynamics.com/api/data/contacts

and

https://<your organization name>.crm.dynamics.com/api/data/accounts

I can get all my contacts and accounts. 我可以获得所有联系人和帐户。

But now I want to access it through php using api, 但现在我想通过php使用api访问它,

  1. How to send the request for contacts and accounts? 如何发送联系人和帐户的请求?
  2. How to create an application using AAD for trail version without providing credit card details? 如何在不提供信用卡详细信息的情况下使用AAD创建跟踪版本的应用程序?

I tried the below code: 我尝试了下面的代码:

$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;
}

It shows as below: 它显示如下:

在此输入图像描述

Finally, got this Query Data using the Web API link, but no idea how to pass the request using php. 最后, 使用Web API链接获取此查询数据 ,但不知道如何使用php传递请求。

Need a help to retrieve CRM details by using api. 需要帮助来使用api检索CRM详细信息。

This is quite a comprehensive tutorial on connecting to Office365 rest api's from PHP. 这是一个关于从PHP连接到Office365 rest api的全面教程。 For the new CRM 2016 / CRM 2015 WebApi preview, the workings are the same, only the endpoint and the query is different. 对于新的CRM 2016 / CRM 2015 WebApi预览,工作方式相同,只有端点和查询不同。

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

As for issue number 2, if you go through the azure portal, you need a credit card. 对于第2期,如果你浏览天蓝色的门户,你需要一张信用卡。 You might want to check out the new Office365 app registration portal http://dev.office.com/app-registration . 您可能需要查看新的Office365应用程序注册门户网站http://dev.office.com/app-registration I don't know for sure if it supports Dynamics CRM. 我不确定它是否支持Dynamics CRM。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM