Soracom Harvest Data
Downloading Data
To download Harvest data, first open the Harvest Data screen for one or more devices by following the instructions from the Viewing Data documentation.
Below the chart, click the Download menu, then select the data format you want to download.
Once the data has been prepared, your download will begin automatically.
Note that you can only download up to one thousand lines of data at a time.
To extract more data, follow the steps in the Programmatic Usage section below.
Programmatic Usage
You can also use the Soracom API or Soracom CLI to download data.
Soracom API
To access the Soracom API, first use the auth API to obtain an API Key and Token. Refer to the API Reference Guide for instructions on how to use the API Key and Token in API requests.
Then, use the getDataFromSubscriber API to retrieve data uploaded from a subscriber to Harvest Data, specifying the subscriber IMSI in the request URL:
curl -X GET \
> -H "X-Soracom-API-Key: <MY-API-KEY>" \
> -H "X-Soracom-Token: <MY-TOKEN>" \
> -H "Accept: application/json" \
> https://g.api.soracom.io/v1/subsribers/<IMSI>/data
Data will be returned in JSON format:
[
{
"time": 1479350871000,
"contentType": "application/json",
"content": "{\"temperature\":20}"
},
{
"time": 1479350881000,
"contentType": "application/json",
"content": "{\"temperature\":25}"
},
{
"time": 1479350891000,
"contentType": "application/json",
"content": "{\"temperature\":20}"
}
]
You can use from
(Unix millliseconds), to
(Unix milliseconds), sort
(asc
or desc
), and limit
query parameters in the request URL, such as https://g.api.soracom.io/v1/subscribers/<IMSI>/data?from=<FROM>&to=<TO>&sort=asc&limit=100
in order to control the range of data.
You can also use the getDataFromSim API to retrieve the data for a SIM by using its SIM ID rather than its IMSI.
For other devices, you can use their corresponding API methods:
- Sigfox devices - getDataFromSigfoxDevice
- LoRa devices - getDataFromLoraDevice
- Inventory devices - getDataFromDevice
Soracom CLI
To use the Soracom CLI, you must first configure it to authenticate with your account information, authorization key, or SAM user credentials.
Then, run the following command to retrieve data uploaded from a subscriber to Harvest Data:
The CLI will return data in JSON format following the API example above.
Similar to the API usage, you can use the --from
, --to
, --sort
, and --limit
flags to control the range of data.
To retrieve data for a SIM by using its SIM ID rather than its IMSI, use the soracom sims get-data
command.
For other devices, you can use their corresponding commands:
- Sigfox devices -
soracom sigfox-devices get-data
- LoRa devices -
soracom lora-devices get-data
- Inventory devices -
soracom devices get-data