Outils utilisateur

Outils du site Web


rest.php

rest.php

  • Interface REST avec authentification utilisateur
  • Authentification via HTTP BASIC Auth ou cookie de session
  • Chaque requête d'authentification de base ouvre une session et renvoie un cookie
  • Documentation de l'API REST

Authentification

Authentification HTTP BASIC

La requête est exécutée ici après une authentification réussie. Le client a besoin d'informations telles que l'archive.

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/

session

À partir de la version 2.2.2 de Benno Web, l'authentification via ID de session est également possible.

Créer une session

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.

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"}

Demande de recherche

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/
rest.php.txt Dernière modification : 04/02/2019 à 07:54 par lwsystems