Page tree
Skip to end of metadata
Go to start of metadata

The following samples illustrate how to use the dataProducts discovery service to find the data products that meet your criteria, so that you can use the dataProductCode from the service response to request data using the dataProductDelivery service.

 

 Get all data product extensions

This example returns all of the data product extensions and prints the results, one data product extension at a time

Python 3.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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):
	dataProducts= json.loads(str(response.content,'utf-8')) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
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))
Python 2.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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):
	dataProducts= json.loads(str(response.content)) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
else:
	if(response.status_code == 400):
		error = json.loads(str(response.content))
		print(error) # json response contains a list of errors, with an errorMessage and parameter
	else:
		print ('Error {} - {}'.format(response.status_code,response.reason))
MATLAB
url = ['https://data.oceannetworks.ca/api/dataProducts' ...
        '?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
    dataProducts= response.Body.Data;
    for i=1:numel(dataProducts)
        dataProduct = dataProducts(i);
        disp(dataProduct);
    end
elseif (response.StatusCode == 400) % HTTP Status - Bad Request
    disp(response.Body.Data.errors);
else % all other HTTP Statuses
    disp(char(response.StatusLine));
end
R
library(httr)
r <- GET("https://data.oceannetworks.ca/api/dataProducts", 
         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 {
  dataProducts = content(r)
  for (dataProduct in dataProducts){
    str(dataProduct)
  }
}
 Get the data product extensions for a specific dataProductCode

This example returns all of the data product extensions for the dataProductCode 'TSSD' ('Time Series Scalar Data') and prints the results, one data product extension at a time.

Parameters:

  • dataProductCode=TSSD
Python 3.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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.
			'dataProductCode':'TSSD'}
 
response = requests.get(url,params=parameters)
 
if (response.ok):
	dataProducts = json.loads(str(response.content,'utf-8')) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProducts)
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))
Python 2.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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.
			'dataProductCode':'TSSD'}
 
response = requests.get(url,params=parameters)
 
if (response.ok):
	dataProducts = json.loads(str(response.content)) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProducts)
else:
	if(response.status_code == 400):
		error = json.loads(str(response.content))
		print(error) # json response contains a list of errors, with an errorMessage and parameter
	else:
		print ('Error {} - {}'.format(response.status_code,response.reason))
MATLAB
url = ['https://data.oceannetworks.ca/api/dataProducts' ...
        '?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.
        '&dataProductCode=TSSD'];
 
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
    dataProducts= response.Body.Data;
    for i=1:numel(dataProducts)
        dataProduct = dataProducts(i);
        disp(dataProduct);
    end
elseif (response.StatusCode == 400) % HTTP Status - Bad Request
    disp(response.Body.Data.errors);
else % all other HTTP Statuses
    disp(char(response.StatusLine));
end
R
library(httr)
r <- GET("https://data.oceannetworks.ca/api/dataProducts", 
         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.
                      dataProductCode="TSSD"))

if (http_error(r)) {
  if (r$status_code == 400){
    error = content(r)
    str(error)
  } else {
    str(http_status(r)$message)
  }
} else {
  dataProducts = content(r)
  for (dataProduct in dataProducts){
    str(dataProduct)
  }
}
 Get all data product extensions available for a specific extension

This example returns all of the data product extensions which are available for the extension 'pdf' prints the results, one data product extension at a time. The extension filter is case sensitive and must match a valid extension exactly.

Parameters:

  • extension=pdf
Python 3.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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.
			'extension':'pdf'}
 
response = requests.get(url,params=parameters)
 
if (response.ok):
	dataProducts= json.loads(str(response.content,'utf-8')) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
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))
Python 2.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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.
			'extension':'pdf'}
 
response = requests.get(url,params=parameters)
 
if (response.ok):
	dataProducts= json.loads(str(response.content)) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
else:
	if(response.status_code == 400):
		error = json.loads(str(response.content))
		print(error) # json response contains a list of errors, with an errorMessage and parameter
	else:
		print ('Error {} - {}'.format(response.status_code,response.reason))
