Outils pour utilisateurs

Outils du site


dev:api:webservices

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
dev:api:webservices [2016/03/23 15:21] – créée floriandev:api:webservices [2023/03/17 09:56] (Version actuelle) – modification externe 127.0.0.1
Ligne 1: Ligne 1:
-Template: +[[dev:api]]
- +
-<code> +
-===== classe/method ===== +
- +
-==== Description ==== +
- +
-==== URL ==== +
- +
-==== Paramètres ==== +
- +
-==== Retour ==== +
- +
-==== Exemples ==== +
- +
-</code> +
- +
-======= Web Services EzGED ======= +
-Les web services EzGED constituent l'API ouverte permettant de s'interfacer avec EzGED. +
- +
-====== Format de retour ====== +
- +
-Le serveur de service, écrit en python, sert le résultat au format XML. +
-Dans le cas où vous voudriez obtenir le résultat sous forme JSON rendez-vous sur la page [[dev:api:webservices:json | Web Services JSON ]] +
- +
-====== Liste des services ====== +
- +
-===== sec/authenticate ===== +
- +
-==== Description ==== +
- +
-Permet de s'authentifier auprès du serveur EzGED et d'obtenir un id de session. +
- +
-==== URL ==== +
- +
-  http://<adresse_du_serveur>:<port>/sec/authenticate/ +
-   +
-==== Paramètres ==== +
- +
-  * **login** //requis// - Le nom de compte avec lequel s'authentifier. +
-  * **pwd**   //requis// - Le mot de passe haché en md5. +
-  * **domain** - Nom de domaine du serveur LDAP auprès duquel on doit s'identifier. Requis si le paramètre d'instance auth-w2kad.logins est configuré. +
-  * **realip** - Adresse IP à comparée avec le paramètre [[|SECUSR_HOST]] s'il est définit. +
- +
-==== Retour ==== +
- +
-L'id de session est  +
- +
-<code> +
-<object subtype='object' type='session'> +
-    <object subtype='string' type='property' name='sessionid' value='75776802'/> +
-</object> +
-</code> +
- +
-==== Exemples ==== +
- +
-Appel  +
-  http://localhost:8080/sec/authenticate/?login=admin&pwd=21232f297a57a5a743894a0e4a801fc3 +
-   +
-Retour +
-<file xml sec/authenticate.xml> +
-<?xml version='1.0' encoding='ISO-8859-15'?> +
-<object type='result'> +
-  <object subtype='object' type='user'> +
-    <object type='property' name='allowtoprofile' value='1'/> +
-    <object type='property' name='allowtobasket' value='1'/> +
-    <object type='property' name='SECUSR_ID' value='1'/> +
-    <object type='property' name='allowtoglobalsearch' value='1'/> +
-    <object type='property' name='SECUSR_SECGRPID' value='1'/> +
-    <object type='property' name='SECUSR_HOST' value=''/> +
-    <object type='property' name='SECUSR_LOGIN' value='admin'/> +
-    <object type='property' name='allowtotrash' value='1'/> +
-    <object type='property' name='allowtojob' value='1'/> +
-    <object type='property' name='SECUSR_SUPER' value='1'/> +
-    <object type='property' name='allowtoworkflow' value='1'/> +
-    <object type='property' name='allowtolink' value='1'/> +
-    <object type='property' name='allowtodashboard' value='1'/> +
-    <object type='property' name='allowtocorrection' value='1'/> +
-    <object type='property' name='SECUSR_MAIL' value='florian@ezdev.fr'/> +
-    <object type='property' name='SECUSR_VAL' value='@DBNULLVALUE'/> +
-    <object type='property' name='allowtosignbook' value='1'/> +
-    <object type='property' name='allowtohome' value='1'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_OPENMODE' value='archive'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_FTPPORT' value='21'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_FMTFLOAT' value='xx2xx.xx xx'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_GRIDLINES' value='20'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_THUMBBYPAGE' value='10'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_RESIZEBUTTONS' value='1'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_TOOLBARRIGHT' value='1'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_LANG' value='fr_FR'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_PARAPH_ORDERFLD' value='PARAPHSCN_LIB'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_FIXEDUSER' value='0'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_MULTIUSER' value='5'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_HEADERCOLLAPSED' value='1'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_FMTDATE' value='d-m-Y H:i:s'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_SCPSUBDIR' value=''/> +
-    <object subtype='string' type='property' name='SECUSRPAR_SCPDIR' value=''/> +
-    <object subtype='string' type='property' name='SECUSRPAR_FTPSUBDIR' value=''/> +
-    <object subtype='string' type='property' name='SECUSRPAR_CTLFINGERPRINTS' value='0'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_SKIN' value='default'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_FTPPATH' value=''/> +
-    <object subtype='string' type='property' name='SECUSRPAR_WAITSUBDIR' value=''/> +
-    <object subtype='string' type='property' name='SECUSRPAR_SCPHOST' value=''/> +
-    <object subtype='string' type='property' name='SECUSRPAR_HTTPPOSTPATH' value=''/> +
-    <object subtype='string' type='property' name='SECUSRPAR_PARAPH_ORDERDIR' value='D'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_FTPHOST' value=''/> +
-    <object subtype='string' type='property' name='SECUSRPAR_VIEWMODE' value='thumbs'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_HTTPPOSTHOST' value=''/> +
-    <object subtype='string' type='property' name='SECUSRPAR_OPENINNEWWINDOW' value='1'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_KEEPORIGINFORMAT' value='1'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_WAITDIR' value=''/> +
-    <object subtype='string' type='property' name='SECUSRPAR_HTTPPOSTPORT' value='80'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_UPLOADFILES' value='1'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_SPOOLDIR' value='C:\nchp\var\spool\ezged\instance'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_WF' value='1'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_OFFICE2PDF' value='1'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_PDF2OFFICE' value='1'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_THUMBSDIR' value='C:\nchp\var\spool\ezged\instance\thumbnailcache'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_EXTERNALADDRESS' value='http://192.168.1.104:80/ezged'/> +
-    <object subtype='string' type='property' name='SECUSRPAR_SMTPSERVER' value='smtp.orange.fr'/> +
-  </object> +
-  <object errorcode='-4' subtype='object' type='error'> +
-    <object subtype='str' type='property' name='desc' value='Impossible de se connecter avec admin, le nombre de sessions autorisées est atteint.'/> +
-  </object> +
-</object> +
-</file> +
- +
-===== sec/authenticatebysession ===== +
- +
-==== Description ==== +
- +
-Permet de s'authentifier sur le serveur GED en fournissant un id de session. +
- +
-==== URL ==== +
- +
-  http://<adresse_du_serveur>:<port>/sec/authenticatebysession/ +
-   +
-==== Paramètres ==== +
-  * **sessionid** //requis// Id de session EzGED. +
- +
-==== Retour ==== +
- +
-L'id de session ainsi que les paramètres utilisateurs. +
- +
-==== Exemples ==== +
- +
-===== doctbl/insertrow ===== +
- +
-==== Description ==== +
- +
-Insère une nouvelle ligne dans une table. +
- +
-==== URL ==== +
- +
-==== Paramètres ==== +
-  * **sessionid** //requis// ID de session EzGED. +
-  * **fields[i]** //// +
- +
-Nb: i est un indice de tableau (débute à 0). Le service acceptera aussi que soient envoyés les différents paramètres fields et values sans indices. Il faudra alors veillé à ce que l'ordre des valeurs corresponde à celui des champs ! +
- +
-==== Retour ==== +
- +
-<file xml retour.xml> +
-<?xml version='1.0' encoding='ISO-8859-15'?> +
-<object type='result'> +
-  <object subtype='doctbl' type='insertrow'> +
-    <object subtype='object' type='returnid'> +
-      <object type='property' name='RETID' value='101'/> +
-    </object> +
-  </object> +
-  <object errorcode='0' subtype='object' type='error'> +
-    <object subtype='str' type='property' name='desc' value='ok'/> +
-  </object> +
-</object> +
-</file> +
- +
-==== Exemples ==== +
- +
-Appel du service sans indicer les paramètres : +
-<code> +
-http://localhost:8080/doctbl/insertrow/?sessionid=1217328858&tfqn=courriers&fields=COURRIERS_OBJET&values=MAJ%20EzGED&fields=COURRIERS_FROM&values=florian +
-</code> +
- +
-Le même appel si on utilise les indices (l'ordre d'écriture des paramètres n'est plus important) : +
-<code> +
-http://localhost:8080/doctbl/insertrow/?sessionid=1217328858&tfqn=courriers&fields[0]=COURRIERS_OBJET&values[1]=florian&fields[1]=COURRIERS_FROM&values[0]=MAJ%20EzGED +
-</code> +
- +
-===== fsfile/multiloc ===== +
- +
-==== Description ==== +
- +
-Retourne les informations d'un fichier. +
- +
-==== URL ==== +
- +
-<code>http://<serveur_ezged>:<port>/fsfile/multiloc?sessionid=<id_de_session>&fsfileid=<id_du_fichier></code> +
-==== Paramètres ==== +
-  * **sessionid** //requis// ID de session EzGED. +
-  * **fsfileid** //requis// ID du fichier dans EzGED. +
- +
- +
-==== Exemples ==== +
-Avec l'appel suivant +
- +
-<code>http://localhost:8080/fsfile/multiloc?sessionid=409492697&fsfileid=12778</code> +
- +
-J'obtiens le retour suivant +
- +
-<file xml retour.xml> +
-<?xml version='1.0' encoding='ISO-8859-15'?> +
-<object type='result'> +
-  <object subtype='list' type='fileinfo'> +
-    <object subtype='object' type='fileinfo'> +
-      <object type='property' name='lock' value='admin'/> +
-      <object type='property' name='used' value='1'/> +
-      <object type='property' name='issuers' value='{}'/> +
-      <object type='property' name='sigpath' value=''/> +
-      <object type='property' name='ripe' value='18c3f9c86821ff505fa12f8f6283b37d17a68873'/> +
-      <object type='property' name='hassig' value='0'/> +
-      <object type='property' name='user' value='admin'/> +
-      <object type='property' name='fssigripe' value=''/> +
-      <object type='property' name='ostamp' value='2015-12-10 13:27:57'/> +
-      <object type='property' name='pages' value='0'/> +
-      <object type='property' name='dimensions' value='0'/> +
-      <object type='property' name='ext' value='pdf'/> +
-      <object type='property' name='mime' value='application/pdf'/> +
-      <object type='property' name='sigripe' value=''/> +
-      <object type='property' name='newripe' value='18c3f9c86821ff505fa12f8f6283b37d17a68873'/> +
-      <object type='property' name='path' value='c:\nchp\var\nchp\instance\EMDOM\DEFTSA\00000003\18\c3\470IVB56.pdf'/> +
-      <object type='property' name='size' value='187268'/> +
-      <object type='property' name='nstamp' value='2015-12-10 13:27:58'/> +
-      <object type='property' name='nname' value='470IVB56'/> +
-      <object type='property' name='oname' value='3TNCB759-stamp.pdf'/> +
-    </object> +
-  </object> +
-  <object subtype='list' type='paths'> +
-    <object subtype='object' type='path'> +
-      <object type='property' name='PATH' value='c:\nchp\var\nchp\instance\EMDOM\DEFTSA\00000003\18\c3\470IVB56.pdf'/> +
-      <object type='property' name='VALIDITY' value='1'/> +
-    </object> +
-  </object> +
-  <object errorcode='0' subtype='object' type='error'> +
-    <object subtype='str' type='property' name='desc' value='ok'/> +
-  </object> +
-</object> +
-</file> +
- +
-Retour dans le cas d'un fichier non trouvé dans le stockage: +
-<file xml retour.xml> +
-<?xml version='1.0' encoding='ISO-8859-15'?> +
-<object type='result'> +
-  <object subtype='list' type='fileinfo'/> +
-  <object subtype='list' type='paths'/> +
-  <object errorcode='-2' subtype='object' type='error'> +
-    <object subtype='str' type='property' name='desc' value='Fichier non trouvé dans le système de stockage'/> +
-  </object> +
-</object> +
-</file> +
- +
-===== doctbl/deleterowwfiles ===== +
- +
-==== Description ==== +
- +
-Supprime une fiche descriptive. +
- +
-Nb: Ne supprime pas les fichiers liés. +
- +
-==== URL ==== +
-<code>http://<adresse_du_serveur>:<port>/doctbl/deleterowwfiles?sessionid=<id_de_session>&tfqn=<table>&field_ID=<champ_clé_primaire>&value_ID=<valeur_clé_primaire></code> +
- +
-==== Paramètres ==== +
-  * **sessionid** //requis// - ID de session EzgED. +
-  * **tfqn** //requis// - Nom de la table sur laquelle se trouve la fiche à supprimer. +
-  * **field_ID** //requis// - Nom de champ de la clé primaire. +
-  * **value_ID** //requis// - Valeur de la clé primaire (i.e le RSID ou encore ID de la fiche descriptive). +
- +
-==== Exemples ==== +
-Appel: +
-<code>http://localhost:8080/doctbl/deleterowwfiles/?sessionid=409492697&tfqn=facture&field_ID=FACTURE_ID&value_ID=3</code> +
- +
-Retour : +
-<file xml retour.xml> +
-<?xml version='1.0' encoding='ISO-8859-15'?> +
-<object type='result'> +
-  <object subtype='doctbl' type='deleterowwfiles'/> +
-  <object errorcode='0' subtype='object' type='error'> +
-    <object subtype='str' type='property' name='desc' value='ok'/> +
-  </object> +
-</object> +
-</file> +
- +
-Si un des fichiers lié à la fiche descriptive est utilisé on aura le retour suivant: +
-<file xml retour.xml> +
-<?xml version='1.0' encoding='ISO-8859-15'?> +
-<object type='result'> +
-  <object subtype='doctbl' type='deleterowwfiles'/> +
-  <object errorcode='-10' subtype='object' type='error'> +
-    <object subtype='str' type='property' name='desc' value='A file attached is used in workflow or signbook'/> +
-  </object> +
-</object> +
-</file> +
- +
-===== Notes ===== +
- +
-En cas d'appel d'un web service avec un id de session qui n'est plus valide, le retour suivant sera obtenu +
-<file xml redirection.xml> +
-<?xml version='1.0' encoding='ISO-8859-15'?> +
-<object type='redirect'> +
-  <object subtype='object' type='redirection'/> +
-  <object errorcode='-1' subtype='object' type='error'> +
-    <object subtype='str' type='property' name='desc' value='redirected'/> +
-  </object> +
-</object> +
-</file> +
- +
-====== Tutoriaux Web Service ====== +
- +
-===== Sans Proxy ===== +
- +
-Les appels sont directement fait sur le serveur de service python. +
- +
-==== S'authentifier ==== +
- +
-On souhaite s'authentifier avec le login patrick et le mot de passe associé  +
- +
-==== Créer une nouvelle fiche ==== +
- +
-Supposons que nous ayons une table //courriers// ayant pour champs COURRIER_ID (la clé primaire), COURRIER_OBJET et COURRIER_EXPEDITEUR. +
-Si nous voulons ajouter une ligne et affecter les valeurs comme suit : +
- +
-COURRIER_OBJET : MAJ EzGED disponible\\ +
-COURRIER_EXPEDITEUR : EzDEV +
- +
-Il suffit alors d'appeler le web service doctbl/insertrow comme suit +
-  http://localhost:8080/doctbl/insertrow/?sessionid=187655380&tfqn=courriers&fields[0]=COURRIERS_OBJET&values[0]=MAJ EzGED disponible&fields[1]=COURRIERS_FROM&values[1]=florian +
- +
-Le web service nous renvoi l'id de la nouvelle ligne : +
-<file xml retour.xml> +
-<?xml version='1.0' encoding='ISO-8859-15'?> +
-<object type='result'> +
-  <object subtype='doctbl' type='insertrow'> +
-    <object subtype='object' type='returnid'> +
-      <object type='property' name='RETID' value='107'/> +
-    </object> +
-  </object> +
-  <object errorcode='0' subtype='object' type='error'> +
-    <object subtype='str' type='property' name='desc' value='ok'/> +
-  </object> +
-</object> +
-</file> +
- +
-L'élement qui nous intéresse est le suivant, dont l'attribut value contient la clé primaire de la fiche nouvellement créée. +
-  <object type='property' name='RETID' value='107'/> +
- +
-Cette clé nous permettra, lors de l'étape suivante, de rattacher un fichier à cette fiche descriptive. +
- +
-==== Ajouter des fichiers à une fiche ==== +
- +
-==== Envoyer un fichier sur le serveur ==== +
- +
-La première chose à faire est d'uploader le fichier sur le serveur EzGED. +
-Pour cela votre client doit envoyer une requête HTTP de type POST sur le serveur web via l'URL suivante : +
-  http://localhost/ezged3/data/pupload.php?mode=archive +
- +
-Le serveur renvoi la réponse au format JSON.  +
- +
-<code> +
-+
- "success":true, +
- "chunkpart":false, +
- "message":"File successfully uploaded.", +
- "filePath":"C:\\nchp\\var\\spool\\ezged\\instance\/enqueued\/albatros.pdf" +
-+
-</code> +
-==== Lier un fichier à une fiche ==== +
- +
-Nous avons tous les éléments nécessaires : +
- +
-Le chemin : **C:\\nchp\\var\\spool\\ezged\\instance\/enqueued\/albatros.pdf**\\ +
-Le rsid : **1009**\\ +
-La table : **test**\\ +
-La session : **743409468**\\ +
- +
-Il suffit alors d'appeler le web service d'ajout de pages à un docpak : +
- +
-  http://localhost:8080/docpak/addpages/?sessionid=743409468&tfqn=test&rsid=1009&file=C:\\nchp\\var\\spool\\ezged\\instance\/enqueued\/albatros.pdf&start=-1 +
- +
- +
-Le retour est au format XML : +
-<file xml reponse.xml> +
-<?xml version='1.0' encoding='ISO-8859-15'?> +
-<object type='result'> +
-  <object subtype='object' type='addpages'> +
-    <object subtype='int' type='property' name='JOBQUEUE_ID' value='8979'/> +
-  </object> +
-  <object errorcode='0' subtype='object' type='error'> +
-    <object subtype='str' type='property' name='desc' value='ok'/> +
-  </object> +
-</object> +
-</file> +
- +
-Ceci nous indique qu'un travail a bien été créé et que son identifiant est 8979. +
- +
-==== Surveiller l'avancée du travail ==== +
- +
-  http://localhost:8080/jobqueue/load/?sessionid=743409468&jobqueueid=8979 +
-   +
-Ci-dessous une partie (seulement les infos les plus pertinentes pour nous) de la réponse : +
- +
-<file xml reponse.xml> +
-    <object subtype='object' type='generic'> +
-      <object type='property' name='JOBQUEUE_PURGEABLE' value='1'/> +
-      <object type='property' name='JOBQUEUE_RUNMISSED' value='1'/> +
-      <object type='property' name='JOBQUEUE_ID' value='8979'/> +
-      <object type='property' name='JOBQUEUE_STARTTIME' value='@DBNULLVALUE'/> +
-      <object type='property' name='JOBQUEUE_ACTIVE' value='1'/> +
-      <object type='property' name='JOBQUEUE_TSTAMP' value='@DBNULLVALUE'/> +
-      <object type='property' name='JOBQUEUE_STATUS' value='0'/> +
-      <object type='property' name='JOBQUEUE_SECUSRID' value='1'/> +
-    </object> +
-  </object> +
-  <object errorcode='0' subtype='object' type='error'> +
-    <object subtype='str' type='property' name='desc' value='ok'/> +
-  </object> +
-</object> +
-</file> +
- +
-L'élément JOBQUEUE_STATUS nous donne le status du travail. +
- +
-^ Code status | Libellé     | Détails ^ +
-| 0           | NORMAL      | Le travail est en attente d'être traité par le serveur | +
-| 1           | EN FILE     | Le travail est en cours d'exécution | +
-| 2           | FINI PURGEABLE | Le travail est terminé, prêt à être nettoyé | +
-| 4           | ERREUR      | Le travail est en erreur | +
- +
dev/api/webservices.1458746509.txt.gz · Dernière modification : (modification externe)