The following samples illustrate how to use the properties discovery service to find the properties that are available that meet your criteria, so that you can use the propertyCode from the service response to request data using the dataProductDelivery service.


This example returns all of the properties and prints the results, one property at a time

import requests
import json
 
url = 'https://data.oceannetworks.ca/api/properties'
parameters = {'method':'get',
			'token':'YOUR_TOKEN_HERE'} # replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.
 
response = requests.get(url,params=parameters)   
if (response.ok):
    properties= json.loads(str(response.content,'utf-8')) # convert the json response to an object
    if not properties == []:
        for property in properties:
            print(property,'\n ')
    else:
        print('There are no results for your requested parameters.')
else:
	if(response.status_code == 400):
		error = json.loads(str(response.content,'utf-8'))
		print(error) # json response contains a list of errors, with an errorMessage and parameter
	else:
		print ('Error {} - {}'.format(response.status_code,response.reason))



url = ['https://data.oceannetworks.ca/api/properties' ...
        '?method=get' ...
        '&token=YOUR_TOKEN_HERE'];                          %replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.

request = matlab.net.http.RequestMessage;
uri = matlab.net.URI(url);
options = matlab.net.http.HTTPOptions('ConnectTimeout',60);
  
response = send(request,uri,options);
  
if (response.StatusCode == 200)    % HTTP Status - OK
    properties= response.Body.Data;
    for i=1:numel(properties)
        property = properties(i);
        disp(property);
    end
elseif (response.StatusCode == 400) % HTTP Status - Bad Request
    disp(response.Body.Data.errors);
else % all other HTTP Statuses
    disp(char(response.StatusLine));
end


library(httr)
r <- GET("https://data.oceannetworks.ca/api/properties", 
         query = list(method="get", 
                      token="YOUR_TOKEN_HERE")) #>replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.

if (http_error(r)) {
  if (r$status_code == 400){
    error = content(r)
    str(error)
  } else {
    str(http_status(r)$message)
  }
} else {
  properties= content(r)
  for (property in properties){
    str(property)
  }
}



This example returns the property for the propertyCode 'seawatertemperature' and prints the results.

Parameters:

  • proprtyCode=seawatertemperature
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/properties'
parameters = {'method':'get',
			'token':'YOUR_TOKEN_HERE', # replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.
			'propertyCode':'seawatertemperature'}
 
response = requests.get(url,params=parameters)   
if (response.ok):
    properties= json.loads(str(response.content,'utf-8')) # convert the json response to an object
    if not properties == []:
        for property in properties:
            print(property,'\n ')
    else:
        print('There are no results for your requested parameters.')
else:
	if(response.status_code == 400):
		error = json.loads(str(response.content,'utf-8'))
		print(error) # json response contains a list of errors, with an errorMessage and parameter
	else:
		print ('Error {} - {}'.format(response.status_code,response.reason))



url = ['https://data.oceannetworks.ca/api/properties' ...
        '?method=get' ...
        '&token=YOUR_TOKEN_HERE' ...                          %replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.
        '&propertyCode=seawatertemperature'];
request = matlab.net.http.RequestMessage;
uri = matlab.net.URI(url);
options = matlab.net.http.HTTPOptions('ConnectTimeout',60);
  
response = send(request,uri,options);
  
if (response.StatusCode == 200)    % HTTP Status - OK
    properties= response.Body.Data;
    for i=1:numel(properties)
        property = properties(i);
        disp(property);
    end
elseif (response.StatusCode == 400) % HTTP Status - Bad Request
    disp(response.Body.Data.errors);
else % all other HTTP Statuses
    disp(char(response.StatusLine));
end


library(httr)
r <- GET("https://data.oceannetworks.ca/api/properties", 
         query = list(method="get", 
                      token="YOUR_TOKEN_HERE", #>replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.
                      propertyCode="seawatertemperature"))

if (http_error(r)) {
  if (r$status_code == 400){
    error = content(r)
    str(error)
  } else {
    str(http_status(r)$message)
  }
} else {
  properties= content(r)
  for (property in properties){
    str(property)
  }
}



This example returns all of the properties which have the 'pressure' in the name and prints the results, one property at a time. The propertyName filter is case in-sensitive, so capitalized 'Pressure' will also be returned.

