REST-API.md 2.42 KB
Newer Older
1 2 3 4 5 6 7 8 9
# Lemonldap::NG::Manager REST API

## Configurations

* List of available configuration: `/confs`
* Last configuration number: `/confs/latest/cfgNum`
* Configuration metadatas: `/confs/<cfgNum|latest>`
* Key value: `/confs/<cfgNum|latest>/<key>`
* Full configuration (for saving): `/confs/<cfgNum|latest>?full`
Xavier Guimard's avatar
Xavier Guimard committed
10
* Diff between 2 configurations: `/diff/<cfgNum1>/<cfgNum2>`
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36

Examples:

* `/confs/latest/portal`
* `/confs/184/portal`
* `/confs/184/virtualHosts/test1.example.com/locationRules`

### Available verbs:

* `GET`: see above
* `POST /confs`: push a new configuration (or a saved one)
  `POST /confs?force=yes`: push a new configuration even if another has been
  posted before
* _`DELETE /confs/<cfgNum>`: not allowed_, administrator has to push an older
  with `?force=yes`

**And perhaps:**

* `PUT /confs/prepared/<key>`: modify a value in the future configuration
* `DELETE /confs/prepared/<path>/<key>`: delete a hash entry (virtual host for
  example)
* `GET /confs/prepared/<key>`: get value from prepared configuration if exists,
  get current value otherwise

## Sessions

37 38 39 40 41 42
Note that global can be replaced by persistent to list persistent sessions.

* Sessions list: `/sessions/global`
* Session: `/sessions/global/<hash>`
* **TODO**: Session key: `/sessions/global/<hash>/<key>`
* Delete session: `DELETE /sessions/global/<hash>`
43 44
* Filters:
  * All connected users which username start by a letter:
45 46 47 48
    `/sessions/global?_whatToTrace=<letter>*&groupBy=_whatToTrace`
  * User's sessions: `/sessions/global?_whatToTrace=foo.bar`
  * IP's sessions: `/sessions/global?ip=1.2.3.4`
  * Double sessions by IP: `/sessions/global?doubleIP`
49
* Group by:
50
  * First letter of Connected users: `/sessions/global?groupBy=substr(_whatToTrace,1)`
51
* Order:
52
  * Sessions sorted by user: `/sessions/global?orderBy=_whatToTrace`
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68

Note that sessions are grouped automaticaly.

## Notifications

* Notifications list: `/notifications/actives`
* Notification: `/notifications/actives/<notif_id>`
* Notified elements list: `/notifications/done`
* Notified element: `/notifications/done/<notif_id>`
* New session: `POST /notifications`
* Filters:
  * All notifications for users which name starts by a letter:
    `/notifications?_whatToTrace=<letter>*&groupBy=_whatToTrace`
  * User's notifications: `/notifications/(actives|done)?_whatToTrace=foo.bar`
* Mark as notified: `PUT /notifications/actives/<notif_id> done=1`
* Delete notofication: `DELETE /notifications/done/<notif_id>`