Smart+Connected Digital Platform API - Retrieving Real Time Device Data from the Smart+Connected Digital Platform API

Objectives

  • Explore retrieving domains and device information from Smart+Connected Digital Platform APIs
  • Building upon the previous lab, CDP 102, you will use the information you retrieved from Smart+Connected Digital Platform to make a domain specific request to get real time data from the Smart+Connected Digital Platform API.
    • Retrieve all of the Lights available from a Smart+Connected Digital Platform instance. This will return data about all of the Smart+Connected Digital Platform Lights that this user has access to
    • You can modify the request to retrieve real time data about other domains and device types

You can download the complete sample code project for this lab on GitHub: CiscoDevNet/scc-cdp-api-examples

Overview

Cisco Smart+Connected Digital Platform is a platform providing a rich API for retrieving information from connected cities and device collections. This includes sensor data as well as information about users, locations and capabilities of the current instance of the Cisco Smart+Connected Digital Platform. The API provides access to both real time and historical data from the connected sensors and devices.

CDP allows applications to get information about real time data using Thing Query Language (TQL). You can think of TQL as SQL for Internet of Things. In this example, we will use a very basic TQL script. You can read the TQL guide for more information about TQL and building more complicated queries.

In this lab we will retrieve real time device information available to the current user.

You can find documentation other information on the Cisco Smart+Connected Digital Platform DevNet Site

In order to complete this lab, you will need to make a reservation to access the Smart+Connected Digital Platform sandbox instance. You can make a reservation on the Cisco Smart+Connected Digital Platform DevNet sandbox page.

Smart+Connected Digital Platform API Requirements

All Smart+Connected Digital Platform APIs (except authentication) require access tokens. Before any of these APIs can be used, you must authenticate with Smart+Connected Digital Platform to get the tokens needed to make successful calls. You will also need the userId and customerId returned in the 2nd API request in the previous lab. See CDP 101 for information about authentication and retrieving the data needed for this lab:

  1. api_access_token
  2. app_access_token
  3. userId
  4. customerId

Lab Overview

We will examine a small sample Python script that demonstrates a real time device data Smart+Connected Digital Platform API request:

  1. The /devices/lighting API returns the locations available to the current user

This Learning Lab is comprised of one API call:

  1. Retrieve Real Time Device Information
    • Make a POST Request to the /devices/lighting Smart+Connected Digital Platform API with a TQL POST body
    • Create a simple visualization for the response