## API endpoints NetAlertX comes with a simple API. These API endpoints are static files, that are periodically updated based on your settings. ### When are the endpoints updated The endpoints are updated when objects in the API endpoints are changed. ### Location of the endpoints In the container, these files are located under the `/app/api/` folder. You can acces sthem via the `/php/server/query_json.php?file=user_notifications.json` endpoint. ### Available endpoints You can access the following files: | File name | Description | |----------------------|----------------------| | `notification_text.txt` | The plain text version of the last notification. | | `notification_text.html` | The full HTML of the last email notification. | | `notification_json_final.json` | The json version of the last notification (e.g. used for webhooks - [sample JSON](https://github.com/jokob-sk/NetAlertX/blob/main/front/report_templates/webhook_json_sample.json)). | | `table_devices.json` | The current (at the time of the last update as mentioned above on this page) state of all of the available Devices detected by the app. | | `table_plugins_events.json` | The list of the unprocessed (pending) notification events (plugins_events DB table). | | `table_plugins_history.json` | The list of notification events history. | | `table_plugins_objects.json` | The content of the plugins_objects table. Find more info on the [Plugin system here](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins)| | `language_strings.json` | The content of the language_strings table, which in turn is loaded from the plugins `config.json` definitions. | | `table_custom_endpoint.json` | A custom endpoint generated by the SQL query specified by the `API_CUSTOM_SQL` setting. | | `table_settings.json` | The content of the settings table. | | `app_state.json` | Contains the current application state. | Current/latest state of the aforementioned files depends on your settings. ### JSON Data format The endpoints starting with the `table_` prefix contain most, if not all, data contained in the corresponding database table. The common format for those is: ```JSON { "data": [ { "db_column_name": "data", "db_column_name2": "data2" }, { "db_column_name": "data3", "db_column_name2": "data4" } ] } ``` Example JSON of the `table_devices.json` endpoint with two Devices (database rows): ```JSON { "data": [ { "devMac": "Internet", "devName": "Net - Huawei", "devType": "Router", "devVendor": null, "devGroup": "Always on", "devFirstConnection": "2021-01-01 00:00:00", "devLastConnection": "2021-01-28 22:22:11", "devLastIP": "192.168.1.24", "devStaticIP": 0, "devPresentLastScan": 1, "devLastNotification": "2023-01-28 22:22:28.998715", "devIsNew": 0, "devParentMAC": "", "devParentPort": "", "devIcon": "globe" }, { "devMac": "a4:8f:ff:aa:ba:1f", "devName": "Net - USG", "devType": "Firewall", "devVendor": "Ubiquiti Inc", "devGroup": "", "devFirstConnection": "2021-02-12 22:05:00", "devLastConnection": "2021-07-17 15:40:00", "devLastIP": "192.168.1.1", "devStaticIP": 1, "devPresentLastScan": 1, "devLastNotification": "2021-07-17 15:40:10.667717", "devIsNew": 0, "devParentMAC": "Internet", "devParentPort": 1, "devIcon": "shield-halved" } ] } ```