How to get your data using the ZENSIE API
30MHz provides a REST API to access the data collected by ZENSIE via web checks and sensors.
To use it, you will need to create an API key. You can do this by going to the sidebar, click on Account Settings, and select the tab Developer.
Click on the “Request new API key” button.
A dialog will appear showing the API key, which you can copy and use to connect to the API.
API Documentation
The API documentation can be found at https://api.30mhz.com/api/swagger. There are two(2) ways to try the API; using postman, or through the command line.
Example using postman
In this example, we will show you how to use postman to get all the checks of your organization.
Go to swagger documentation and find the description of the endpoint that returns all checks of a given organization https://api.30mhz.com/api/swagger#!/check/getOrganizationChecks.
Note the URL you need to make the call, and the required fields. In this example the required field is the organization id.
To find your organization id, go to ZENSIE dashboard, Account Settings, at the Organization tab
Alternatively, you can find your organization id from the url at the ZENSIE page:
Download a free version of postman here. Open the application and fill in the required fields:
GET https://api.30mhz.com/api/check/organization/{{organization id}}
Headers
Authorization: {{your API key}}
Content-Type: application/json
The reply is a JSON object and it should look like this:
Example using the command line
Here we will show you how to get all checks from your organization using the command line:
- Open a command line interface (eg. Terminal for Mac, Command Prompt for Windows).
- The CURL command that you need for getting all checks of the organization is:
curl -XGET -H 'Content-Type: application/json' -H 'Authorization: your API key' https://api.30mhz.com/api/check/organization/example_id
If you want to save the output of the command in a file you can add at the end of the command >>output.txt
like this:
curl -XGET -H 'Content-Type: application/json' -H 'Authorization: your API key' https://api.30mhz.com/api/check/organization/example_id >>output.txt
The data stored in the output.txt file are in a json format. If you are not familiar with it and you want to see the data in a table format, you can use an online JSON to CSV converter (for example here).
Just copy the data from the output.txt file and paste them into the indicated field at the converter page. The result should look like this: