Outils utilisateur

Outils du site Web


rest.php

Différences

Les différences entre les deux versions sont indiquées ici.

Lien vers cette vue comparative

Les deux côtés de la révision précédenteRévision précédente
Prochaine révision
Révision précédente
rest.php [2017/01/09 05:58] – gelöscht lwsystemsrest.php [2019/02/04 07:54] (actuel) – [Session Request] lwsystems
Zeile 1: Zeile 1:
 +====== rest.php ======
 +
 +  * REST-Frontend mit Benutzer-Authentisierung
 +  * Authentisierung per HTTP BASIC Auth oder Session-Cookie
 +  * Jeder BASIC AUTH Request eröffnet eine Session und liefert einen Cookie zurück
 +  * Dokumentation des [[REST API]]
 +
 +
 +====== Authentisierung ======
 +
 +===== HTTP BASIC Auth =====
 +
 +Hier wird der Request bei erfolgreicher Authentisierung ausgeführt.
 +Der Client muss Informationen wie das Archiv kennen.
 +
 +<code bash>
 +curl -u admin:secret \
 +  --data start=0 \
 +  --data limit=20 \
 +  --data archive=BennoContainer \
 +  --data 'query=Text:*hallo*' \
 +  -D - -k https://mailarchiv.lw-systems.net/benno/rest.php/search/
 +</code>
 +
 +===== Session =====
 +
 +À partir de la version 2.2.2 de Benno Web, l'authentification via ID de session est également possible.
 +
 +==== Session erstellen ====
 +
 +Bei erfolgreichem Login wird ein User-Objekt mit den Userdaten und "Session-Name:Session-Id" als Wert des //password// Attributs zurück gegeben.
 +Das Attribut //archive// ist ein Array mit den Archiven, auf die der User Zugriff hat.
 +
 +<code bash>
 +curl -D - -k 'https://mailarchiv.lw-systems.net/benno/rest.php/login/?username=admin&password=secret'
 +
 +HTTP/1.1 200 OK
 +Date: Tue, 22 Nov 2016 14:24:11 GMT
 +Server: Apache/2.4.10 (Debian)
 +X-Powered-By: PHP/5.6.27-0+deb8u1
 +Set-Cookie: BENNOSID=c223e75ohpq5u1i0j9hhv36n60; path=/benno/rest.php
 +Expires: Thu, 19 Nov 1981 08:52:00 GMT
 +Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
 +Pragma: no-cache
 +Content-Length: 138
 +Content-Type: application/json; charset=UTF-8
 +
 +{"id":"admin","password":"BENNOSID:c223e75ohpq5u1i0j9hhv36n60","name":"Admin User","archive":["BennoContainer"],"addresses":["*@*"],"role":"ADMIN"}
 +</code>
 +
 +==== Search Request ====
 +
 +<code bash>
 +curl --cookie BENNOSID=c223e75ohpq5u1i0j9hhv36n60 \
 +  --data start=0 \
 +  --data limit=20 \
 +  --data archive=BennoContainer \
 +  --data 'query=Text:*hallo*' \
 +  -D - -k https://mailarchiv.lw-systems.net/benno/rest.php/search/
 +</code>
 +
  
rest.php.1483941487.txt.gz · Zuletzt geändert: 2017/01/09 05:58 von lwsystems