Web Services

In an effort to increase distribution and use of the data collected by the NERRS, the Centralized Data Management Office has created several web service products for this purpose. These services can be used to pull real-time data from our databases for use by other individuals and organizations. Please see the SWMP Parameters page (www.nerrsdata.org/data/parameters.cfm) for an explanation of available water quality and weather data parameters and the SWMP Data QAQC page (www.nerrsdata.org/data/qaqc.cfm) for an explanation of QAQC flags and codes. QAQC flags and codes are provided automatically in the export all functions listed below and available by request in the export single parameter functions. They are critical to data interpretation and use. Note that the NERRS SWMP database undergoes multiple stages of QAQC and the most complete and up to date dataset is only available directly from the CDMO at any given time. As a result, NERRS data should not be archived by outside sources for distribution.

You must request authorization and provide a static IP address before pulling data from the CDMO. Register now.

Transmission Time Schedule

Realtime satellite transmissions are received hourly based upon the schedule located here. Decoding occurs at 11 minutes past the hour and 41 minutes past the hour. Data are then ingested into the CDMO database at 15 and 45 minutes past the hour and become available on the CDMO website hour shortly thereafter. In order to allow enough time for that process to occur, the desired data should be pulled at 20 and 50 minutes past the hour. Each transmission has 4 15-minute records in it dictated by sample times, the polling time of the transmitter, and transmission time.

Link to web service:

http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl

Web Service Functions:

These functions return the same data as the original functions (listed below); however, they return tags with parameter names as opposed to having the data within the tags.

  • exportStationCodesXMLNew

    Returns the following XML data: NERR_Site_ID, Station_Code, Station_Name, Latitude/Longitude (in degrees), Latitude (in decimal), Longitude (in decimal), Active Status, Active Dates, State, Reserve_Name, the parameters reported for all stations, and a Real Time bit.

    Arguments

    None

  • NERRFilterStationCodesXMLNew

    Returns the following XML data: NERR_Site_ID, Station_Code, Station_Name, Latitude/Longitude (in degrees), Latitude (in decimal), Longitude (in decimal), Active Status, Active Dates, State, Reserve_Name, and the parameters reported for all stations associated with a particular NERR Site.

    Arguments

    NERR Site ID

  • exportSingleParamXMLNew

    Returns the following XML data: DateTimeStamp, user-requested-parameter(s).Users may request multiple parameters, we strongly encourage requesting flag parameters as well (e.g., pH,F_pH,Sal,F_Sal).

    Arguments

    Station_Code
    Number of records to retrieve
    Parameter tested

  • exportAllParamsDateRangeXMLNew

    Returns all parameters with DateTimeStamps greater than the mindate and less than or equal to the maxdate.

    Arguments

    Station_Code
    mindate
    maxdate
    Parameter tested (Max: 1000 records)

  • exportAllParamsXMLNew

    Returns the following XML data: DateTimeStamp, and all parameters associated for requested station.

    Arguments

    Station_Code
    Number of records to retrieve (Max: 100 records)


  • exportStationCodesXML

    Returns the following XML data: NERR_Site_ID, Station_Code, Station_Name, Latitude/Longitude (in degrees), Latitude (in decimal), Longitude (in decimal), Active Status, Active Dates, State, Reserve_Name, the parameters reported for all stations, and a Real Time bit.

    Arguments

    None

  • NERRFilterStationCodesXML

    Returns the following XML data: NERR_Site_ID, Station_Code, Station_Name, Latitude/Longitude (in degrees), Latitude (in decimal), Longitude (in decimal), Active Status, Active Dates, State, Reserve_Name, and the parameters reported for all stations associated with a particular NERR Site.

    Arguments

    NERR Site ID

  • exportSingleParamXML

    Returns the following XML data: DateTimeStamp, user-requested-parameter(s). Users may request multiple parameters, we strongly encourage requesting flag parameters as well (e.g., pH,F_pH,Sal,F_Sal).

    Arguments

    Station_Code
    Number of records to retrieve
    parameter tested

  • exportAllParamsDateRangeXML

    Returns all parameters with DateTimeStamps greater than the mindate and less than or equal to the maxdate.

    Arguments

    Station_Code
    mindate
    maxdate
    Parameter tested (Max: 1000 records)

  • exportAllParamsXML

    Returns the following XML data: DateTimeStamp, and all parameters associated for requested station.

    Arguments

    Station_Code
    Number of records to retrieve (Max: 100 records)

Helpful Hints:

We recommend calling the exportStationCodesXML function first! This will give you the Station Codes for each station and the parameters reported for that station. Once you know what station and parameter data you want to pull, you will be able to format the arguments for the exportSingleParamXML function.

QAQC flag codes are highly recommended and can be returned for any parameter. The naming schema for the flag fieldname is F_parameter. Example flag column for pH is F_pH.