Parameters:

  • propertyName=pressure
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/properties'
parameters = {'method':'get',
			'token':'YOUR_TOKEN_HERE', # replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.
			'propertyName':'pressure'}
 
response = requests.get(url,params=parameters)   
if (response.ok):
    properties= json.loads(str(response.content,'utf-8')) # convert the json response to an object
    if not properties == []:
        for property in properties:
            print(property,'\n ')
    else:
        print('There are no results for your requested parameters.')

else:
	if(response.status_code == 400):
		error = json.loads(str(response.content,'utf-8'))
		print(error) # json response contains a list of errors, with an errorMessage and parameter
	else:
		print ('Error {} - {}'.format(response.status_code,response.reason))



url = ['https://data.oceannetworks.ca/api/properties' ...
        '?method=get' ...
        '&token=YOUR_TOKEN_HERE' ...                          %replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.
        '&propertyName=pressure'];

request = matlab.net.http.RequestMessage;
uri = matlab.net.URI(url);
options = matlab.net.http.HTTPOptions('ConnectTimeout',60);
  
response = send(request,uri,options);
  
if (response.StatusCode == 200)    % HTTP Status - OK
    properties= response.Body.Data;
    for i=1:numel(properties)
        property = properties(i);
        disp(property);
    end
elseif (response.StatusCode == 400) % HTTP Status - Bad Request
    disp(response.Body.Data.errors);
else % all other HTTP Statuses
    disp(char(response.StatusLine));
end


library(httr)
r <- GET("https://data.oceannetworks.ca/api/properties", 
         query = list(method="get", 
                      token="YOUR_TOKEN_HERE", #>replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.
                      propertyName="pressure"))

if (http_error(r)) {
  if (r$status_code == 400){
    error = content(r)
    str(error)
  } else {
    str(http_status(r)$message)
  }
} else {
  properties= content(r)
  for (property in properties){
    str(property)
  }
}



