Request and Response Formats
The HydroTel Web Service uses HTTP GET requests with key-value parameters in the query portion of the URL. All requests must include the eg:
All correctly formed and authorised requests return a JSON Object with the first JSON pair "result". "result" will be either a JSON Object or a JSON Array depending on the request. For most requests, it will be a JSON Object if there are 0 or 1 results in the data set, otherwise it will be a JSON Array.
"result":[
{
"Site":2657,
"Name":"KISTERS NZ Office",
"LongName":"",
"TreeIndex":1
},
{
"Site":2922,
"Name":"Waikato Innovation Park Demo",
"LongName":null,
"TreeIndex":null
}
]
}
Requests that return an empty data set will show as an empty JSON Object in the "result" pair or in some cases as an empty JSON Array.
"result":{
}
}
{
"result":[
]
}
All Dates and Times are returned in ISO8601 format with no milliseconds and no reference to time zone (times in HydroTe are not referenced to a specific time zone).
Authentication
The HydroTel Web Service only accepts HTTP Basic Authentication. The username and password are the same as the ones used for the HydroTel Client.
Code Examples
All code examples are real URLs. Use the username guest and password guest to access the data in these examples.
Get Tree Items
Use Get Tree Items to list all items in the navigation tree under a given item.
Example request and response
"result":[
{
"Site":2657,
"Name":"HyQuest Solutions Office",
"LongName":"",
"TreeIndex":1
},
{
"Site":2922,
"Name":"Waikato Innovation Park Demo",
"LongName":null,
"TreeIndex":null
}
]
}
Parameters
Name | Type | Required | Accepted Values | Default Value | Description |
Level | String | Yes | District Catchment Site Object Point |
Defines the tree level of the items returned. | |
ParentID | Integer | Yes | The database ID of the Parent item. (If Level=District, this parameter is ignored) |
Result Object
Name | Type | Description |
District Catchment Site Object Point |
Integer | The database ID of the item. |
Name | String | The name of the item. |
LongName | String | The long name of the item. This can be null. |
TreeIndex | Integer | Lists the order the items should be displayed. When this is null items should be displayed in alphabetical order after all items with a non null TreeIndex. |
Get Item Details
Use Get Item Details to get the metadata for a District, Catchment, Site, Object or Point.
Example request and response
"result":{
"Site":2922,
"Name":"Waikato Innovation Park Demo",
"LongName":null,
"MapRef":"",
"Elevation":"",
"IconShape":1,
"IconBaseColour":1,
"SummaryEnable":true,
"WaveFile":"",
"LocationX":"-37.778497",
"LocationY":"175.309717",
"Area":"",
"ImageVersion":1,
"WebSkin":null,
"UserID":null,
"Description":null,
"ExtSysID":null,
"EstablishedDate":null
}
}
Parameters
Name | Type | Required | Accepted Values | Default Value | Description |
Level | String | Yes | District Catchment Site Object Point |
Defines the tree level of the item. | |
ItemID | Integer | Yes | The database ID of the item. |
Result Object
The result object is different for each level of the tree.
District
Name | Type | Description |
District | Integer | The database ID of the District. |
Name | String | The name of the District. |
LongName | String | The long name of the item. This can be null. |
ImageVersion | Integer | The version of the District image. This is an internal number that increments when the image is changed. This can be null. |
ExtSysID | String | Free format string field that can be used by external systems. This can be null. |
Catchment
Name | Type | Description |
Catchment | Integer | The database ID of the Catchment. |
Name | String | The name of the Catchment. |
LongName | String | The long name of the item. This can be null. |
ImageVersion | Integer | The version of the Catchment image. This is an internal number that increments when the image is changed. This can be null. |
ExtSysID | String | Free format string field that can be used by external systems. This can be null. |
Area | String | User definable string field to contain meta-data about the Catchment's area. This can be null. |
ImageTopLeftX | String | X Co-ordinate of the top left of the image. This can be null. |
ImageTopLeftY | String | Y Co-ordinate of the top left of the image. This can be null. |
ImageBotRightX | String | X Co-ordinate of the bottom right of the image. This can be null. |
ImageBotRightY | String | Y Co-ordinate of the bottom right of the image. This can be null. |
AutoPlaceSites | Boolean | Used for Auto-Placing sites on the image when the top-left and bottom-right co-ordinates are defined and sites have their co-ordinates defined. This can be null. |
Site
Name | Type | Description |
Site | Integer | The database ID of the Site. |
Name | String | The name of the Site. |
LongName | String | The long name of the item. This can be null. |
ImageVersion | Integer | The version of the Site image. This is an internal number that increments when the image is changed. This can be null. |
ExtSysID | String | Free format string field that can be used by external systems. This can be null. |
MapRef | String | User definable string field to contain meta-data about the Site's Map Reference. This can be null. |
Elevation | String | User definable string field to contain meta-data about the Site's Elevation. This can be null. |
LocationX | String | X Co-ordinate of the site. This can be null. |
LocationY | String | Y Co-ordinate of the site. This can be null. |
Area | String | User definable string field to contain meta-data about the Site's area. This can be null. |
Description | String | Description of the Site. This can be null. |
EstablishedDate | Date String | Date the site was established. This can be null. |
Object
Name | Type | Description |
Object | Integer | The database ID of the Object. |
Name | String | The name of the Object. |
LongName | String | The long name of the Object. This can be null. |
ExtSysID | String | Free format string field that can be used by external systems. This can be null. |
ObjectType | String | The name of the system type for this Object. |
ObjectVariant | String | The variant of the Object Type. |
IconX | Integer | The X-pixel co-ordinate for where the Object should be shown on the Site image. |
IconY | Integer | The Y-pixel co-ordinate for where the Object should be shown on the Site image. |
Point
Name | Type | Description |
Point | Integer | The database ID of the Point. |
Name | String | The name of the Point. |
LongName | String | The long name of the Point. This can be null. |
ExtSysID | String | Free format string field that can be used by external systems. This can be null. |
DeviceID | Integer | The database ID of the Device supplying data to this point. This can be null. |
DeviceName | String | The name of the Device supplying data to this point. This can be null. |
Identifier | String | The Device Identifier (channel) for this sensor. This can be null. |
CurValue | Double | The current value (most recent sample value) |
LastSampleTime | Date String | The most recent Sample date/time. |
Units | String | Engineering units. |
DispFormat | String | The standard C notation for the way sample values should be displayed. |
FirstSampleTime | Date String | The earliest Sample date/time. |
Get Logged Data
Use Get Logged Data to get the logged sample values for a Point or Site.
Example request and response
"result":[
{
"Point":9473,
"Name":"Rainfall",
"Data":[
{
"SampleValue":0,
"DT":"2015-11-01T10:30:00",
"Quality":1
},
......
{
"SampleValue":0.5,
"DT":"2015-10-22T00:45:00",
"Quality":1
}
]
"DataLimited":true,
"NextDT":"2015-10-22T00:30:00"
}
]
}
Parameters
Name | Type | Required | Accepted Values | Default Value | Description |
Point Site |
Integer | Yes | The database Point or Site identifier. If both Point and Site are given then Site is ignored. | ||
StartDT | Date String | No | 1 day earlier than the web server's current time | The start date of the requested data. | |
FinishDT | Date String | No | The end of the data for the current point | The end date of the requested data. |
Result Object
An array of Points with their database ID, Name and Logged Data in descending date order. Where more than 1000 records are retrieved the first 1000 records are retrieved and the pair "DataLimited":true is returned with the pair "NextDT":"DateString" to indicate the next sample time to request from.
Name | Type | Description | ||||||||||||
Point | Integer | The database ID of the Point. | ||||||||||||
Name | String | The Name of the Point. | ||||||||||||
Data | Array | The logged data. | ||||||||||||
|
||||||||||||||
DataLimited | Boolean | Indicates if the data was limited to the first 1000 records. Only present if the data has been limited. | ||||||||||||
NextDT | Date String | The date/time of the next sample that should be request (ie. the FinishDT of the next request). Only present if the data has been limited. | ||||||||||||
Get Image
Use Get Image to get the District, Catchment or Site Image.
Example request and response
"result":{
"Image":"/9j/4AAQSkZJRgABAQAAAQABAAD/2w ....... W1fU2VmtVqf/9k="
}
}
Parameters
Name | Type | Required | Accepted Values | Default Value | Description |
Level | String | Yes | District Catchment Site |
Defines the tree level of the items returned. | |
ItemID | Integer | Yes | The database ID of the item. |
Result Object
Name | Type | Description |
Image | String | Base64 encoded JPEG image. |
Get Notes
Use Get Notes to get the District, Catchment, Site or Point Notes.
Example request and response
"result":{
"Notes":"{\rtf1\fbidis\ansi ...... \fs16\par}"
}
}
Parameters
Name | Type | Required | Accepted Values | Default Value | Description |
Level | String | Yes | District Catchment Site Point |
Defines the tree level of the items returned. | |
ItemID | Integer | Yes | The database ID of the item. |
Result Object
Name | Type | Description |
Notes | String | The notes in either plain text or RTF format (depends on how they were entered into HydroTel). |
Get Latest Value
Use Get Latest Value to get the last logged sample value for a Point.
Example request and response
"result":[
{
"Point":9473,
"Name":"Rainfall",
"SampleValue":0
"DT":"2019-09-30T11:45:00",
"Quality":2
}
]
}
Parameters
Name | Type | Required | Accepted Values | Default Value | Description |
Point | Integer | Yes | The database Point identifier. | ||
Limit | Date String | No | Used to filter stale data. If included, Last Value will only be returned if more recent than the Limit specified |
Result Object
Name | Type | Description |
Point | Integer | The database ID of the Point. |
Name | String | The Name of the Point. |
SampleValue | Double | The raw sample value |
DT | Date String | The date/time for the sample. |
Quality | Integer | 1=Telemetered, 2=Imported, 3=Edited, 4=Partial (avg or sum), 5=Missing/Invalid. |