MATLAB
url = ['https://data.oceannetworks.ca/api/dataProducts' ...
        '?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.
        '&extension=pdf'];
 
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
    dataProducts= response.Body.Data;
    for i=1:numel(dataProducts)
        dataProduct = dataProducts(i);
        disp(dataProduct);
    end
elseif (response.StatusCode == 400) % HTTP Status - Bad Request
    disp(response.Body.Data.errors);
else % all other HTTP Statuses
    disp(char(response.StatusLine));
end
R
library(httr)
r <- GET("https://data.oceannetworks.ca/api/dataProducts", 
         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.
                      extension="pdf"))

if (http_error(r)) {
  if (r$status_code == 400){
    error = content(r)
    str(error)
  } else {
    str(http_status(r)$message)
  }
} else {
  dataProducts = content(r)
  for (dataProduct in dataProducts){
    str(dataProduct)
  }
}
 Get all data product extensions available for a specific data product code and specific extension

This example returns all of the data product extensions which are available for the dataProductCode 'TSSD' and extension 'csv' prints the results, one data product extension at a time. The dataProductCode filter is case sensitive and must match a valid dataProductCode exactly. The extension filter is case sensitive and must match a valid extension exactly.

Parameters:

  • dataProductCode=TSSD
  • extension=cvs
Python 3.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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.
			'dataProductcode':'TSSD',
			'extension':'csv'}
 
response = requests.get(url,params=parameters)
 
if (response.ok):
	dataProducts= json.loads(str(response.content,'utf-8')) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
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))
Python 2.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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.
			'dataProductcode':'TSSD',
			'extension':'csv'}
 
response = requests.get(url,params=parameters)
 
if (response.ok):
	dataProducts= json.loads(str(response.content)) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
else:
	if(response.status_code == 400):
		error = json.loads(str(response.content))
		print(error) # json response contains a list of errors, with an errorMessage and parameter
	else:
		print ('Error {} - {}'.format(response.status_code,response.reason))
MATLAB
url = ['https://data.oceannetworks.ca/api/dataProducts' ...
        '?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.
        '&dataProductCode=TSSD' ...
        '&extension=csv'];
 
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
    dataProducts= response.Body.Data;
    for i=1:numel(dataProducts)
        dataProduct = dataProducts(i);
        disp(dataProduct);
    end
elseif (response.StatusCode == 400) % HTTP Status - Bad Request
    disp(response.Body.Data.errors);
else % all other HTTP Statuses
    disp(char(response.StatusLine));
end
R
library(httr)
r <- GET("https://data.oceannetworks.ca/api/dataProducts", 
         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.
                      dataProductCode="TSD",
                      extension="csv"))

if (http_error(r)) {
  if (r$status_code == 400){
    error = content(r)
    str(error)
  } else {
    str(http_status(r)$message)
  }
} else {
  dataProducts = content(r)
  for (dataProduct in dataProducts){
    str(dataProduct)
  }
}
 Get all data product extensions which have a certain word in the name

This example returns all of the data product extensions which have the 'scalar' in the name and prints the results, one data product extension at a time. The dataProductName filter is case in-sensitive, so capitalized 'Scalar' will also be returned.

Parameters:

  • dataProductName=scalar
Python 3.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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.
			'dataProductName':'scalar'}
 
response = requests.get(url,params=parameters)
 
if (response.ok):
	dataProducts= json.loads(str(response.content,'utf-8')) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
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))
Python 2.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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.
			'dataProductName':'scalar'}
 
response = requests.get(url,params=parameters)
 
if (response.ok):
	dataProducts= json.loads(str(response.content)) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
else:
	if(response.status_code == 400):
		error = json.loads(str(response.content))
		print(error) # json response contains a list of errors, with an errorMessage and parameter
	else:
		print ('Error {} - {}'.format(response.status_code,response.reason))
MATLAB
url = ['https://data.oceannetworks.ca/api/dataProducts' ...
        '?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.
        '&dataProductName=scalar'];
 
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
    dataProducts= response.Body.Data;
    for i=1:numel(dataProducts)
        dataProduct = dataProducts(i);
        disp(dataProduct);
    end
elseif (response.StatusCode == 400) % HTTP Status - Bad Request
    disp(response.Body.Data.errors);
else % all other HTTP Statuses
    disp(char(response.StatusLine));
end
R
library(httr)
r <- GET("https://data.oceannetworks.ca/api/dataProducts", 
         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.
                      dataProductName="scalar"))

if (http_error(r)) {
  if (r$status_code == 400){
    error = content(r)
    str(error)
  } else {
    str(http_status(r)$message)
  }
} else {
  dataProducts = content(r)
  for (dataProduct in dataProducts){
    str(dataProduct)
  }
}
 Get all data product extensions that are available at a specific location

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

Parameters:

  • locationCode=BACAX
Python 3.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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):
	dataProducts = json.loads(str(response.content,'utf-8')) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
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))
Python 2.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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):
	dataProducts = json.loads(str(response.content)) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
else:
	if(response.status_code == 400):
		error = json.loads(str(response.content))
		print(error) # json response contains a list of errors, with an errorMessage and parameter
	else:
		print ('Error {} - {}'.format(response.status_code,response.reason))
MATLAB
url = ['https://data.oceannetworks.ca/api/dataProducts' ...
        '?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
    dataProducts= response.Body.Data;
    for i=1:numel(dataProducts)
        dataProduct = dataProducts(i);
        disp(dataProduct);
    end
elseif (response.StatusCode == 400) % HTTP Status - Bad Request
    disp(response.Body.Data.errors);
else % all other HTTP Statuses
    disp(char(response.StatusLine));
end
R
library(httr)
r <- GET("https://data.oceannetworks.ca/api/dataProducts", 
         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 {
  dataProducts = content(r)
  for (dataProduct in dataProducts){
    str(dataProduct)
  }
}
 Get all data product extensions that are available for a specific extension at a specific location

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

Parameters:

  • extension=mat
  • locationCode=BACAX
Python 3.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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.
			'extension':'mat',
			'locationCode':'BACAX'}
 
response = requests.get(url,params=parameters)
 
if (response.ok):
	dataProducts = json.loads(str(response.content,'utf-8')) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
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))
Python 2.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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.
			'extension':'mat',
			'locationCode':'BACAX'}
 
response = requests.get(url,params=parameters)
 
if (response.ok):
	dataProducts = json.loads(str(response.content)) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
else:
	if(response.status_code == 400):
		error = json.loads(str(response.content))
		print(error) # json response contains a list of errors, with an errorMessage and parameter
	else:
		print ('Error {} - {}'.format(response.status_code,response.reason))
MATLAB
url = ['https://data.oceannetworks.ca/api/dataProducts' ...
        '?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.
        '&extension=mat' ...
        '&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
    dataProducts= response.Body.Data;
    for i=1:numel(dataProducts)
        dataProduct = dataProducts(i);
        disp(dataProduct);
    end
elseif (response.StatusCode == 400) % HTTP Status - Bad Request
    disp(response.Body.Data.errors);
else % all other HTTP Statuses
    disp(char(response.StatusLine));
end
R
library(httr)
r <- GET("https://data.oceannetworks.ca/api/dataProducts", 
         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.
                      extension="mat",
                      locationCode="BACAX"))

if (http_error(r)) {
  if (r$status_code == 400){
    error = content(r)
    str(error)
  } else {
    str(http_status(r)$message)
  }
} else {
  dataProducts = content(r)
  for (dataProduct in dataProducts){
    str(dataProduct)
  }
}
 Get all data product codes that are available on a specific device has been deployed

