The Golioth REST API provides access to all of your fleet’s data. The easiest way to test this out is through the Open API page on the Golioth Docs site.
The Open API Docs tool categorizes all of the available endpoints for easy viewing, and provides the opportunity to test them. Let’s walk through a quick example.
1. Generate an API key for your project
Generate your API key by navigating to the “API Keys” option in the left sidebar of the Golioth Web Console. Click the “Create” button, and the click “Create” in the modal window that pops up.
You will see a “Managing API Key” window that summarizes the api key process. Close this window and click on the “copy” icon next to the newly generated key
2. Authenticate the Open API Docs page using your api key
Navigate to the Golioth Open API Docs page and click on the “Authorize” button. Paste your api key into the box and click “Authorize”, then click “Close”
3. Query some LightDB data
Scroll down to the first entry in the “Light DB” section of the Open API Docs page. Click to unfold the entry, then click the “Try it out” button to enable fields for this API call. I have entered the following fields:
- projectId: Find this by clicking “Projects” in the left sidebar of the Golioth Web Console
- deviceId: Find this on the Device summary page for your target device
- LightDB path location: this is the JSON key for the data in the LightDB state you are trying to access
Click the “Execute” button and you will see both the curl command used to execute the query, as well as the response.
Code 200 indicates success. You can see the JSON object was returned with the expected data. For your reference, I set this data using the web console as follows:
This technique is an excellent starting point for building API queries. It requires no set up and you receive immediate confirmation that your query worked (or did not). I have used this to test out queries when setting up Android apps for controlling my IoT fleet, and to help in querying stored data for external analysis and graphing. But the Golioth REST API is far more powerful than this. It can be used to create a full-featured custom UI for your devices.