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 - Sensors With an Ongoing Issue

Here is an example of a python 2.7 script to find sensors with an ongoing issue.

#!/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'

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 node['state'] != 'good':
        print node['name']
        sensors = node['state_summary']['sensors']
        for sensor in sensors:
          if sensor['state'] != 'good':
            print '  '+sensor['name']

Example Output

Sydney
  ComputerLab
Singapore
  Computer Lab A
Macao
  ScienceLab

Updated about a year ago


Python API Example - Sensors With an Ongoing Issue


Suggested Edits are limited on API Reference Pages

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