Hi there
We are trying to use the API REST of uiteCRM 7 (versión 4.1), but we are not able even to make the “login” call to work
When we call this method in the API in the log file does not appear any error (when credentials are right), but the result from the REST call is empty
we have this code (Which we obtained directly from the wiki documentation about REST API):
<?php
require_once('../custom/constantes.php');
function restRequest($method, $arguments){
$curl = curl_init(URL_REST);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$post = array(
"method" => $method,
"input_type" => "JSON",
"response_type" => "JSON",
"rest_data" => json_encode($arguments),
);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
$result = curl_exec($curl);
curl_close($curl);
return json_decode($result,1);
}
$userAuth = array(
'user_name' => NAME_USER_PAY,
'password' => md5(PASSWORD_USER_PAY),
);
$appName = 'My SuiteCRM REST Client';
$nameValueList = array();
$args = array(
'user_auth' => $userAuth,
'application_name' => $appName,
'name_value_list' => $nameValueList);
$result = restRequest('login',$args);
echo "Tamaño:".sizeof($result);
$sessId = $result['id'];
echo " LA SESION ES".$sessId;
?>
The issue is that when credentials are wrong, an error message in the log file appears saying “FAILED LOGIN:attempts[1]”, but when credentials are fine, the $result variable is empty, nothing is inside, and the Session Id does not appear
Any ideas please?
We have checked that URL and credentials are fine :blink:
Thanks a lot in advance