Példakód
Példa API-hívásra PHP nyelven
<?php
//API HÍVÁS: információk megadása
$apilink = "https://api.capitris.hu/v3/api/ügyfél/";
$entity = "list";
$muvelet = "list";
$key = "";
$api_key = array("api_key" => $key);
$plusparams = array("allow_disabled" => "true");
//Az api_key-nek POST hívásnál is GET parméterkent kell mennie
$geturl = $apilink.$entity."/".$muvelet."?".http_build_query(array_merge($api_key, $plusparams));
$posturl = $apilink.$entity."/".$muvelet."?".http_build_query($api_key);
//1. PÉLDA: GET metódus
$handle=curl_init();
curl_setopt($handle, CURLOPT_URL, $geturl);
curl_setopt($handle, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, true);
//Windows esetén le kell tölteni a certifikáció miatt ezt a file-t
$certificate = "path/cacert.pem";
curl_setopt($handle, CURLOPT_CAINFO, $certificate);
curl_setopt($handle, CURLOPT_CAPATH, $certificate);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($handle);
curl_close($handle);
print $res;
//2. PÉLDA: POST metódus / JSON request
$handle=curl_init();
$json_string = json_encode($plusparams);
curl_setopt($handle, CURLOPT_URL, $posturl);
curl_setopt($handle, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, true);
//Windows esetén le kell tölteni a certifikáció miatt ezt a file-t
$certificate = "path/cacert.pem";
curl_setopt($handle, CURLOPT_CAINFO, $certificate);
curl_setopt($handle, CURLOPT_CAPATH, $certificate);
curl_setopt($handle, CURLOPT_POSTFIELDS, $json_string);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_HTTPHEADER, array('Content-type: application/json; charset=utf-8', 'Content-Length: ' .strlen($json_string)));
$res = curl_exec($handle);
curl_close($handle);
print $res;
?>