Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In this example, we are requesting a list of system settings, but requests for different information may be made by modifying the path of the request URL (shown in bold text in the following example).

Code Block
import urllib2, sys
def auth(hostname,username,password):
url = “https://%s:8080/” % (hostname)
password _ mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
handler = urllib2.HTTPBasicAuthHandler(password _ mgr)
opener = urllib2.build _ opener(handler)
urllib2.install _ opener(opener)
password _ mgr.add _ password(None, url, username, password)
def get _ settings(hostname):
url = "https://%s:8080/settings" % (hostname) #url path to request settings
try:
req = urllib2.urlopen(url)
return req.read()
except urllib2.HTTPError, e:
print "HTTP error: %s" % e.code
except Exception, e:
print e
return ""
if _ _ name _ _ == "_ _ main _ _":
try:
hostname = sys.argv[1]
except:
print "usage: settingsAPI.py [IP address or hostname]"
sys.exit(1)
auth(hostname,"techrep","3MeDeee")
settingsxml = get _ settings(hostname)

Headers and Responses

The information below will apply to most 3VR REST API routes. 3VR is in the process of unifying and normalizing its API, so the 3VR REST API routes marked with an asterisk (*) are those still in need of updating. For now, their response will be in XML and they will not take the 'Accept' request header, but will do so in the future.

...

Code Block
?regions=true if included, the returned list of appliances will be arranged in regions

Sample XML Response

...

Code Block
languagepy
<ArrayOfApplianceInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ApplianceInfo>
<Id>1</Id>
<Name>3VR Enterprise Appliance</Name>
<Address>10.100.2.22</Address>
<MachineType>EnterpriseServer</MachineType>
<TimeZoneKey>Pacific Standard Time</TimeZoneKey>
<TimeZoneOffset>480</TimeZoneOffset>
<Created>0001-01-01T00:00:00</Created>
<Updated>2012-07-26T00:42:04</Updated>
<VideoStart>0001-01-01T00:00:00</VideoStart>
<SyncDate>2012-07-02T11:00:14</SyncDate>
<ObjectType>appliance</ObjectType>
</ApplianceInfo>
<ApplianceInfo>
<Id>2</Id>
<Name>Lake Merritt Branch</Name>
<Address>10.100.2.202</Address>
<MachineType>Integrated</MachineType>
<TimeZoneKey>Pacific Standard Time</TimeZoneKey>
<TimeZoneOffset>480</TimeZoneOffset>
<Created>2011-04-26T18:37:30</Created>
<Updated>2012-07-27T08:56:51</Updated>
<VideoStart>2011-04-26T18:46:35</VideoStart>
<SyncDate>2012-07-27T08:56:51</SyncDate>
<ObjectType>appliance</ObjectType>
</ApplianceInfo>
</ArrayOfApplianceInfo>

Sample JSON Response

...

Code Block
languagejson
[
{
Id: 1,
Name: "3VR Enterprise Appliance",
Address: "10.100.2.22",
MachineType: "EnterpriseServer",
TimeZoneKey: "Pacific Standard Time",
TimeZoneOffset: 480,
Created: "/Date(-62135568000000)/",
Updated: "/Date(1343549702000)/",
VideoStart: "/Date(-62135568000000)/",
SyncDate: "/Date(1341252014000)/",
ObjectType: "appliance"
},
{
Id: 2,
Name: "Lake Merritt Branch",
Address: "10.100.2.202",
MachineType: "Integrated",
TimeZoneKey: "Pacific Standard Time",
TimeZoneOffset: 480,
Created: "/Date(1303868250000)/",
Updated: "/Date(1343673311000)/",
VideoStart: "/Date(1303868795000)/",
SyncDate: "/Date(1343673311000)/",
ObjectType: "appliance"
}
]

...

Code Block
https://[IP address or hostname]:[port]/health

...

Sample XML Response

...