QAQC error codes can be returned for any parameter. The naming schema for the codes is fieldname EC_parameter. Example code column for pH is EC_pH

NOTE: If you are using NuSOAP version 0.9 or newer (Changelog of 2010 or newer) you may see receive an error to an undefined call. If you see this error you simply need to change the code where you assign the WSDL from the old syntax of:

$wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');

To the new syntax which is:

$wsdl=new nusoap_client('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');

 

PHP, ColdFusion, Perl, and Python Code Examples:

PHP
ColdFusion
Perl
Python

In order for you to use PHP to call our web services, you must download NuSOAP here. Unzip the files and place them in a directory where your PHP file will be located on your web server.

Here is an example for calling the exportStationCodesXMLNew function:

<?php require_once('lib/nusoap.php');
$wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
$wsdl->call('exportStationCodesXMLNew');
echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
?>

Here is an example for calling the exportStationCodesXML function:

<?php require_once('lib/nusoap.php');
$wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
$wsdl->call('exportStationCodesXML');
echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
?>

Here is an example for calling the NERRFilterStationCodesXMLNew function to pull Station Code records for North Inlet Winyah Bay (NIW) Reserve:

<?php require_once('lib/nusoap.php');
$wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
$wsdl->call('NERRFilterStationCodesXMLNew', array('NERRFilter'=>'niw'));
echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
?>

Here is an example for calling the NERRFilterStationCodesXML function to pull Station Code records for North Inlet Winyah Bay (NIW) Reserve:

<?php require_once('lib/nusoap.php');
$wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
$wsdl->call('NERRFilterStationCodesXML', array('NERRFilter'=>'niw'));
echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
?>

Here is an example for calling the exportSingleParamXMLNew function to return the last 4 pH records from North Inlet Oyster Landing Water Quality Station niwolwq:

<?php require_once('lib/nusoap.php');
$wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
echo $wsdl->call('exportSingleParamXMLNew',
array('tbl'=>'niwolwq','numrecs'=>'4','param'=>'pH'));
echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
?>

Here is an example for calling the exportSingleParamXML function to return the last 4 pH records from North Inlet Oyster Landing Water Quality Station niwolwq:

<?php require_once('lib/nusoap.php');
$wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
echo $wsdl->call('exportSingleParamXML',
array('tbl'=>'niwolwq','numrecs'=>'4','param'=>'pH'));
echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
?>

Here is an example for calling the exportAllParamsDateRangeXMLNew function to return all parameters with DateTimeStamps greater than the mindate and less than or equal to the maxdate. If you include a fieldlist, only those parameters will be returned to you.

<?php require_once('lib/nusoap.php');
$wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
echo $wsdl->call('exportAllParamsDateRangeXMLNew',
array('tbl'=>'niwolwq','mindate'=>'12/06/2006','maxdate'=>'12/07/2007','fieldlist'=>'*'));
echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
?>

Here is an example for calling the exportAllParamsDateRangeXML function to return all parameters with DateTimeStamps greater than the mindate and less than or equal to the maxdate. If you include a fieldlist, only those parameters will be returned to you.

<?php require_once('lib/nusoap.php');
$wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
echo $wsdl->call('exportAllParamsDateRangeXML',
array('tbl'=>'niwolwq','mindate'=>'12/06/2006','maxdate'=>'12/07/2007','fieldlist'=>'*'));
echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
?>

Here is an example for calling the exportAllParamsXMLNew function to return all parameters for a certain station code.

