Core API¶
-
POST
/login
¶ User login
Request Headers: - Content-Type –
application/json
Status Codes: - 200 OK – no error
- 404 Not Found – invalid username or password
- 500 Internal Server Error – internal error
- 406 Not Acceptable – username or password malformed or missing
- Content-Type –
Example request:
POST /login HTTP/1.1
Content-Type: application/json
{
"username": "alice",
"password": "foo!!"
}
Example response:
HTTP/1.0 200 OK
Server: temboard-agent/0.0.1 Python/2.7.8
Date: Wed, 22 Apr 2015 12:19:48 GMT
Content-type: application/json
{"session": "fa452548403ac53f2158a65f5eb6db9723d2b07238dd83f5b6d9ca52ce817b63"}
Error responses:
HTTP/1.0 404 Not Found
Server: temboard-agent/0.0.1 Python/2.7.8
Date: Wed, 22 Apr 2015 12:20:33 GMT
Content-type: application/json
{"error": "Invalid username/password."}
HTTP/1.0 406 Not Acceptable
Server: temboard-agent/0.0.1 Python/2.7.8
Date: Wed, 22 Apr 2015 12:21:01 GMT
Content-type: application/json
{"error": "Parameter 'password' is malformed."}
-
GET
/logout
¶ User logout
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session ID
- 500 Internal Server Error – internal error
- 406 Not Acceptable – session ID malformed
Example request:
GET /logout HTTP/1.1
X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK
Server: temboard-agent/0.0.1 Python/2.7.8
Date: Wed, 22 Apr 2015 12:33:19 GMT
Content-type: application/json
{"logout": true}
Error responses:
HTTP/1.0 401 Unauthorized
Server: temboard-agent/0.0.1 Python/2.7.8
Date: Wed, 22 Apr 2015 12:36:33 GMT
Content-type: application/json
{"error": "Invalid session."}
HTTP/1.0 406 Not Acceptable
Server: temboard-agent/0.0.1 Python/2.7.8
Date: Wed, 22 Apr 2015 12:37:23 GMT
Content-type: application/json
{"error": "Parameter 'X-Session' is malformed."}
-
GET
/discovery
¶ Get global informations about the environment
Status Codes: - 200 OK – no error
- 500 Internal Server Error – internal error
Example request:
GET /discover HTTP/1.1
Example response:
HTTP/1.0 200 OK
Server: temboard-agent/0.0.1 Python/2.7.8
Date: Wed, 22 Apr 2015 12:33:19 GMT
Content-type: application/json
{
"hostname": "neptune",
"pg_data": "/var/lib/postgresql/9.4/main",
"pg_port": 5432,
"plugins": ["monitoring", "dashboard", "pgconf", "administration", "activity", "maintenance", "statements"],
"memory_size": 8241508352,
"pg_version": "PostgreSQL 9.4.5 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.9.2-10ubuntu13) 4.9.2, 64-bit",
"cpu": 4
}
-
GET
/profile
¶ Get current username
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session ID
- 500 Internal Server Error – internal error
- 406 Not Acceptable – session ID malformed
Example request:
GET /profile HTTP/1.1
X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK
Server: temboard-agent/0.0.1 Python/2.7.8
Date: Wed, 22 Apr 2015 12:33:19 GMT
Content-type: application/json
{
"username": "alice"
}
Error responses:
HTTP/1.0 401 Unauthorized
Server: temboard-agent/0.0.1 Python/2.7.8
Date: Wed, 22 Apr 2015 12:36:33 GMT
Content-type: application/json
{"error": "Invalid session."}
HTTP/1.0 406 Not Acceptable
Server: temboard-agent/0.0.1 Python/2.7.8
Date: Wed, 22 Apr 2015 12:37:23 GMT
Content-type: application/json
{"error": "Parameter 'X-Session' is malformed."}
-
GET
/notifications
¶ Get all notifications from the agent.
Query Parameters: - key – Agent’s key for authentication (optional)
Request Headers: - X-Session – Session ID
Status Codes: - 200 OK – no error
- 401 Unauthorized – invalid session ID
- 500 Internal Server Error – internal error
- 406 Not Acceptable – session ID malformed
Example request:
GET /notifications HTTP/1.1
X-Session: 3b28ed94743e3ada57b217bbf9f36c6d1eb45e669a1ab693e8ca7ac3bd070b9e
Example response:
HTTP/1.0 200 OK
Server: temboard-agent/0.0.1 Python/2.7.8
Date: Wed, 22 Apr 2015 12:33:19 GMT
Content-type: application/json
[
{"date": "2016-04-11T16:12:38", "username": "alice", "message": "Login"},
{"date": "2016-04-11T16:02:03", "username": "alice", "message": "Login"},
{"date": "2016-04-11T15:50:57", "username": "alice", "message": "PostgreSQL reload"},
{"date": "2016-04-11T15:48:50", "username": "alice", "message": "PostgreSQL reload"}
]
Error responses:
HTTP/1.0 401 Unauthorized
Server: temboard-agent/0.0.1 Python/2.7.8
Date: Wed, 22 Apr 2015 12:36:33 GMT
Content-type: application/json
{"error": "Invalid session."}
HTTP/1.0 406 Not Acceptable
Server: temboard-agent/0.0.1 Python/2.7.8
Date: Wed, 22 Apr 2015 12:37:23 GMT
Content-type: application/json
{"error": "Parameter 'X-Session' is malformed."}
-
GET
/status
¶ Get informations about the agent
Status Codes: - 200 OK – no error
- 500 Internal Server Error – internal error
Example request:
GET /status HTTP/1.1
Example response:
HTTP/1.0 200 OK
Server: temboard-agent/2.0+master Python/2.7.5
Date: Fri, 15 Jun 2018 13:42:57 GMT
Access-Control-Allow-Origin: *
Content-type: application/json
{
"start_datetime": "2018-06-15T15:42:42",
"version": "2.0+master",
"user": "postgres",
"reload_datetime": "2018-06-15T15:42:42",
"pid": 32669,
"configfile": "/etc/temboard-agent/temboard-agent.conf"
}