Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| dev:api:webservices [2016/03/23 15:21] – créée florian | dev:api:webservices [2023/03/17 09:56] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | Template: | + | [[dev:api]] |
| - | + | ||
| - | < | + | |
| - | ===== classe/ | + | |
| - | + | ||
| - | ==== Description ==== | + | |
| - | + | ||
| - | ==== URL ==== | + | |
| - | + | ||
| - | ==== Paramètres ==== | + | |
| - | + | ||
| - | ==== Retour ==== | + | |
| - | + | ||
| - | ==== Exemples ==== | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | ======= Web Services EzGED ======= | + | |
| - | Les web services EzGED constituent l'API ouverte permettant de s' | + | |
| - | + | ||
| - | ====== 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: | + | |
| - | + | ||
| - | ====== Liste des services ====== | + | |
| - | + | ||
| - | ===== sec/ | + | |
| - | + | ||
| - | ==== Description ==== | + | |
| - | + | ||
| - | Permet de s' | + | |
| - | + | ||
| - | ==== URL ==== | + | |
| - | + | ||
| - | http://< | + | |
| - | + | ||
| - | ==== Paramètres ==== | + | |
| - | + | ||
| - | * **login** //requis// - Le nom de compte avec lequel s' | + | |
| - | * **pwd** | + | |
| - | * **domain** - Nom de domaine du serveur LDAP auprès duquel on doit s' | + | |
| - | * **realip** - Adresse IP à comparée avec le paramètre [[|SECUSR_HOST]] s'il est définit. | + | |
| - | + | ||
| - | ==== Retour ==== | + | |
| - | + | ||
| - | L'id de session est | + | |
| - | + | ||
| - | < | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | ==== Exemples ==== | + | |
| - | + | ||
| - | Appel | + | |
| - | http:// | + | |
| - | + | ||
| - | Retour | + | |
| - | <file xml sec/ | + | |
| - | <?xml version=' | + | |
| - | <object type=' | + | |
| - | <object subtype=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | </ | + | |
| - | <object errorcode=' | + | |
| - | <object subtype=' | + | |
| - | </ | + | |
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | ===== sec/ | + | |
| - | + | ||
| - | ==== Description ==== | + | |
| - | + | ||
| - | Permet de s' | + | |
| - | + | ||
| - | ==== URL ==== | + | |
| - | + | ||
| - | http://< | + | |
| - | + | ||
| - | ==== Paramètres ==== | + | |
| - | * **sessionid** //requis// Id de session EzGED. | + | |
| - | + | ||
| - | ==== Retour ==== | + | |
| - | + | ||
| - | L'id de session ainsi que les paramètres utilisateurs. | + | |
| - | + | ||
| - | ==== Exemples ==== | + | |
| - | + | ||
| - | ===== doctbl/ | + | |
| - | + | ||
| - | ==== 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' | + | |
| - | + | ||
| - | ==== Retour ==== | + | |
| - | + | ||
| - | <file xml retour.xml> | + | |
| - | <?xml version=' | + | |
| - | <object type=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object type=' | + | |
| - | </ | + | |
| - | </ | + | |
| - | <object errorcode=' | + | |
| - | <object subtype=' | + | |
| - | </ | + | |
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | ==== Exemples ==== | + | |
| - | + | ||
| - | Appel du service sans indicer les paramètres : | + | |
| - | < | + | |
| - | http:// | + | |
| - | </ | + | |
| - | + | ||
| - | Le même appel si on utilise les indices (l' | + | |
| - | < | + | |
| - | http:// | + | |
| - | </ | + | |
| - | + | ||
| - | ===== fsfile/ | + | |
| - | + | ||
| - | ==== Description ==== | + | |
| - | + | ||
| - | Retourne les informations d'un fichier. | + | |
| - | + | ||
| - | ==== URL ==== | + | |
| - | + | ||
| - | < | + | |
| - | ==== Paramètres ==== | + | |
| - | * **sessionid** //requis// ID de session EzGED. | + | |
| - | * **fsfileid** //requis// ID du fichier dans EzGED. | + | |
| - | + | ||
| - | + | ||
| - | ==== Exemples ==== | + | |
| - | Avec l' | + | |
| - | + | ||
| - | < | + | |
| - | + | ||
| - | J' | + | |
| - | + | ||
| - | <file xml retour.xml> | + | |
| - | <?xml version=' | + | |
| - | <object type=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | </ | + | |
| - | </ | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | </ | + | |
| - | </ | + | |
| - | <object errorcode=' | + | |
| - | <object subtype=' | + | |
| - | </ | + | |
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | Retour dans le cas d'un fichier non trouvé dans le stockage: | + | |
| - | <file xml retour.xml> | + | |
| - | <?xml version=' | + | |
| - | <object type=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object errorcode=' | + | |
| - | <object subtype=' | + | |
| - | </ | + | |
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | ===== doctbl/ | + | |
| - | + | ||
| - | ==== Description ==== | + | |
| - | + | ||
| - | Supprime une fiche descriptive. | + | |
| - | + | ||
| - | Nb: Ne supprime pas les fichiers liés. | + | |
| - | + | ||
| - | ==== URL ==== | + | |
| - | < | + | |
| - | + | ||
| - | ==== 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: | + | |
| - | < | + | |
| - | + | ||
| - | Retour : | + | |
| - | <file xml retour.xml> | + | |
| - | <?xml version=' | + | |
| - | <object type=' | + | |
| - | <object subtype=' | + | |
| - | <object errorcode=' | + | |
| - | <object subtype=' | + | |
| - | </ | + | |
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | Si un des fichiers lié à la fiche descriptive est utilisé on aura le retour suivant: | + | |
| - | <file xml retour.xml> | + | |
| - | <?xml version=' | + | |
| - | <object type=' | + | |
| - | <object subtype=' | + | |
| - | <object errorcode=' | + | |
| - | <object subtype=' | + | |
| - | </ | + | |
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | ===== Notes ===== | + | |
| - | + | ||
| - | En cas d' | + | |
| - | <file xml redirection.xml> | + | |
| - | <?xml version=' | + | |
| - | <object type=' | + | |
| - | <object subtype=' | + | |
| - | <object errorcode=' | + | |
| - | <object subtype=' | + | |
| - | </ | + | |
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | ====== Tutoriaux Web Service ====== | + | |
| - | + | ||
| - | ===== Sans Proxy ===== | + | |
| - | + | ||
| - | Les appels sont directement fait sur le serveur de service python. | + | |
| - | + | ||
| - | ==== S' | + | |
| - | + | ||
| - | On souhaite s' | + | |
| - | + | ||
| - | ==== Créer une nouvelle fiche ==== | + | |
| - | + | ||
| - | Supposons que nous ayons une table // | + | |
| - | Si nous voulons ajouter une ligne et affecter les valeurs comme suit : | + | |
| - | + | ||
| - | COURRIER_OBJET : MAJ EzGED disponible\\ | + | |
| - | COURRIER_EXPEDITEUR : EzDEV | + | |
| - | + | ||
| - | Il suffit alors d' | + | |
| - | http:// | + | |
| - | + | ||
| - | Le web service nous renvoi l'id de la nouvelle ligne : | + | |
| - | <file xml retour.xml> | + | |
| - | <?xml version=' | + | |
| - | <object type=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | <object type=' | + | |
| - | </ | + | |
| - | </ | + | |
| - | <object errorcode=' | + | |
| - | <object subtype=' | + | |
| - | </ | + | |
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | L' | + | |
| - | <object type=' | + | |
| - | + | ||
| - | Cette clé nous permettra, lors de l' | + | |
| - | + | ||
| - | ==== Ajouter des fichiers à une fiche ==== | + | |
| - | + | ||
| - | ==== Envoyer un fichier sur le serveur ==== | + | |
| - | + | ||
| - | La première chose à faire est d' | + | |
| - | Pour cela votre client doit envoyer une requête HTTP de type POST sur le serveur web via l'URL suivante : | + | |
| - | http:// | + | |
| - | + | ||
| - | Le serveur renvoi la réponse au format JSON. | + | |
| - | + | ||
| - | < | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | </ | + | |
| - | ==== Lier un fichier à une fiche ==== | + | |
| - | + | ||
| - | Nous avons tous les éléments nécessaires : | + | |
| - | + | ||
| - | Le chemin : **C: | + | |
| - | Le rsid : **1009**\\ | + | |
| - | La table : **test**\\ | + | |
| - | La session : **743409468**\\ | + | |
| - | + | ||
| - | Il suffit alors d' | + | |
| - | + | ||
| - | http:// | + | |
| - | + | ||
| - | + | ||
| - | Le retour est au format XML : | + | |
| - | <file xml reponse.xml> | + | |
| - | <?xml version=' | + | |
| - | <object type=' | + | |
| - | <object subtype=' | + | |
| - | <object subtype=' | + | |
| - | </ | + | |
| - | <object errorcode=' | + | |
| - | <object subtype=' | + | |
| - | </ | + | |
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | Ceci nous indique qu'un travail a bien été créé et que son identifiant est 8979. | + | |
| - | + | ||
| - | ==== Surveiller l' | + | |
| - | + | ||
| - | http:// | + | |
| - | + | ||
| - | Ci-dessous une partie (seulement les infos les plus pertinentes pour nous) de la réponse : | + | |
| - | + | ||
| - | <file xml reponse.xml> | + | |
| - | <object subtype=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | <object type=' | + | |
| - | </ | + | |
| - | </ | + | |
| - | <object errorcode=' | + | |
| - | <object subtype=' | + | |
| - | </ | + | |
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | L' | + | |
| - | + | ||
| - | ^ Code status | Libellé | + | |
| - | | 0 | NORMAL | + | |
| - | | 1 | EN FILE | Le travail est en cours d' | + | |
| - | | 2 | FINI PURGEABLE | Le travail est terminé, prêt à être nettoyé | | + | |
| - | | 4 | ERREUR | + | |
| - | + | ||