<?php require_once('lib/nusoap.php');
$wsdl=new soapclient('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
echo $wsdl->call('exportAllParamsXMLNew',
array('tbl'=>'niwolwq','recs'=>'100'));
echo 'Response: <xmp>'.$wsdl->response.'</xmp>';
?>

Here is an example for calling the exportStationCodesXMLNew function:

<cfinvoke
webservice="http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl"
method="exportStationCodesXMLNew"
returnvariable="aString">
</cfinvoke>
<!--- Output results --->
<cfset aString = #XMLParse(aString)#>
<cfdump var="#aString#">

Here is an example for calling the exportStationCodesXML function:

<cfinvoke
webservice="http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl"
method="exportStationCodesXML"
returnvariable="aString">
</cfinvoke>
<!--- Output results --->
<cfset aString = #XMLParse(aString)#>
<cfdump var="#aString#">

Here is an example for calling the NERRFilterStationCodesXMLNew function to pull Station Code records for North Inlet Winyah Bay (NIW) Reserve:

<cfinvoke
webservice="http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl"
method="NERRFilterStationCodesXMLNew"
returnvariable="aString">
<cfinvokeargument name="NERRFilter" value="niw"/>
</cfinvoke>
<!--- Output results --->
<cfset aString = #XMLParse(aString)#>
<cfdump var="#aString#">

Here is an example for calling the NERRFilterStationCodesXML function to pull Station Code records for North Inlet Winyah Bay (NIW) Reserve:

<cfinvoke
webservice="http://cdmo.baruch.sc.edu/webservices/webservices2/requests.cfc?wsdl"
method="NERRFilterStationCodesXML"
returnvariable="aString">
<cfinvokeargument name="NERRFilter" value="niw"/>
</cfinvoke>
<!--- Output results --->
<cfset aString = #XMLParse(aString)#>
<cfdump var="#aString#">

Here is an example for calling the exportSingleParamXMLNew function to return the last 4 pH records from North Inlet Oyster Landing Water Quality Station niwolwq:

<cfinvoke
webservice="http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl"
method="exportSingleParamXMLNew"
returnvariable="aString">
<cfinvokeargument name="station_code" value="niwolwq"/>
<cfinvokeargument name="recs" value="4"/>
<cfinvokeargument name="param" value="pH"/>
</cfinvoke>
<!--- Output results --->
<cfset aString = #XMLParse(aString)#>
<cfdump var="#aString#">

Here is an example for calling the exportSingleParamXML function to return the last 4 pH records from North Inlet Oyster Landing Water Quality Station niwolwq:

<cfinvoke
webservice="http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl"
method="exportSingleParamXML"
returnvariable="aString">
<cfinvokeargument name="station_code" value="niwolwq"/>
<cfinvokeargument name="recs" value="4"/>
<cfinvokeargument name="param" value="pH"/>
</cfinvoke>
<!--- Output results --->
<cfset aString = #XMLParse(aString)#>
<cfdump var="#aString#">

Here is an example for calling the exportAllParamsDateRangeXMLNew function to return all parameters with DateTimeStamps greater than the mindate and less than or equal to the maxdate. If you include a fieldlist, only those parameters will be returned to you.

<cfinvoke
webservice="http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl"
method="exportAllParamsDateRangeXMLNew"
returnvariable="aString">
<cfinvokeargument name="station_code" value="niwolmet"/>
<cfinvokeargument name="mindate" value="12/12/2006"/>
<cfinvokeargument name="maxdate" value="12/13/2006"/>
<cfinvokeargument name="param" value="*"/>
</cfinvoke>
<!--- Output results --->
<cfset aString = #XMLParse(aString)#>
<cfdump var="#aString#">

Here is an example for calling the exportAllParamsDateRangeXML function to return all parameters with DateTimeStamps greater than the mindate and less than or equal to the maxdate. If you include a fieldlist, only those parameters will be returned to you.

<cfinvoke
webservice="http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl"
method="exportAllParamsDateRangeXML"
returnvariable="aString">
<cfinvokeargument name="station_code" value="niwolmet"/>
<cfinvokeargument name="mindate" value="12/12/2006"/>
<cfinvokeargument name="maxdate" value="12/13/2006"/>
<cfinvokeargument name="param" value="BP"/>
</cfinvoke>
<!--- Output results --->
<cfset aString = #XMLParse(aString)#>
<cfdump var="#aString#">

Here is an example for calling the exportAllParamsXML function.

################
use strict;
use SOAP::Lite;

my $num_recs = @ARGV[0];
my $output_dir = @ARGV[1];

print("num_recs = $num_recs\n");
print("output_dir = $output_dir\n");

my @station_list = ('niwolmet','niwolwq');
my ($endpoint, $uri, $method);
$endpoint = "http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl";
$uri = "http://tempuri.org";
$method = 'exportAllParamsXML';

my $station_id = '';
foreach $station_id (@station_list)
{
print $station_id . "\n";
my $filename = "$output_dir/cdmo_$station_id";
my $file_out = $filename . '.txt';
my $fh;
open($fh, ">$file_out") or die("Failed to open file $file_out");

#note: below method call may falsely return 'no operation' for a given method if the parameters are incorrect - also had to force string type in below call to avoid error

my $soap = SOAP::Lite
->uri($uri)
->proxy($endpoint)
->outputxml(1);

my $response = $soap->$method(SOAP::Data->name(station_code => "$station_id"),SOAP::Data->name(recs => "$num_recs")->type('string'));

print $fh $response;
print 'All Parameter Response:

'.$response."\n";
close($fh);

open($fh, "< $file_out") or die("Failed to open file $file_out");

...
}

from suds.client import Client

soapClient = Client("http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl", timeout=90, retxml=True)

#Get the station codes SOAP request example.
station_codes = soapClient.service.exportStationCodesXML()
print station_codes

#Get all parameters from the station NIWOLMET for the date range of 2014-12-30 to 2014-12-31
params = soapClient.service.exportAllParamsDateRangeXML('niwolmet', '2014-12-30', '2014-12-31', '*')
print params

Department of Commerce | NOAA | National Ocean Service | Office for Coastal Management | NERRS | Webmaster
Site hosted by NOAA’s National Estuarine Research Reserve System, Centralized Data Management Office.