-
Notifications
You must be signed in to change notification settings - Fork 7
API methods for the web GUI
Øyvind Hagberg edited this page Nov 7, 2019
·
7 revisions
These API methods exist mainly to support the web GUI, and are probably not useful for anything else.
Search files for content and return one page of hits, or all hits.
Available fields: You don't need to specify return fields for this function
Parameters:
-
q
: Text phrase to search for -
filename
: Which file to search (leave empty to search all files) -
page
: Which page number you want from all the results (default: 1) -
hitsPerPage
: Page size, i.e. number of hits per page (default: 10)
/api/v2/searchpage?q=Apples+and+oranges&page=1&hitsPerPage=10
-
/api/v2/searchpage?q=enterprise&hitsPerPage=all
(returns all results)
Example response data (the query here was "27")
{
"query": "27",
"numberOfHits": 3,
"page": 1,
"maxPage": 1,
"filenames": [
"/etc/redhat-release",
"/bin/uname -a",
"/usr/sbin/dmidecode -t system",
],
"hits": [
{
"fileId": 123,
"filename": "/etc/redhat-release",
"isCommand": false,
"excerpt": "Fedora release <em>27</em> (Twenty Seven)",
"hostname": "flyndre",
"certfp": "ABCD1234ABCD1234ABCD1234",
"displayNumber": 1
},
{
"fileId": 456,
"filename": "/bin/uname -a",
"isCommand": true,
"excerpt": "yndre 4.14.14-300.fc<em>27</em>.x86_64 #1 SMP Fri J",
"hostname": "flyndre",
"certfp": "DEFE3232DEFE3232DEFE3232",
"displayNumber": 2
},
{
"fileId": 789,
"filename": "/usr/sbin/dmidecode -t system",
"isCommand": true,
"excerpt": "0x0100, DMI type 1, <em>27</em bytes System Inform",
"hostname": "flyndre",
"certfp": "DCBA4321DCBA4321DCBA4321",
"displayNumber": 3
}
]
}
Retrieve the list of machines that are waiting to get manually approved to receive their first certificate.
Available fields: ipAddress
, reverseDns
, hostname
, approvalId
, received
, approved
Parameters: none
Example:
/api/v2/manualApproval?fields=ipAddress,reverseDns,hostname,approvalId,received,approved
Example response data
{
"manualApproval": [
{
"approvalId": 1,
"ipAddress": "127.0.0.1",
"reverseDns": "localhost",
"hostname": "somehost.local",
"received": "2018-02-13T08:18:08+01:00",
"approved": null
},
{
"approvalId": 2,
"ipAddress": "129.240.202.63",
"reverseDns": "callisto.uio.no",
"hostname": "somethingelse.local",
"received": "2018-02-13T08:18:08+01:00",
"approved": true
}
]
}
- Approve a machine:
PATCH /api/v2/manualApproval/<approvalId>
hostname=<hostname>&approved=true
- Reject a machine:
PATCH /api/v2/manualApproval/<approvalId>
approved=false
POST /api/v2/manualApproval
hostname=foo.example.com&ipAddress=1.2.3.4&approved=true