Working with Data

Devices can securely store data on the BlackBerry IoT Platform. Data is organized in a standard (group of schemas) called default. There are no other standards available. Within the standard, there are categories (a schemas) for the data objects (or pieces of data) that you want to store. You can define application-specific data objects and the fields and values within that data object. Those custom fields become your application-specific schema for that category. You can use JSON notation to access fields within data objects.

Understanding data schemas

The default standard supports these categories:

Note: For standard, you can specify only default or an empty string ("").

Putting data in the cloud

To create a data object for a device using the REST API, you create a JSON object and pass it as part of the body for in a POST command.

Here's an example of how to update a data object:

  curl -H "Content-Type: application/json" -X POST -d '{ "standard": "",  "category": "state", "data": [{"id": "Mydata","recorded_on": 1430482332000,"values":  {"fuelLevel":"28"}}]}'[dvice UUID] -H "Authorization: Bearer [access token]"

Consuming data

To read data, you require the proper privileges to the data. Devices always read their own data, so no additional privileges are required. Where it gets tricky is setting up the proper capabilities to permit other devices to read your devices data.

At minimum, your device must be given the capability on another device to read its data.

Here's an example of how to get the application entity when a provided an API KEY:

curl -X GET  -d "api_key"="[API KEY of the application]" -H "Authorization:Bearer [access token]"

Searching for Data

BlackBerry IoT Platform can easily store data for many millions of devices. As you can imagine, that may make it difficult to find specific information that you may require. For instance, you might need to find specific information about states on a device, such as which devices require servicing. Fortunately, in the administration console, you can search for information using the Search box found on most pages.

The administration console's search functionality is built using the BlackBerry IoT Platform HTTPS REST API. Specifically, it's built using the Search API. You can use the Search API to also build applications to search on data and even analyze the data store in BlackBerry IoT Platform. This API makes it easy to build dashboards and applications directly . For example, you can run a REST API search using this curl command to search location data for Waterloo :

curl -H "Content-Type: application/json" -H "Authorization: Bearer {access_token}" -X POST -d '{"query": {"query_string": {"query": " Waterloo AND id: location.status"}}}'{app_id}

Searching for data in the administration console

In the administration console, you can search for information using in the following search box found on most pages in the administration console. For a basic search, you can type some text, click the Search button (located to the right of the Search box), and your results are shown in the results list.


In addition, to the Search box, you can filter the information on some pages. For example, you can filter the devices shown in the results based on the type of application running on the device. Example

For more information about using the Search filters, see Using the Administration Console.

Searching in the administration console is easy. By default, data results are returned for certain fields when text is typed. Here are some searches that you can do on various pages in the administration console by simply typing text:

Administration console page Field
Users user ID
Applications application name and description
Devices device name and identifier
Devices > device name > States device ID and type
Devices > device name > Capabilities (Caps Grants) name and granted to
Devices > device name > Capabilities (Caps Has) name and target
Tags tag name and description
Files filename and description

For more advanced searches, you can add the following characters to the Search box with your search string:

Built application to analyze BlackBerry IoT Platform data

As you can imagine, using the search functionality can be very powerful—especially for analytics. Available in the BlackBerry IoT Platform HTTPS REST API is a Search API. You can use this API to create powerful applications that find all the users connected to BlackBerry IoT Platform in a geographical area. You can further refine the searches depending on what data is stored for the devices.

Here's an example of an application built using the HTTPS REST Search APIs. Example

The application searches for devices connected to the BlackBerry IoT Platform. The search results are refined based on the location of the device, the age of the user associated with the device, and the genre of music being played on each device.

You can perform searches on the data to put together interesting applications that use the data stored in the BlackBerry IoT Platform. For more information about the Search API, see the HTTPS REST API documentation.