Fonctions communes:API : Différence entre versions
| Ligne 42 : | Ligne 42 : | ||
La réponse sera retournée sous forme de JSON. Voilà à quoi peut ressembler la réponse : | La réponse sera retournée sous forme de JSON. Voilà à quoi peut ressembler la réponse : | ||
| + | |||
| + | <pre> | ||
| + | stdClass Object | ||
| + | ( | ||
| + | [Usr] => Array | ||
| + | ( | ||
| + | [0] => stdClass Object | ||
| + | ( | ||
| + | [UsrHidenNo] => 24 | ||
| + | [LngUID] => 0 | ||
| + | [Message] => | ||
| + | ) | ||
| + | |||
| + | ) | ||
| + | |||
| + | [SecUsr] => Array | ||
| + | ( | ||
| + | [0] => stdClass Object | ||
| + | ( | ||
| + | [Security] => CLIGES | ||
| + | [Access] => A M D C | ||
| + | ) | ||
| + | |||
| + | [1] => stdClass Object | ||
| + | ( | ||
| + | [Security] => ADRESSEGES | ||
| + | [Access] => A M _ C | ||
| + | ) | ||
| + | |||
| + | [2] => stdClass Object | ||
| + | ( | ||
| + | [Security] => STD_RAPPORT_17 | ||
| + | [Access] => O | ||
| + | ) | ||
| + | |||
| + | ) | ||
| + | |||
| + | [Module] => Array | ||
| + | ( | ||
| + | [0] => stdClass Object | ||
| + | ( | ||
| + | [Module] => AEL | ||
| + | [Active] => 1 | ||
| + | ) | ||
| + | |||
| + | [1] => stdClass Object | ||
| + | ( | ||
| + | [Module] => BENEF | ||
| + | [Active] => 1 | ||
| + | ) | ||
| + | |||
| + | [2] => stdClass Object | ||
| + | ( | ||
| + | [Module] => DEL | ||
| + | [Active] => 1 | ||
| + | ) | ||
| + | |||
| + | ) | ||
| + | |||
| + | [DisplayFormat] => Array | ||
| + | ( | ||
| + | [0] => stdClass Object | ||
| + | ( | ||
| + | [LngUID] => 0 | ||
| + | [LngCode] => FR | ||
| + | [CurrencyFormat] => 0 | ||
| + | [NegCurrencyFormat] => 14 | ||
| + | [DecimalSeparator] => , | ||
| + | [ThousandSeparator] => | ||
| + | [DateSeparator] => . | ||
| + | [ShortDateFormat] => jj.mm.aaaa | ||
| + | [LongDateFormat] => jjjj j mmmm aaaa | ||
| + | [DateTimeFormat] => jj.mm.aaaa hh:nn | ||
| + | [ShortTimeFormat] => hh:nn | ||
| + | [CurrencyString] => $ | ||
| + | ) | ||
| + | |||
| + | [1] => stdClass Object | ||
| + | ( | ||
| + | [LngUID] => 1 | ||
| + | [LngCode] => EN | ||
| + | [CurrencyFormat] => 0 | ||
| + | [NegCurrencyFormat] => 0 | ||
| + | [DecimalSeparator] => , | ||
| + | [ThousandSeparator] => | ||
| + | [DateSeparator] => / | ||
| + | [ShortDateFormat] => yyyy/mm/dd | ||
| + | [LongDateFormat] => dddd, mmmm d yyyy | ||
| + | [DateTimeFormat] => yyyy/mm/dd hh:nn | ||
| + | [ShortTimeFormat] => hh:nn | ||
| + | [CurrencyString] => $ | ||
| + | ) | ||
| + | |||
| + | ) | ||
| + | |||
| + | [Support] => Array | ||
| + | ( | ||
| + | [0] => stdClass Object | ||
| + | ( | ||
| + | [NoSerie] => 0007008012 | ||
| + | [OrgCodeP] => G6T 1S7 | ||
| + | [OrgBur] => (819) 758-0560 | ||
| + | ) | ||
| + | |||
| + | ) | ||
| + | |||
| + | [About] => Array | ||
| + | ( | ||
| + | [0] => stdClass Object | ||
| + | ( | ||
| + | [NoSerie] => 0007008012 | ||
| + | [Version] => 5.0.5 | ||
| + | [TypeVersion] => Multi-utilisateur | ||
| + | [VersionSQL] => Developer Edition (64-bit) 11.0.2100.60 RTM | ||
| + | [NbLic] => 10 | ||
| + | ) | ||
| + | |||
| + | ) | ||
| + | |||
| + | ) | ||
| + | </pre> | ||
== Ouverture de session == | == Ouverture de session == | ||
Version du 24 octobre 2017 à 14:35
| API |
Communications (exemple en php)
Pour utiliser l'API, les requêtes doivent passer par LDE. Les communications se font par l'intermédiaire de fichiers JSON. 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);
Fichier JSON
UID : Numéro unique servant uniquement à identifier la requête lorsqu'il est nécessaire de déboguer une requête.
Session : Texte de 100 caractères permettant de s'identifier dans ProDon. Cette chaîne de caractères doit être unique par utilisateur.
DemSoftware : Fait référence à la colonne « Application » dans la grille de la fenêtre de configuration de LDE. Sert à identifier à quel logiciel se connecter. (advenant le cas où vous auriez plusieurs logiciels de Logilys)
DemCat : Sert à identifier l'opération à effectuer. Voir la liste ci-dessous.
DemAction : Sert à identifier l'opération à effectuer. Voir la liste ci-dessous.
DemOptions : Paramètres nécessaires pour effectuer l'opération voulue. La liste va changer selon l'opération identifiée par DemAction et DemCat.
Envoi du JSON avec curl
CURLOPT_URL : URL pour accéder à votre LDE.
CURLOPT_PORT : Port SSL inscrit dans la section « Web Server » de la fenêtre de configuration de LDE.
CURLOPT_USERPWD : Username et Password inscrit dans la section « Web Server » de la fenêtre de configuration de LDE.
CURLOPT_CAINFO : Doit pointer vers votre certificat SSL.
CURLOPT_POSTFIELDS : Identifier le fichier JSON à envoyer. Il faut absolument documenter le filecontenttype à application/json.
Réception de la réponse
La réponse sera retournée sous forme de JSON. Voilà à quoi peut ressembler la réponse :
stdClass Object
(
[Usr] => Array
(
[0] => stdClass Object
(
[UsrHidenNo] => 24
[LngUID] => 0
[Message] =>
)
)
[SecUsr] => Array
(
[0] => stdClass Object
(
[Security] => CLIGES
[Access] => A M D C
)
[1] => stdClass Object
(
[Security] => ADRESSEGES
[Access] => A M _ C
)
[2] => stdClass Object
(
[Security] => STD_RAPPORT_17
[Access] => O
)
)
[Module] => Array
(
[0] => stdClass Object
(
[Module] => AEL
[Active] => 1
)
[1] => stdClass Object
(
[Module] => BENEF
[Active] => 1
)
[2] => stdClass Object
(
[Module] => DEL
[Active] => 1
)
)
[DisplayFormat] => Array
(
[0] => stdClass Object
(
[LngUID] => 0
[LngCode] => FR
[CurrencyFormat] => 0
[NegCurrencyFormat] => 14
[DecimalSeparator] => ,
[ThousandSeparator] =>
[DateSeparator] => .
[ShortDateFormat] => jj.mm.aaaa
[LongDateFormat] => jjjj j mmmm aaaa
[DateTimeFormat] => jj.mm.aaaa hh:nn
[ShortTimeFormat] => hh:nn
[CurrencyString] => $
)
[1] => stdClass Object
(
[LngUID] => 1
[LngCode] => EN
[CurrencyFormat] => 0
[NegCurrencyFormat] => 0
[DecimalSeparator] => ,
[ThousandSeparator] =>
[DateSeparator] => /
[ShortDateFormat] => yyyy/mm/dd
[LongDateFormat] => dddd, mmmm d yyyy
[DateTimeFormat] => yyyy/mm/dd hh:nn
[ShortTimeFormat] => hh:nn
[CurrencyString] => $
)
)
[Support] => Array
(
[0] => stdClass Object
(
[NoSerie] => 0007008012
[OrgCodeP] => G6T 1S7
[OrgBur] => (819) 758-0560
)
)
[About] => Array
(
[0] => stdClass Object
(
[NoSerie] => 0007008012
[Version] => 5.0.5
[TypeVersion] => Multi-utilisateur
[VersionSQL] => Developer Edition (64-bit) 11.0.2100.60 RTM
[NbLic] => 10
)
)
)
Ouverture de session
Nom du document : Fonctions communes:API