Table of Contents
Description
The locations discovery web service returns all locations defined in Oceans 2.0 which meet the filter criteria.
The primary purpose for the locations service is to find locations that have the data you are interested in and use the locationCode when requesting a data product using the dataProductDelivery web service.
A location is the parent of a DMAS an Oceans 2.0 Tree Node that , from which you can get data from. In the Oceans 2.0 Data Search GUI, a location is a Tree Node that contains device categories (Instruments by Location) or properties (Variables by Location) that can be selected to download data. From the DMAS Oceans 2.0 perspective, a location is a Search Tree Nodes Node that has one or more site devices and/or has one or more primary sensors. If there are multiple instruments of the same device category at a location, child-locations or pseudo-nodes will exist and can be pulled from any one of them. Device Categories can be either at the location or at the child-level, whereas Properties (variables) can only be at the location level, due to the 'Primary Sensor' concept, which stitches together data from multiple sensors over time at a location.
The primary purpose for locations service is to find locations that have the data you are interested in and use the locationCode when requesting a data product using the dataProductDelivery web service.
For a list For a list of available location codes, along with names and descriptions, see the Available Locations page.
...
See the External Web Services for method and token usage and error messages.
URL
No Format |
---|
http://data.oceannetworks.ca/api/locations |
Method | Description | Example |
---|---|---|
get | Retrieve a flat list locations metadata. |
|
getTree | Retrieve a Search Tree Node hierarchy of locations. | method=getTree |
get
The get method retrieves a list of location names and location codes.
...
Parameter | Type | Description | Example |
---|---|---|---|
Required | |||
token | string | All Web Services require a token. Once logged in at http://data.oceannetworks.ca/login, your token can be retrieved or generated at http://data.oceannetworks.ca/Profile. Click on the "Web Services" tab, then click "Generate Token". | token=5ba514e8-1203-428c-8835-879c8173e387 |
Optional | |||
locationCode | string | Return a single Location matching a specific Location Code
| locationCode=BACAX |
locationName | string | Return all of the Locations where the Location Name contains a keywordkeyword.
| locationName=mill |
deviceCategoryCode | string | Return all Locations that have devices belonging to a specific Device Category
| deviceCategoryCode=CTD |
deviceCode | string | Return all of the Locations where a specific Device has been deployed.
| deviceCode=AandOpt0581 |
propertyCode | string | Return all Locations that have devices with a sensor for a specific Property.
| propertyCode=differentialtemperature |
dataProductCode | string | Return all of the Locations that support a specific Data Product.
| dataProductCode=CPID |
deploymentBegin | datetime | Return all of the Locations that have a Deployment Beginning on or after a specific date/time.
Date Time format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
| deploymentBegin=2010-07-27T00:00:00.000Z |
deploymentEnd | datetime | Return all of the Locations that have a Deployment Ending on or before a specific date/time.
Date Time format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
| deploymentEnd=2016-08-01T00:00:00.000Z |
includeChildren | bool | Include all of the children of a location in the results.
| includeChildren=true |
Response
...
errorCode | errorMessage | Description |
---|---|---|
23 | Invalid Time Range, Start Time is greater that than End Time or start time is not provided | Occurs when the deploymentEnd is before the deploymentBegin date/time.
|
127 | Invalid parameter value | Occurs when an invalid code is used in the filter. Most filters require an exact match, otherwise this error will occur.
|
128 | Missing parameter | Occurs when multiple parameters are needed, but not all are present. Occurs when deploymentBegin is used without deploymentEnd.
|
129 | Invalid parameter name | Occurs when a filter parameter is used, but is not supported. |
...
The getTree method returns a hierarchical representation of the ONC Search Tree Nodes. The Search Tree is used in Oceans 2.0 to organize Instruments and Variables by Location so that users can easily drill down by place name or mobile platform name to find the instruments or properties they are of interested in.
Parameters
Parameter | Type | Description | Example |
---|---|---|---|
Required | |||
token | string | All Web Services require a token. This can be . Once logged in at http://data.oceannetworks.ca/login, your token can be retrieved or generated at http://dmasdata.uvicoceannetworks.ca/Profile. Click Click on the "Web Services" tab and , then click "Generate Token". | token=5ba514e8-1203-428c-8835-879c8173e387 |
Optional | |||
locationCode | string | A valid locationCode is needed. One can be found by simply running Run the service without this parameter to get a list of all locations.
| locationCode=BACAX |
Response
...
errorCode | errorMessage | Description |
---|---|---|
127 | Invalid parameter value | Occurs when an invalid code is used in the filter. Most filters require an exact match, otherwise this error will occur.
|
129 | Invalid parameter name | Occurs when a filter parameter is used, but is not supported. |
...
URL Examples
- Return a list of All of the Locations Locations (no filters)
http://data.oceannetworks.ca/api/locations?method=get&token=[YOUR_TOKEN_HERE]
...
http://data.oceannetworks.ca/api/locations?method=get&token=[YOUR_TOKEN_HERE]&locationCode=BACAX
- Return a list of all of the Locations including and below a location in the Tree View, with a at or below the Location Code of 'NEP' ('Northeast Pacific') in the Tree View
- This example returns the NEP location and all of it's its child locations, in a flat format. The In the results obtained from making the request, look for "hasDeviceData" and "hasPropertyData" properties in the results indicate if there is data at . These indicate whether property data and device data are available from that location. If both values are false, the location is a hierarchical tree node.
- Return a list of all of the Locations that have a Location Name which contains containing the string 'underwater'
- Return a list of all of the Locations that have devices with a Device Category of 'ADCP2MHZ'
- Return a list of all of the Locations with a Property Code of 'differentialtemperature'
- Return a list of all of the Locations with a Device Category of 'CTD' and Property Code of 'pressure'
- Return a list of all of the Locations where a device with a Device Code of 'NORTEKAQDPRO8398' has been deployed
- Return a list of all of the Locations that have instruments that support the Data Product Code of 'IBPP' ('Ice Buoy Profile Plots')
...
- Return a list of all of the Locations that have instruments that were Deployed Between July 1st 1 July 2010 and 30 June 30th 2012
...
- Return a list of all of the Locations which has instruments Deployed Between July 1st 1 July 2010 and 30 June 30th 2011 with a sensor for Property Code of 'seawatertemperature'
- Return the complete DMAS Oceans 2.0 Search Tree hierarchy
http://data.oceannetworks.ca/api/locations?method=getTree&token=[YOUR_TOKEN_HERE]
...
http://data.oceannetworks.ca/api/locations?method=getTree&token=[YOUR_TOKEN_HERE]&locationCode=ONC
- Return the DMAS Oceans 2.0 Search Tree hierarchy from at or below the 'Mobile Platforms' node and below
http://data.oceannetworks.ca/api/locations?method=getTree&token=[YOUR_TOKEN_HERE]&locationCode=MOBP
...
API Proxy
*NOTE: The http://data.oceannetworks.ca/apiproxy/locations url used in the above examples can be used in a browser for sharing and testing purposes; however, it can not be used from code, as it redirects to a login screen to capture your user id. In order to use the locations endpoint from code, you must use the http://data.oceannetworks.ca/api/locations url along with a valid token. Attempting to use the apiproxy url from code will result html returned in the payload which may cause errors or unexpected behavior.
...