Fonctions communes:API

De Logilys
Aller à : navigation, rechercher
API


Communications (exemple en php)

Pour utiliser l'API, les requêtes doivent passer par LDE. Voici un exemple en php servant à faire une demande à LDE afin de récupérer de l'information :

$jsonfile='{';

$jsonfile.='"UID":"1318396",';

$jsonfile.='"Session":"ifcu20j7de8q5m96r1ovpheog4",';

$jsonfile.='"DemSoftware":"PRODON",';

$jsonfile.='"DemCat":"LOGIN",';

$jsonfile.='"DemAction":"SELECT",';

$jsonfile.='"DemOptions":{"LngUID":0,"UsrEmail":"exemple@exemple.com","NomSession":""}';

$jsonfile.='}';

$ch=curl_init();

curl_setopt($ch,CURLOPT_URL,"https://192.168.0.50");

curl_setopt($ch,CURLOPT_PORT,"123");

curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);

curl_setopt($ch,CURLOPT_POST,1);

curl_setopt($ch,CURLOPT_USERPWD,"username:password");

curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,TRUE);

curl_setopt($ch,CURLOPT_CAINFO,"/path/to/cacert.pem");

curl_setopt($ch,CURLOPT_POSTFIELDS,array("filecontenttype"=>"application/json","file"=>$jsonfile));

curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,2);

curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,30);

curl_setopt($ch,CURLOPT_TIMEOUT,30);

$result=curl_exec($ch);


Ouverture de session



Nom du document : Fonctions communes:API