This example returns all of the data product codes available for a device with the deviceCode 'NORTEKAQDPRO8398' and prints the results, one data product code 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
Python 3.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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):
	dataProducts= json.loads(str(response.content,'utf-8')) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
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))
Python 2.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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):
	dataProducts= json.loads(str(response.content)) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
else:
	if(response.status_code == 400):
		error = json.loads(str(response.content))
		print(error) # json response contains a list of errors, with an errorMessage and parameter
	else:
		print ('Error {} - {}'.format(response.status_code,response.reason))
MATLAB
url = ['https://data.oceannetworks.ca/api/dataProducts' ...
        '?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
    dataProducts= response.Body.Data;
    for i=1:numel(dataProducts)
        dataProduct = dataProducts(i);
        disp(dataProduct);
    end
elseif (response.StatusCode == 400) % HTTP Status - Bad Request
    disp(response.Body.Data.errors);
else % all other HTTP Statuses
    disp(char(response.StatusLine));
end
R
library(httr)
r <- GET("https://data.oceannetworks.ca/api/dataProducts", 
         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 {
  dataProducts = content(r)
  for (dataProduct in dataProducts){
    str(dataProduct)
  }
}
 Get all data product extensions with a specific property

This example returns all of the data product extensions which have the property 'seawatertemperature' and prints the results, one data product extension at a time. The propertyCode filter is case sensitive and must match a valid propertyCode exactly. See properties service for further details.

Parameters:

  • propertyCode=seawatertemperature
Python 3.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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):
	dataProducts = json.loads(str(response.content,'utf-8')) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
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))
Python 2.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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):
	dataProducts = json.loads(str(response.content)) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
else:
	if(response.status_code == 400):
		error = json.loads(str(response.content))
		print(error) # json response contains a list of errors, with an errorMessage and parameter
	else:
		print ('Error {} - {}'.format(response.status_code,response.reason))
MATLAB
url = ['https://data.oceannetworks.ca/api/dataProducts' ...
        '?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
    dataProducts= response.Body.Data;
    for i=1:numel(dataProducts)
        dataProduct = dataProducts(i);
        disp(dataProduct);
    end
elseif (response.StatusCode == 400) % HTTP Status - Bad Request
    disp(response.Body.Data.errors);
else % all other HTTP Statuses
    disp(char(response.StatusLine));
end
R
library(httr)
r <- GET("https://data.oceannetworks.ca/api/dataProducts", 
         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 {
  dataProducts = content(r)
  for (dataProduct in dataProducts){
    str(dataProduct)
  }
}
 Get all data product extensions that are available for a specific device category

This example returns all of the data product extension which are available for the device category 'ADCP 150 kHz' and prints the results, one data product extension 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
Python 3.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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):
	dataProducts = json.loads(str(response.content,'utf-8')) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
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))
Python 2.x
import requests
import json
 
url = 'https://data.oceannetworks.ca/api/dataProducts'
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):
	dataProducts = json.loads(str(response.content)) # convert the json response to an object
	for dataProduct in dataProducts:
		print(dataProduct)
else:
	if(response.status_code == 400):
		error = json.loads(str(response.content))
		print(error) # json response contains a list of errors, with an errorMessage and parameter
	else:
		print ('Error {} - {}'.format(response.status_code,response.reason))
MATLAB
url = ['https://data.oceannetworks.ca/api/dataProducts' ...
        '?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
    dataProducts= response.Body.Data;
    for i=1:numel(dataProducts)
        dataProduct = dataProducts(i);
        disp(dataProduct);
    end
elseif (response.StatusCode == 400) % HTTP Status - Bad Request
    disp(response.Body.Data.errors);
else % all other HTTP Statuses
    disp(char(response.StatusLine));
end
R
 library(httr)
r <- GET("https://data.oceannetworks.ca/api/dataProducts", 
         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 {
  dataProducts = content(r)
  for (dataProduct in dataProducts){
    str(dataProduct)
  }
}

 

 

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