Most pages of openITCOCKPIT are based on our JSON API. You can use the web interface as an "API request generator" to find objects in openITCOCKPIT.
As authorization method, we highly recommend to use API keys!
1. API Keys
Create API Keys by editing your user profile and clicking on the "Create new API Key" button at the bottom of the page.
2. Connect to API with PHP (Example)
PHP example to connect to our API with the PHP GuzzleHTTP client.
3. Use paginator or scroll mode?
We are using two different modes to get ordered data from our lists.
Scroll mode (recommended)
We strongly recommend to use "scroll mode" for all API requests to index and search actions.
In scroll mode, the response will not contain an exact count of how many objects were found in the database for the given filters. So the API performance will be much better.
To determine if more records are available, the API will return a `hasNextPage` field.
To use scroll mode, add `scroll=true` the API URL.
Usage example: Get all hosts where output contains down
By default API requests are executed in Pagination mode. The API response will contain an exact count of
how many objects where found in the database.
Usage example: How many hosts are in state down.
4. Generate basic API requests using your web browser
It is easy to create create an API request for a index page to get a filtered list of objects.
To create an API URL for e.g. Hosts, use our filtering system at the "Hosts overview" page.
1. Set the desired filter options
2. Open the console in developer tools (press F12 in Firefox/Chrome) in your web browser
Enable XMLHttpRequest logs by clicking the XHR option in the console section.
3. Click the refresh button on the top of the filter box and get your custom API URL in the developer console
Open the shown URL in a new tab and you will get the filtered hosts in JSON format or click on the url and open the params section to get the API parameter.
To get the full API URL or the request headers click on the Headers section.