Code Block
languagexml
<?xml version="1.0" ?>
<ArrayOfHealthAlertInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<HealthAlertInfo>
<DisplayLabel>Camera or Camera Connection Failure</DisplayLabel>
<Id>3</Id>
<StartTime>2012-06-20T11:24:10</StartTime>
<EndTime>2012-07-27T04:03:55</EndTime>
<Message>Camera '1. Shipping Room' is not sending video.</Message>
</HealthAlertInfo>
</ArrayOfHealthAlertInfo>

...

Code Block
https://[IP address or hostname]:[port]/enterprisehealth

...

...

Sample XML Response

Code Block
languagexml
<ArrayOfEnterpriseHealthAlertInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<EnterpriseHealthAlertInfo>
<ApplianceId>2</ApplianceId>
<ApplianceName>Lake Merritt Branch</ApplianceName>
<ApplianceAddress>10.100.2.202</ApplianceAddress>
<DisplayLabel>Camera or Camera Connection Failure</DisplayLabel>
<Id>6</Id>
<StartTime>2012-06-11T22:32:45</StartTime>
<EndTime>2012-07-27T15:03:55</EndTime>
<TriggerTime>2012-06-11T23:32:45</TriggerTime>
<Message>Camera '7. Mercado' is not sending video.</Message>
</EnterpriseHealthAlertInfo>
<EnterpriseHealthAlertInfo>
<ApplianceId>2</ApplianceId>
<ApplianceName>Lake Merritt Branch</ApplianceName>
<ApplianceAddress>10.100.2.202</ApplianceAddress>
<DisplayLabel>Camera or Camera Connection Failure</DisplayLabel>
<Id>7</Id>
<StartTime>2012-06-11T22:32:45</StartTime>
<EndTime>2012-07-27T15:03:55</EndTime>
<TriggerTime>2012-06-11T23:32:45</TriggerTime>
<Message>Camera '6. Caja' is not sending video.</Message>
</EnterpriseHealthAlertInfo>
</ArrayOfEnterpriseHealthAlertInfo>

/appliancemetadata*

Code Block
https://[IP address or hostname]:[port]/appliancemetadata

...

Sample XML Response

...

Code Block
languagexml
Sample Response XML
<InfoCollectionOfMetadataInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Infos>
<MetadataInfo>
<Guid>d4fd02e5-d035-4d7e-9aa4-2535a561a748</Guid>
<Name>Custom Text Field</Name>
<Value>Test Value</Value>
</MetadataInfo>
<MetadataInfo>
<Guid>d4fd02e5-d035-4d7e-9aa4-2535a561a748</Guid>
<Name>Custom Number Field</Name>
<Value>12</Value>
</MetadataInfo>
</Infos>
</InfoCollectionOfMetadataInfo>

/settings*

Code Block
https://[IP address or hostname]:[port]/settings

...

Sample XML Response

...

Code Block
languagexml
<InfoCollectionOfSettingDefinitionInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Infos>
<SettingDefinitionInfo>
<Id>1</Id>
<Name>AdminEMail</Name>
<Category>Email</Category>
<ChannelId>0</ChannelId>
</SettingDefinitionInfo>
<SettingDefinitionInfo>
<Id>2</Id>
<Name>AllowLocalCaseManagement</Name>
<Category>General</Category>
<ChannelId>0</ChannelId>
</SettingDefinitionInfo>
<SettingDefinitionInfo>
<Id>3</Id>
<Name>BackupMedia</Name>
<Category>General</Category>
<ChannelId>0</ChannelId>
</SettingDefinitionInfo>
</SettingDefinitionInfo>
...
</Infos>
</InfoCollectionOfSettingDefinitionInfo>

/settingvalue*

Code Block
https://[IP address or hostname]:[port]/settingvalue

...

Sample XML Response

...

Code Block
languagexml
<InfoCollectionOfSettingValueInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Infos>
<SettingValueInfo>
<Id>20</Id>
<Value>false</Value>
<ComponentId>5</ComponentId>
</SettingValueInfo>
</Infos>
</InfoCollectionOfSettingValueInfo>

/channelinfo*

Code Block
https://[IP address or hostname]:[port]/channelinfo

...

