Example - Using the REST API to display number of users per geofence on a webpage
This example is written in HTML and PHP and uses the GpsGate REST API to retrieve information about existing geofences and number of users found in them and present it as a list. The attached example reloads every 10 seconds (unless changed) and can be added as a panel to your GpsGate UI.
- Webserver (i.e. Nginx, Apache, IIS) with support for PHP with CURL
- In GpsGate, have the REST API enabled
- In GpsGate, get an API token
- In GpsGate, have App Builder enabled
- Decompress the attached .zip file
- Change the parameters in settings.php
- Upload the files to the webserver
Add as a panel
- Go to Admin > Development > App Builder
- Create new app, add a name and select which roles that can access this app
- Add a Click Script of type WindowsMenu, add the following code:
ui.iframe("testKey","GeofenceUsers","https://<YOUR URL TO FILE>/geofenceusers.php",100,100,400,650);log("OK");
- Go to the main menu and Windows, you should now see your app listed there. Select it, the webpage should now be loaded in a window in the UI.
- Right click on the header bar and select Panel
- Save the workspace to have this panel opened every time you logon.