The User Experience Insight Developer Hub

Welcome to the User Experience Insight developer hub. You'll find comprehensive guides and documentation to help you start working with User Experience Insight as quickly as possible, as well as support if you get stuck. Let's jump right in!

Guides

Python API Example - Query Group and Sensor Status

Here is an example of a python 2.7 script to find a group of sensors, the status of the group and the status of the sensors.

#!/usr/bin/python2.7
import urllib
import urllib2
import json

## Define the app ID and API key variables
appID = 'request app ID via support'
apiKey = 'request API key via support'

## Define the node you want to lookup
nodeName = 'Singapore'

if __name__ == '__main__':

  # The API for all sensor groups
  url = 'https://api.capenetworks.com/v1/nodes'
  headers = { 'x-app-id' : appID, 'x-api-key' : apiKey }
  req = urllib2.Request(url,None,headers)
  response = urllib2.urlopen(req)

  # check if the response was successful
  if response.code == 200:

    # process the response
    result = json.loads(response.read())
    nodes = result['payload']['nodes']
    for node in nodes:
      if nodeName == node['name']:
        print node['name'],
        print node['state']
        sensors = node['state_summary']['sensors']
        for sensor in sensors:
          print '  '+sensor['name'],
          print '  '+sensor['state']

Example Output

Singapore warning
  Library   good
  Computer Lab B   good
  Computer Lab A   warning

Updated 5 months ago


Python API Example - Query Group and Sensor Status


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.