30MHz provides a REST API to access the data collected by 30MHz via web checks and sensors.
To use it, you will need to create an API key. You can do this by going to Account Settings, and select the tab Developer.
Click on the Request new API key button.
A popup window will appear showing the API key, which you can copy and use to connect to the API.
The API documentation can be found at https://api.30mhz.com/api/swagger. There are two 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 30MHz dashboard, Account Settings, at the Organization tab
Alternatively, you can find your organization id from the url at the 30MHz page:
Download a free version of postman here. Open the application and fill in the required fields:
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: Bearer <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: Bearer <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 on the converter page. The result should look like this: