User tools

Website tools


rest.php

This is an old version of the document!


rest.php

Das Frontend rest.php implementiert das [rest_api|REST API]].

Es bietet die Authentisierung und Zugriffssteuerung einzelner Benutzer analog zum Web-UI.

  • Authentication via HTTP BASIC Auth or session cookie
  • Each BASIC AUTH request opens a session and returns a cookie

Examples

Authentisierung per HTTP BASIC Auth

The request is executed here upon successful authentication. The client needs information such as the archive.

curl -u admin:secret \
  --data 'filterQuery=(*)' \
  --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

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

Session Request

curl --cookie BENNOSID=c223e75ohpq5u1i0j9hhv36n60 \
  --data 'filterQuery=(*)' \
  --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.1483941166.txt.gz · Zuletzt geändert: 2017/01/09 05:52 von lwsystems