Toegang tot de API REST van CRM 2015 On-Premise in PHP
fr:Accéder à l'API REST de CRM 2015 On-Premise en PHP
en:Access to the API REST of CRM 2015 On-Premise in PHP
es:Con el resto de la API de CRM 2015 On-Premise en PHP
pt:Acesso para o resto da API de CRM 2015 no local em PHP
it:Accesso al resto di API di CRM 2015 On-Premise in PHP
nl:Toegang tot de API REST van CRM 2015 On-Premise in PHP
de:Zugang zum REST des CRM 2015 vor-Ort in PHP API
zh:访问 API 其余的 CRM 2015 上-前提在 PHP 中
ar:الوصول إلى بقية API لإدارة علاقات العملاء عام 2015 في الموقع في بي إتش بي
ja:API の残りの CRM 2015 オンプレミス php へのアクセス
pl:Dostęp do API REST z CRM 2015 wdrożonej w PHP
ru:Доступ к API REST из CRM к 2015 году на предприятии в PHP
ro:Acces la restul API de CRM 2015 On-Premise în PHP
he:גישה לשאר API של CRM 2015 מקומית ב- PHP
nl:Toegang tot de API REST van CRM 2015 On-Premise in PHP
he:גישה לשאר API של CRM 2015 מקומית ב- PHP
ro:Acces la restul API de CRM 2015 On-Premise în PHP
ru:Доступ к API REST из CRM к 2015 году на предприятии в PHP
pl:Dostęp do API REST z CRM 2015 wdrożonej w PHP
ja:API の残りの CRM 2015 オンプレミス php へのアクセス
ar:الوصول إلى بقية API لإدارة علاقات العملاء عام 2015 في الموقع في بي إتش بي
zh:访问 API 其余的 CRM 2015 上-前提在 PHP 中
de:Zugang zum REST des CRM 2015 vor-Ort in PHP API
it:Accesso al resto di API di CRM 2015 On-Premise in PHP
pt:Acesso para o resto da API de CRM 2015 no local em PHP
es:Con el resto de la API de CRM 2015 On-Premise en PHP
en:Access to the API REST of CRM 2015 On-Premise in PHP
fr:Accéder à l'API REST de CRM 2015 On-Premise en PHP
Dit artikel is vertaald door middel van automatische vertalingssoftware. U kunt het artikel bron hier te bekijken.
Introductie
Dit artikel zal u voorzien van toegang tot de API REST de CRM 2015 On-Premise met taal PHP. Het is noodzakelijk dat uw CRM worden aangesloten met Active DIrectory en in het bezit van de naam van uw organisatie op CRM.
Stel de variabelen van het werk
// CRM Server
define('CRM_SERVER', 'NOM_DU_SERVEUR_CRM');
// CRM Organization
define('CRM_ORG_NAME', 'NOM_DE_LORGANISATION');
// CRM WSDL
define('CRM_WSDL', 'http://'.CRM_SERVER.'/'.CRM_ORG_NAME.'/XRMServices/2011/OrganizationData.svc');
// Active Directory
define('AD_DOMAIN_CONTROLER', "NOM_DU_SERVEUR_AD");
define("NTLM_LOGIN", "User");
define("NTLM_PASSWORD", "password");
Informatie ophalen
In dit voorbeeld zullen we informatie over een account ophalen.
// On crée l'URL de l'API REST
$url = CRM_WSDL."/AccountSet(guid'GUID_DU_COMPTE')";
// On initialise notre connexion à l'API
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERPWD, NTLM_LOGIN. ':' . NTLM_PASSWORD);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch, CURLOPT_MAXREDIRS, 100);
// On crée nos headers
$headers = array("Content-Type:application/json; charset=utf-8", "Accept:application/json");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// On récupère le contenu
$account = curl_exec($ch);
Dankzij dit, u uw account gegevens ophalen JSON.
Gegevens bijwerken
In dit voorbeeld, zullen we e-mail op een account bijwerken.
// On crée notre objet à mettre à jour
$account = array();
$account['EMailAddress1'] = "adresse@domain.tld";
// On encode en JSON
$account = json_encode($account);
// On crée l'URL de l'API REST
$url = CRM_WSDL."/AccountSet(guid'GUID_DU_COMPTE')";
// On initialise notre connexion à l'API
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERPWD, NTLM_LOGIN. ':' . NTLM_PASSWORD);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch, CURLOPT_MAXREDIRS, 100);
curl_setopt($ch, CURLOPT_POST, 1);
// On crée nos headers
$headers = array("X-HTTP-Method: MERGE", "Content-Type:application/json; charset=utf-8", "Accept:application/json");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// On l'envoi via CURL
curl_setopt($ch, CURLOPT_POSTFIELDS, $account);
// On récupère le contenu
$response = curl_exec($ch);
Retourcode uit de API
Wanneer een fout optreedt de API Deze eigenschap retourneert een matrix in JSON met de foutcode en de fout om te helpen wanneer de debug. Tijdens een update of een delete, als alles goed is gegaan de API Retourneert een variabele gelijk is aan NULL.
Conclusie
Door middel van dit artikel, kunt u nu verbinding maken met de API de CRM 2015 voor het bekijken of bewerken.
Dit artikel leek u nuttig ?
Automatisch bijwerken van reacties inschakelen