Code Block
languagexml
<InfoCollectionOfChannelInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Infos>
<ChannelInfo>
<Name>Street View</Name>
<Number>4</Number>
<Id>19</Id>
<ChannelDriverName>GenericIPCameraDriver</ChannelDriverName>
<PtzState>2</PtzState>
<IsActive>false</IsActive>
<ChannelType>3</ChannelType>
</ChannelInfo>
<ChannelInfo>
<Name>Classroom</Name>
<Number>5</Number>
<Id>20</Id>
<ChannelDriverName>GenericIPCameraDriver</ChannelDriverName>
<PtzState>2</PtzState>
<IsActive>false</IsActive>
<ChannelType>3</ChannelType>
</ChannelInfo>
...
</Infos>
</InfoCollectionOfChannelInfo>

/hosts

Code Block
https://[IP address or hostname]:[port]/hosts

...

Sample XML Response

...

Code Block
languagexml
<ArrayOfHostsInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.
w3.org/2001/XMLSchema">
<HostsInfo>
<Label>Lake Merritt Branch</Label>
<Id>2</Id>
</HostsInfo>
<HostsInfo>
<Label>Mission District Branch</Label>
<Id>3</Id>
</HostsInfo>
</ArrayOfHostsInfo>

...

Code Block
https://[IP address or hostname]:[port]/person/

Sample XML Response

Code Block
languagexml
<?xml version="1.0" encoding="utf-8"?> <ThreeVRDbSync version="7.0" sourceSystem="">
<Persons>
<Person primarykey="Id">
<simplefield name="Id" value="1"/>
<simplefield name="FirstName" value="John"/>
<simplefield name="LastName" value="Smith"/>
<simplefield name="LastSeen" value="2013-03-02T21:22:32-05:00"/>
<simplefield name="FirstSeen" value="2013-03-02T21:22:32-05:00"/>
<simplefield name="UseForAutoMatch" value="false"/>
<complexfield name="Group">
<values>
<value>
<simplefield name="objectName" value="Imported People"/>
<simplefield name="Description" value="Imported People"/>
<simplefield name="AutoMatchType" value="UsePersonAutoMatchSetting"/>
</value>
</values>
</complexfield>
<image format="jpeg" width="303" height="300">
[IMAGE DATA]
</image>
</Person>
<Person primarykey="Id">
<simplefield name="Id" value="2"/>
<simplefield name="FirstName" value="Julie"/>
<simplefield name="LastName" value="Smith"/>
<simplefield name="LastSeen" value="2013-03-02T21:22:33-05:00"/>
<simplefield name="FirstSeen" value="2013-03-02T21:22:33-05:00"/>
<simplefield name="UseForAutoMatch" value="false"/>
<complexfield name="Group">
<values>
<value>
<simplefield name="objectName" value="Employees"/>
<simplefield name="Description" value="Employees"/>
<simplefield name="AutoMatchType" value="UsePersonAutoMatchSetting"/>
</value>
</values>
</complexfield>
<simplefield name="Employee ID" value="80"/>
<simplefield name="Employee Type" value="Full Time"/>
<simplefield name="Gender" value="Female"/>
<simplefield name="Hair Color" value="Black"/>
<image format="jpeg" width="280" height="280">
[IMAGE DATA]
</image>
</Person>
</Persons>
</ThreeVRDbSync>

/livevideo

Code Block
https://[IP address or hostname]:[port]/livevideo

...

Sample Response

...

/video

Code Block
https://[IP address or hostname]:[port]/video/

WILL BE DEPRECATED IN NEXT RELEASE, USE /channels

Returns stored video from the camera with the given camera number and options (start time, end time, length, framerate, and/or resolution). Note: Datetime values are formatted according to the ISO 8601 specification: YYYY-MM-DDTHH:MM:SS For example, 2012-12-05T13:40:27. For more information, see this article from the W3C W3.org: Date and Time Formats.

...

/event*

Code Block
https://[IP address or hostname]:[port]/event/

...

Sample Response

...

/liveimage

Code Block
https://[IP address or hostname]:[port]/liveimage/

...

Sample Response

...

/channels

Code Block
https://[IP address or hostname]:[port]/channel

...