This example returns all of the device categories that are available at the location with the locationCode of 'BACAX' ('Barkley Canyon Axis (POD1)' and prints out the results, one property at a time. The locationCode filter is case sensitive and must match a valid locationCode exactly. See locations for further details

Parameters:

  • locationCode=BACAX
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/properties'
parameters = {'method':'get',
			'token':'YOUR_TOKEN_HERE', # replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.
			'locationCode':'BACAX'}
 
response = requests.get(url,params=parameters)   
if (response.ok):
    properties= json.loads(str(response.content,'utf-8')) # convert the json response to an object
    if not properties == []:
        for property in properties:
            print(property,'\n ')
    else:
        print('There are no results for your requested parameters.') 

else:
	if(response.status_code == 400):
		error = json.loads(str(response.content,'utf-8'))
		print(error) # json response contains a list of errors, with an errorMessage and parameter
	else:
		print ('Error {} - {}'.format(response.status_code,response.reason))



url = ['https://data.oceannetworks.ca/api/properties' ...
        '?method=get' ...
        '&token=YOUR_TOKEN_HERE' ...                          %replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.
        '&locationCode=BACAX'];

request = matlab.net.http.RequestMessage;
uri = matlab.net.URI(url);
options = matlab.net.http.HTTPOptions('ConnectTimeout',60);
  
response = send(request,uri,options);
  
if (response.StatusCode == 200)    % HTTP Status - OK
    properties= response.Body.Data;
    for i=1:numel(properties)
        property = properties(i);
        disp(property);
    end
elseif (response.StatusCode == 400) % HTTP Status - Bad Request
    disp(response.Body.Data.errors);
else % all other HTTP Statuses
    disp(char(response.StatusLine));
end


library(httr)
r <- GET("https://data.oceannetworks.ca/api/properties", 
         query = list(method="get", 
                      token="YOUR_TOKEN_HERE", #>replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.
                      locationCode="BACAX"))

if (http_error(r)) {
  if (r$status_code == 400){
    error = content(r)
    str(error)
  } else {
    str(http_status(r)$message)
  }
} else {
  properties= content(r)
  for (property in properties){
    str(property)
  }
}



This example returns all of the properties available for a device with the deviceCode 'NORTEKAQDPRO8398' and prints the results, one property at a time. The deviceCode filter is case sensitive and must match a valid deviceCode exactly. See devices service for further details.

Parameters:

  • deviceCode=NORTEKAQDPRO8398
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/properties'
parameters = {'method':'get',
			'token':'YOUR_TOKEN_HERE', # replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.
			'deviceCode':'NORTEKAQDPRO8398'}
 
response = requests.get(url,params=parameters)   
if (response.ok):
    properties= json.loads(str(response.content,'utf-8')) # convert the json response to an object
    if not properties == []:
        for property in properties:
            print(property,'\n ')
    else:
        print('There are no results for your requested parameters.')

else:
	if(response.status_code == 400):
		error = json.loads(str(response.content,'utf-8'))
		print(error) # json response contains a list of errors, with an errorMessage and parameter
	else:
		print ('Error {} - {}'.format(response.status_code,response.reason))



url = ['https://data.oceannetworks.ca/api/properties' ...
        '?method=get' ...
        '&token=YOUR_TOKEN_HERE' ...                          %replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.
        '&deviceCode=NORTEKAQDPRO8398'];

request = matlab.net.http.RequestMessage;
uri = matlab.net.URI(url);
options = matlab.net.http.HTTPOptions('ConnectTimeout',60);
  
response = send(request,uri,options);
  
if (response.StatusCode == 200)    % HTTP Status - OK
    properties= response.Body.Data;
    for i=1:numel(properties)
        property = properties(i);
        disp(property);
    end
elseif (response.StatusCode == 400) % HTTP Status - Bad Request
    disp(response.Body.Data.errors);
else % all other HTTP Statuses
    disp(char(response.StatusLine));
end


library(httr)
r <- GET("https://data.oceannetworks.ca/api/properties", 
         query = list(method="get", 
                      token="YOUR_TOKEN_HERE", #>replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.
                      deviceCode="NORTEKAQDPRO8398"))

if (http_error(r)) {
  if (r$status_code == 400){
    error = content(r)
    str(error)
  } else {
    str(http_status(r)$message)
  }
} else {
  properties= content(r)
  for (property in properties){
    str(property)
  }
}



This example returns all of the properties which are available for the device category 'ADCP 150 kHz' and prints the results, one property at a time. The deviceCategoryCode filter is case sensitive and must match a valid deviceCategoryCode exactly. See deviceCategories service for further details

Parameters:

  • deviceCategoryCode=ADCP150KHZ
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/properties'
parameters = {'method':'get',
			'token':'YOUR_TOKEN_HERE', # replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.
			'deviceCategoryCode':'ADCP150KHZ'}
 
response = requests.get(url,params=parameters)   
if (response.ok):
    properties= json.loads(str(response.content,'utf-8')) # convert the json response to an object
    if not properties == []:
        for property in properties:
            print(property,'\n ')
    else:
        print('There are no results for your requested parameters.')
else:
	if(response.status_code == 400):
		error = json.loads(str(response.content,'utf-8'))
		print(error) # json response contains a list of errors, with an errorMessage and parameter
	else:
		print ('Error {} - {}'.format(response.status_code,response.reason))



url = ['https://data.oceannetworks.ca/api/properties' ...
        '?method=get' ...
        '&token=YOUR_TOKEN_HERE' ...                          %replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.
        '&deviceCategoryCode=ADCP150KHZ'];

request = matlab.net.http.RequestMessage;
uri = matlab.net.URI(url);
options = matlab.net.http.HTTPOptions('ConnectTimeout',60);
  
response = send(request,uri,options);
  
if (response.StatusCode == 200)    % HTTP Status - OK
    properties= response.Body.Data;
    for i=1:numel(properties)
        property = properties(i);
        disp(property);
    end
elseif (response.StatusCode == 400) % HTTP Status - Bad Request
    disp(response.Body.Data.errors);
else % all other HTTP Statuses
    disp(char(response.StatusLine));
end


library(httr)
r <- GET("https://data.oceannetworks.ca/api/properties", 
         query = list(method="get", 
                      token="YOUR_TOKEN_HERE", #>replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.
                      deviceCategoryCode="ADCP150KHZ"))

if (http_error(r)) {
  if (r$status_code == 400){
    error = content(r)
    str(error)
  } else {
    str(http_status(r)$message)
  }
} else {
  properties= content(r)
  for (property in properties){
    str(property)
  }
}




Please report all issues with the web services, documentation, samples and client libraries to the Oceans 2.0 Help Centre