REST API overview
The endpoints your apps call, how to send the token and what comes back.
Your apps talk to OpenLogger over HTTP. Every address starts with your OpenLogger address, for example https://logs.example.com.
Endpoints
| Method and path | Token | What it does |
|---|---|---|
POST / | API token | Send a log. |
POST /api/ | Primary access token | Read, remove and clear logs. |
GET /api/download/ | Primary access token | Download the log file. |
Send the token
Send the token in one of two ways:
- in the
x-tokenheader:
curl -H "x-token: YOUR_TOKEN" -H "content-type: application/json" \
-d '{"app":"Demo project","type":"info","message":"User signed in"}' \
https://logs.example.com/- or as the
tokenquery argument:
curl -H "content-type: application/json" \
-d '{"app":"Demo project","type":"info","message":"User signed in"}' \
"https://logs.example.com/?token=YOUR_TOKEN"The header keeps the token out of server logs, so prefer it when your app can set headers.
Request formats
POST / accepts JSON (application/json) and form data (application/x-www-form-urlencoded):
curl -H "x-token: YOUR_TOKEN" \
-d "app=Demo project" -d "message=Nightly backup finished" \
https://logs.example.com/What comes back
A stored log answers 200:
{"success":true}Errors come back as a JSON array or, for a wrong token, an HTML page. See Errors.