Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: reworded the skiperrors description considering the public nature of this documentation

...

Method

Description

Example

51085963Retrieve raw data available for a given device within a time rangemethod=getByDevice
51085963Retrieve raw data for the specified location and date range. This method is replacing getByStation.method=getByLocation
Deprecated Methods
rawdata service#getByStation

Retrieve raw data available at given station.

This method is still available but is deprecated as of October 1, 2017 and has been replaced by the getByLocation method.

method=getByStation


Anchor

...

getByDevice

...

getByDevice
getByDevice

Retrieve raw data

...

for a given

...

device. A date range is optional–if not specified, data from all time will be returned within (possibly default) row and size limits.

Parameters

ParameterTypeDescriptionExample
Required
token

...

ISO8601 (extended) Date for end time of data. Defaults to the current time if not provided.

If no dateFrom is given and a dateTo is given, a date range error will be returned.

The max amount of data returned will be rowLimit.

...

The maximum number of data to return, within the constraints of the service. Note this will limit the data starting at the start time and ending at the row limit, not necessarily at the end time.

default row limit: 100000

Treat negative or 0 rowLimit as max rowLimit. Treat rowLimit > maxRowLimit as max row limit.

...

StringAll Web Services require a token. This can be generated at https://data.oceannetworks.ca/Profile. Click on the "Web Services" tab and click "Generate Token".token=YOUR_TOKEN_HERE
deviceCodeString

Return raw data of a specific Device Code.

  • Device Code must be valid and match exactly, including case.
  • Specific Device Codes can be found by simply running the service without this parameter to get a list of all devices.
deviceCode=ASLZAP1006
Optional
dateFromString

Return raw data that has a timestamp on or after a specific date/time.

Accepted DateTime formats:

  • yyyy-MM-dd'T'HH:mm:ss.SSS'Z' (ISO 8601 Extended)
  • yyyy-MM-dd (ISO 8601 Extended)
  • PnYnMnDTnHnMnS (ISO 8601 Duration)

If not specified, the default value is the beginning of time.

  • DateTime is represented in Coordinated Universal Time (UTC).

  • ISO 8601 Extended format without a time will be assumed to mean midnight (T00:00:000.000Z).
  • Queries with both dateFrom and dateTo in the ISO 8601 Duration format will not be accepted.

dateFrom=2010-07-27T00:00:00.000Z

dateFrom=2010-07-27

dateFrom=-P1DT1H

  • Previous 1 day and 1 hour, relative to the dateTo. Note the '-' before the P.
dateToString

Return scalar data that has a timestamp before a specific date/time.

Accepted DateTime formats:

  • yyyy-MM-dd'T'HH:mm:ss.SSS'Z' (ISO 8601 Extended)
  • yyyy-MM-dd (ISO 8601 Extended)
  • PnYnMnDTnHnMnS (ISO 8601 Duration)

If not specified, the default value is the end of time.

  • DateTime is represented in Coordinated Universal Time (UTC).

  • ISO 8601 Extended format without a time will be assumed to mean midnight (T00:00:000.000Z).
  • Queries with both dateFrom and dateTo in the ISO 8601 Duration format will not be accepted.

dateTo=2016-08-01T00:00:00.000Z

dateTo=2016-08-01

dateTo=PT12H30M

  • Next 12 hours and 30 minutes, relative to the dateFrom.
rowLimitIntegerThe limit on the number of raw data readings to return. If not specified the row limit is 100,000.rowLimit=300
sizeLimitIntegerThe limit on the size of raw data readings to return, specified in MB. If not specified the size limit is 250 MB.sizeLimit=20
convertHexToDecimalBooleanFormat of raw data readings. By default, binary data will be returned in decimal. When set to false, it will be returned in hexadecimal.convertHexToDecimal=false
outputFormatString

There are two values:

  • Array (default or if missing) (case insensitive)
    • Data will be output as three arrays for a given device: a lineTypes array, a readings array, and a times array.
  • Object (case insensitive)
    • Data will be output as a list of objects for a given device. Inside each data object, there are lineType, rawData, and sampleTime lists.

outputFormat=array

outputFormat=object

getLatestBooleanSpecifies whether or not the latest raw data readings should be returned first. This is false by default. When set to true, readings are returned and pagination is done from latest to earliest.getLatest=true
skipErrorsBoolean

In the exceptional case when some portion of the requested data appears damaged, by default this service will return an error (HTTP status code 500, error code 143) with a description of the problem.

If the user ever comes across this error, it's possible to obtain the original data without the damaged samples by setting the parameter skipErrors=true .

ONC runs automated tests and has dedicated teams that detect and handle these exceptional cases at the earliest opportunity.

skipErrors=true



Response

Success (outputFormat = Array)

 {
  "data": {
    "lineTypes": <Array of String>,
    "readings": <Array of String> OR <Array of Integer Array>,
    "times": <Array of String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')>
  },
  "next": {
    "parameters": {
      "method""getByDevice",
      "rowLimit": <String>,
      "deviceCode": <String>,
      "dateFrom": <String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')>,
      "outputFormat": <String>,
      "token": <String>
    },
    "url": <String>
  },
  "queryUrl": <String>
}



Property

Type

Description

Example

dataObjectAn object containing the raw data readings and time stamps
  • data.lineTypes
Array of StringsAn array of lineTypes, one for each reading in the requested date range. LineTypes are ">" for CommandSent, " " for DataReceived, and "<" for CommandResponse.
[" ",">","<"," "," "," "," ",">"]
  • data.readings

Array of Strings OR

Array of Integer Arrays

An array of readings one for each reading in the requested date range. If the raw data is text then this is an array of strings. If the raw data is binary then each item in the array is an array of integers. If conversion is turned off, array of hexadecimal strings returned.

Text:

  • [ "2891917878B1F5102C4D16E27AD6B59B00" ]

Binary:

  • [ [-91,1,21,0,4,86 ],  [60,58,57,0,-70,83]]



Binary: (convertHexToDecimal = false)

  • [ "a5 01 15 00 04", "3c 3a 39 00 ba 53" ]
  • data.times
Array of StringsAn array of timestamps one for each reading in the requested date range. Each timestamp is a string in ISO8601 (extended) format, yyyy-MM-dd'T'HH:mm:ss.SSS'Z'.
[ "2014-04-25T00:00:00.005Z" ]
nextObjectAn object containing information on how to make a rawdata call if the current call was unable to return all the data as a limit was exceeded. This is null if there is no more data in the requested range.
  • next.parameters
ObjectAn object containing the set of parameters making up the query to get the next set of data in the requested date range. The parameters will include all parameters passed into the original URL plus dateFrom if dateFrom hadn't been specified.
"parameters": {
      "method": "getByDevice",
      "rowLimit": "1",
"deviceCode": "SBECTD19p7128",
"dateFrom": "2014-04-25T00:00:00.006Z",
"token": "YOUR_TOKEN_HERE"
}
    • next.parameters.token
StringAs passed into the original call
"YOUR_TOKEN_HERE"
    • next.parameters.method
StringgetByDevice, as passed into the original call.
"getByDevice"
    • next.parameters.deviceCode
StringAs passed into the original call
"SBECTD19p7128"
    • next.parameters.dateFrom
StringThis is set to 1 millisecond more than the date of the last reading sent in the current call.
"2014-04-25T00:00:00.006Z"
    • next.parameters.*
StringAny optional parameters passed into the original call.
"dateTo":"2014-04-25T00:00:00.001Z",
"rowLimit":"5",
"outputFormat": "array"
  • next.url
StringThe complete URL that can be used to get the next set of data in the requested range.
"https://data.oceannetworks.ca/api/rawdata?method=getByDevice&dateTo=2014-04-25T00%3A00%3A00.001Z&deviceCode=SBECTD16p6934&rowLimit=5&dateFrom=2014-04-24T23%3A51%3A00.003Z&token=YOUR_TOKEN_HERE"
queryUrlStringThe complete URL for the current call.
"https://data.oceannetworks.ca/api/rawdata?method=getByDevice&token=YOUR_TOKEN_HERE&deviceCode=BARIX001&dateFrom=2017-06-08T00:00:00.000Z&dateTo=2017-06-08T00:00:00.010Z"


Success (outputFormat = Object)

...

On rare occasions, badly formatted data without a leading time stamp can be encountered. In these cases the rawdata service will return an error (see below). This option provides a way to skip these instances and return the data.

skipErrors=true will return all correctly formatted raw data with timestamps

skipErrors=false (default) will return error message when there are some badly formatted raw data within requested time range

Example of error message in the return:

{
"errors": [
{
"errorCode": 143,
"errorMessage": "Badly formatted raw data could not be returned. Recommend use 'skipErrors=true' option to skip errors and return remaining data. Alternatively, use archivefile service to download raw data."
}
]
}

...

skipErrors=true

Response

Success

...

{  
    "data" : [
              {
                "rawData": <string>,
                "sampleTime": <string>
              },
                ...
    ],
    "metadata": {
        "queryMetadata": {
            "stationCode" : <string>,
            "dateFrom"            : <string>,
            "dateTo"          : <string>,
            "deviceCategory"  : <string>,
            "rowLimit"            : <integer>
        }
        "dataMetadata": {
            "numberOfData"    : <integer>,
            "firstTimestamp"  : <string>,
            "lastTimestamp"       : <string>,
            "stationName"     : <string>,
            "hasMoreDataInRange": <boolean>
        }
    }
}

...

Property

...

Type

...

Description

...

Example

...

"2015-09-01T00:21:21.000Z"

...

"\c:1441212680,C:776,s:P-Cumshewa*1E\!AIVDO,1,1,9,A,4030p;1uvA@kDnSi;fNJgk7008<8,0*47"

...

part of the query metadata. The station code (search tree node code) that was queried

...

"IONA"

...

"AISRECEIVER"

...

"2015-09-01T00:21:21.000Z"

...

"2015-09-18T02:23:21.000Z"

...

100000

...

100000

...

"2015-09-01T00:21:21.123Z"

...

"2015-09-01T03:22:18.908Z"

...

"Iona Shore Station"

...

true

Example

Get raw data from an AIS receiver at Iona Shore Station from the beginning of time to the present with the default 100,000-row limit:

http://data.oceannetworks.ca/api/rawdata?method=getByStation&deviceCategory=AISRECEIVER&station=IONA&token=YOUR_TOKEN_HERE

Get data from AIS receiver at Iona Shore Station starting from September 1, 2015, at 21 minutes and 21 seconds after midnight:

 http://data.oceannetworks.ca/api/rawdata?token=YOUR_TOKEN_HERE&method=getByStation&station=IONA&deviceCategory=AISRECEIVER&dateFrom=2015-09-01T00:21:21.000Z

...

{"data":
     [
      {
       "rawData":"\\c:1441061153,C:1990,s:P-Parke*58\\!AIVDM,2,1,8,B,55NP0eP26m;5L@O?CC0Lu8@tr0`Dq<Dr2222220N9@J885Kd0?4i@E531H88,0*79",
       "sampleTime":"2015-09-01T00:21:21.123Z"
       },
      {
        "rawData":"\\c:1441061153,C:1990,s:P-Parke*58\\!AIVDM,2,2,8,B,88888888880,2*2F",
        "sampleTime":"2015-09-01T00:21:21.250Z"
       },
       {
          "rawData":"\\c:1441061153,C:1992,s:P-Helmcken*38\\!AIVDM,1,1,,B,15N;600P1Do>6CjKe>iG8Owb26jl,0*57",
          "sampleTime":"2015-09-01T00:21:21.352Z"},
       ...
     }],
    "metadata":
          {"dataMetadata": {
                  "firstTimestamp":"2015-09-01T00:21:21.123Z",
                  "hasMoreDataInRange":false,
                  "lastTimestamp":"2015-09-01T01:02:08.013Z",
                  "numberOfData":100000,
                  "stationName":"Iona Shore Station"
                 },
          "queryMetadata":{
                 "deviceCategory":"AISRECEIVER",
                 "dateTo":null,
                 "rowLimit":null,
                 "dateFrom":"2015-09-01T00:21:21.000Z",
                 "stationCode":"IONA"
          }
     }
}

...

Retrieve raw data for a given device. A date range is optional–if not specified, data from all time will be returned within (possibly default) row and size limits.

Parameters

ParameterTypeDescriptionExampleRequiredtokenStringAll Web Services require a token. This can be generated at https://data.oceannetworks.ca/Profile. Click on the "Web Services" tab and click "Generate Token".token=YOUR_TOKEN_HEREdeviceCodeString

Return raw data of a specific Device Code.

  • Device Code must be valid and match exactly, including case.
  • Specific Device Codes can be found by simply running the service without this parameter to get a list of all devices.
deviceCode=ASLZAP1006OptionaldateFromString

Return raw data that has a timestamp on or after a specific date/time.

Accepted DateTime formats:

yyyy-MM-dd


   "data":[ 
      
         "lineType": <String>,
         "rawData": <String> OR <Integer Array>,
         "sampleTime": <String (yyyy-MM-dd

'T'HH:mm:ss.SSS'Z'

(ISO 8601 Extended

)


  • yyyy-MM-dd (ISO 8601 Extended)
  • PnYnMnDTnHnMnS (ISO 8601 Duration)
  • If not specified, the default value is the beginning of time.

    • DateTime is represented in Coordinated Universal Time (UTC).

    • ISO 8601 Extended format without a time will be assumed to mean midnight (T00:00:000.000Z).
    • Queries with both dateFrom and dateTo in the ISO 8601 Duration format will not be accepted.

    dateFrom=2010-07-27T00:00:00.000Z

    dateFrom=2010-07-27

    dateFrom=-P1DT1H

    • Previous 1 day and 1 hour, relative to the dateTo. Note the '-' before the P.
    dateToString

    Return scalar data that has a timestamp before a specific date/time.

    Accepted DateTime formats:

    >
          },
          ...
       ],
       "next": {
         "parameters": {
           "method""getByDevice",
           "rowLimit": <String>,
           "deviceCode": <String>,
           "dateFrom": <String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z'

    (ISO 8601 Extended

    )


  • yyyy-MM-dd (ISO 8601 Extended)
  • PnYnMnDTnHnMnS (ISO 8601 Duration)
  • If not specified, the default value is the end of time.

    • DateTime is represented in Coordinated Universal Time (UTC).

    • ISO 8601 Extended format without a time will be assumed to mean midnight (T00:00:000.000Z).
    • Queries with both dateFrom and dateTo in the ISO 8601 Duration format will not be accepted.

    dateTo=2016-08-01T00:00:00.000Z

    dateTo=2016-08-01

    dateTo=PT12H30M

    • Next 12 hours and 30 minutes, relative to the dateFrom.
    rowLimitIntegerThe limit on the number of raw data readings to return. If not specified the row limit is 100,000.rowLimit=300sizeLimitIntegerThe limit on the size of raw data readings to return, specified in MB. If not specified the size limit is 250 MB.sizeLimit=20convertHexToDecimalBooleanFormat of raw data readings. By default, binary data will be returned in decimal. When set to false, it will be returned in hexadecimal.convertHexToDecimal=falseoutputFormatString

    There are two values:

    • Array (default or if missing) (case insensitive)
      • Data will be output as three arrays for a given device: a lineTypes array, a readings array, and a times array.
    • Object (case insensitive)
      • Data will be output as a list of objects for a given device. Inside each data object, there are lineType, rawData, and sampleTime lists.

    outputFormat=array

    outputFormat=object

    getLatestBooleanSpecifies whether or not the latest raw data readings should be returned first. This is false by default. When set to true, readings are returned and pagination is done from latest to earliest.getLatest=trueskipErrorsBoolean

    On rare occasions, badly formatted data without a leading time stamp can be encountered. In these cases the rawdata service will return an error (see below). This option provides a way to skip these instances and return the data.

    skipErrors=true will return all correctly formatted raw data with timestamps

    skipErrors=false (default) will return error message when there are some badly formatted raw data within requested time range

    Example of error message in the return:

    {
    "errors": [
    {
    "errorCode": 143,
    "errorMessage": "Badly formatted raw data could not be returned. Recommend use 'skipErrors=true' option to skip errors and return remaining data. Alternatively, use archivefile service to download raw data."
    }
    ]
    }

    skipErrors=true

    Response

    Success (outputFormat = Array)

    >,
           "outputFormat""object",
           "token": <String>
         },
         "url": <String>
       },
       "queryUrl": <string>
    }


    Property

    Type

    Description

    Example

    dataArray of ObjectsAn array containing the raw data readings and time stamps
    • data.lineType
    StringsA lineType. LineTypes are ">" for CommandSent, " " for DataReceived, and "<" for CommandResponse.
    ">"
    • data.rawData

    String OR Integer Array

    A single raw data reading. If the raw data is text then this is a string. If the raw data is binary then this is an array of integers. If conversion is turned off, a hexadecimal string is returned.

    Text:

    • "2891917878B1F5102C4D16E27AD6B59B00"

    Binary:

    • [60,58,57,0,-70,83]



    Binary: (convertHexToDecimal = false)

    • "a5 01 15 00 04"
    • data.sampleTime
    StringA timestamp. Each timestamp is a string in ISO8601 (extended) format, yyyy-MM-dd'T'HH:mm:ss.SSS'Z'.
    "2014-04-25T00:00:00.005Z"
    nextObjectAn object containing information on how to make a rawdata call if the current call was unable to return all the data as a limit was exceeded. This is null if there is no more data in the requested range.
    • next.parameters
    ObjectAn object containing the set of parameters making up the query to get the next set of data in the requested date range. The parameters will include all parameters passed into the original URL plus dateFrom if dateFrom hadn't been specified.
    "parameters": {
          "method": "getByDevice",
          "rowLimit": "1",
    "deviceCode": "SBECTD19p7128",
    "dateFrom": "2014-04-25T00:00:00.006Z",
    "token": "YOUR_TOKEN_HERE"
    }
      • next.parameters.token
    StringAs passed into the original call
    "YOUR_TOKEN_HERE"
      • next.parameters.method
    StringgetByDevice, as passed into the original call.
    "getByDevice"
      • next.parameters.deviceCode
    StringAs passed into the original call
    "SBECTD19p7128"
      • next.parameters.dateFrom
    StringThis is set to 1 millisecond more than the date of the last reading sent in the current call.
    "2014-04-25T00:00:00.006Z"
      • next.parameters.*
    StringAny optional parameters passed into the original call.
    "dateTo":"2014-04-25T00:00:00.001Z",
    "rowLimit":"5",
    "outputFormat": "object"
    • next.url
    StringThe complete URL that can be used to get the next set of data in the requested range.
    "https://data.oceannetworks.ca/api/rawdata?method=getByDevice&dateTo=2014-04-25T00%3A00%3A00.001Z&deviceCode=SBECTD16p6934&rowLimit=5&dateFrom=2014-04-24T23%3A51%3A00.003Z&token=YOUR_TOKEN_HERE"
    queryUrlStringThe complete URL for the current call.
    "https://data.oceannetworks.ca/api/rawdata?method=getByDevice&token=YOUR_TOKEN_HERE&deviceCode=BARIX001&dateFrom=2017-06-08T00:00:00.000Z&dateTo=2017-06-08T00:00:00.010Z"

    Example Service Call

    https://data.oceannetworks.ca/api/rawdata?method=getByDevice&token=YOUR_TOKEN_HERE&deviceCode=BARIX001&dateFrom=2017-06-08T00:00:00.000Z&dateTo=2017-06-08T00:00:00.010Z

     {
        "data": {
            "lineTypes": [
                ">",
                "<",
                ">"
            ],
            "readings": [
                "version[0d]",
                "version,BARIONET 1.2",
                "getio,201[0d]"
            ],
            "times": [
                "2017-06-08T00:00:00.003Z",
                "2017-06-08T00:00:00.008Z",
                "2017-06-08T00:00:00.009Z"
            ]
        },
        "next"null,
        "queryUrl""https://data.oceannetworks.ca/api/rawdata?method=getByDevice&token=YOUR_TOKEN_HERE&deviceCode=BARIX001&dateFrom=2017-06-08T00:00:00.000Z&dateTo=2017-06-08T00:00:00.010Z"
    }


    Example Service Call with outputFormat parameter

    https://data.oceannetworks.ca/api/rawdata?method=getByDevice&token=YOUR_TOKEN_HERE&deviceCode=BARIX001&dateFrom=2017-06-08T00:00:00.000Z&dateTo=2017-06-08T00:00:00.004Z&outputFormat=object

    Text:

    • [ "2891917878B1F5102C4D16E27AD6B59B00" ]

    Binary:

    • [ [-91,1,21,0,4,86 ],  [60,58,57,0,-70,83]]

    Binary: (convertHexToDecimal = false)

    • [ "a5 01 15 00 04", "3c 3a 39 00 ba 53" ]
    dateTo=2014-04-25T00%3A00%3A00.001Z&deviceCode=SBECTD16p6934&rowLimit=5&dateFrom=2014-04-24T23%3A51%3A00.003Z&token=YOUR_TOKEN_HERE""https://data.oceannetworks.ca/api/rawdata?method=getByDevice&token=YOUR_TOKEN_HERE010Z"

     {
      "data": {
        "lineTypes": <Array of String>,
        "readings": <Array of String> OR <Array of Integer Array>,
        "times": <Array of String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')>
      },
      "next": {
        "parameters": {
          "method""getByDevice",
          "rowLimit": <String>,
          "deviceCode": <String>,
          "dateFrom": <String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')>,
          "outputFormat": <String>,
          "token": <String>
        },
        "url": <String>
      },
      "queryUrl": <String>
    }

    Property

    Type

    Description

    Example

    dataObjectAn object containing the raw data readings and time stamps
    • data.lineTypes
    Array of StringsAn array of lineTypes, one for each reading in the requested date range. LineTypes are ">" for CommandSent, " " for DataReceived, and "<" for CommandResponse.
    [" ",">","<"," "," "," "," ",">"]
    • data.readings

    Array of Strings OR

    Array of Integer Arrays

    An array of readings one for each reading in the requested date range. If the raw data is text then this is an array of strings. If the raw data is binary then each item in the array is an array of integers. If conversion is turned off, array of hexadecimal strings returned.

    • data.times
    Array of StringsAn array of timestamps one for each reading in the requested date range. Each timestamp is a string in ISO8601 (extended) format, yyyy-MM-dd'T'HH:mm:ss.SSS'Z'.
    [ "2014-04-25T00:00:00.005Z" ]
    nextObjectAn object containing information on how to make a rawdata call if the current call was unable to return all the data as a limit was exceeded. This is null if there is no more data in the requested range.
    • next.parameters
    ObjectAn object containing the set of parameters making up the query to get the next set of data in the requested date range. The parameters will include all parameters passed into the original URL plus dateFrom if dateFrom hadn't been specified.
    "parameters": {
          "method": "getByDevice",
          "rowLimit": "1",
    "deviceCode": "SBECTD19p7128",
    "dateFrom": "2014-04-25T00:00:00.006Z",
    "token": "YOUR_TOKEN_HERE"
    }
      • next.parameters.token
    StringAs passed into the original call
    "YOUR_TOKEN_HERE"
      • next.parameters.method
    StringgetByDevice, as passed into the original call.
    "getByDevice"
      • next.parameters.deviceCode
    StringAs passed into the original call
    "SBECTD19p7128"
      • next.parameters.dateFrom
    StringThis is set to 1 millisecond more than the date of the last reading sent in the current call.
    "2014-04-25T00:00:00.006Z"
      • next.parameters.*
    StringAny optional parameters passed into the original call.
    "dateTo":"2014-04-25T00:00:00.001Z",
    "rowLimit":"5",
    "outputFormat": "array"
    • next.url
    StringThe complete URL that can be used to get the next set of data in the requested range.


       "data":[ 
          
             "lineType":">",
             "rawData":"version[0d]",
             "sampleTime":"2017-06-08T00:00:00.001Z"
          },
          
             "lineType":"<",
             "rawData":"version,BARIONET 1.2 Simulator",
             "sampleTime":"2017-06-08T00:00:00.002Z"
          },
          
             "lineType":">",
             "rawData":"getio,201[0d]",
             "sampleTime":"2017-06-08T00:00:00.003Z"
          }
       ],
       "next":null,
       "queryUrl":

    "https://data.oceannetworks.ca/api/rawdata?method=getByDevice&

    queryUrlStringThe complete URL for the current call.

    token=YOUR_TOKEN_HERE&deviceCode=BARIX001&dateFrom=2017-06-08T00:00:00.000Z&dateTo=2017-06-08T00:00:00.

    ...

    ...



    Anchor
    getByLocation
    getByLocation
    getByLocation

    Retrieve the raw data at a given location for the given device category. A date range is optional–when not specified, data from all time will be returned within (possibly default) row and size limits.

    Parameters

    ParameterTypeDescriptionExample
    Required
    tokenStringAll Web Services require a token. This can be generated at http://data.oceannetworks.ca/Profile. Click on the "Web Services" tab and click "Generate Token".token=YOUR_TOKEN_HERE
    locationCodeString

    Return raw data from a specific Location.

    • Location Code must be valid and match exactly, including case.
    • Specific Location Codes can be obtained using the locations service.
    locationCode=SCVIP
    deviceCategoryCodeString

    Return raw data belonging to a specific Device Category Code.

    • Device Category Code must be valid and match exactly, including case.
    • Specific Device Category Codes can be obtained using the deviceCategories service.
    deviceCategoryCode=CTD
    Optional
    dateFromString

    Return raw data that has a timestamp on or after a specific date/time.

    Accepted DateTime formats:

    • yyyy-MM-dd'T'HH:mm:ss.SSS'Z' (ISO 8601 Extended)
    • yyyy-MM-dd (ISO 8601 Extended)
    • PnYnMnDTnHnMnS (ISO 8601 Duration)

    If not specified, the default value is the beginning of time.

    • DateTime is represented in Coordinated Universal Time (UTC).

    • ISO 8601 Extended format without a time will be assumed to mean midnight (T00:00:000.000Z).
    • Queries with both dateFrom and dateTo in the ISO 8601 Duration format will not be accepted.

    dateFrom=2010-07-27T00:00:00.000Z

    dateFrom=2010-07-27

    dateFrom=-P1DT1H

    • Previous 1 day and 1 hour, relative to the dateTo. Note the '-' before the P.
    dateToString

    Return scalar data that has a timestamp before a specific date/time.

    Accepted DateTime formats:

    • yyyy-MM-


       "data":[ 
          
             "lineType": <String>,
             "rawData": <String> OR <Integer Array>,
             "sampleTime": <String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')>
          },
          ...
       ],
       "next": {
         "parameters": {
           "method""getByDevice",
           "rowLimit": <String>,
           "deviceCode": <String>,
           "dateFrom": <String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')>,
           "outputFormat""object",
           "token": <String>
         },
         "url": <String>
       },
       "queryUrl": <string>
    }

    Property

    Type

    Description

    Example

    dataArray of ObjectsAn array containing the raw data readings and time stamps
    • data.lineType
    StringsA lineType. LineTypes are ">" for CommandSent, " " for DataReceived, and "<" for CommandResponse.
    ">"
    • data.rawData

    String OR Integer Array

    A single raw data reading. If the raw data is text then this is a string. If the raw data is binary then this is an array of integers. If conversion is turned off, a hexadecimal string is returned.

    Text:

    • "2891917878B1F5102C4D16E27AD6B59B00"

    Binary:

    • [60,58,57,0,-70,83]

    Binary: (convertHexToDecimal = false)

    • "a5 01 15 00 04"
    • data.sampleTime
    StringA timestamp. Each timestamp is a string in ISO8601 (extended) format, yyyy-MM-
    • dd'T'HH:mm:ss.SSS'Z'
    .
    "2014-04-25T00:00:00.005Z"
    nextObjectAn object containing information on how to make a rawdata call if the current call was unable to return all the data as a limit was exceeded. This is null if there is no more data in the requested range.
    • next.parameters
    ObjectAn object containing the set of parameters making up the query to get the next set of data in the requested date range. The parameters will include all parameters passed into the original URL plus dateFrom if dateFrom hadn't been specified.
    "parameters": {
          "method": "getByDevice",
          "rowLimit": "1",
    "deviceCode": "SBECTD19p7128",
    "dateFrom": "2014-04-25T00:00:00.006Z",
    "token": "YOUR_TOKEN_HERE"
    }
      • next.parameters.token
    StringAs passed into the original call
    "YOUR_TOKEN_HERE"
      • next.parameters.method
    StringgetByDevice, as passed into the original call.
    "getByDevice"
      • next.parameters.deviceCode
    StringAs passed into the original call
    "SBECTD19p7128"
      • next.parameters.dateFrom
    StringThis is set to 1 millisecond more than the date of the last reading sent in the current call.
    "2014-04-25T00:00:00.006Z"
      • next.parameters.*
    StringAny optional parameters passed into the original call.
    "dateTo":"2014-04-25T00:00:00.001Z",
    "rowLimit":"5",
    "outputFormat": "object"
    • next.url
    StringThe complete URL that can be used to get the next set of data in the requested range.
    "https://data.oceannetworks.ca/api/rawdata?method=getByDevice&dateTo=2014-04-25T00%3A00%3A00.001Z&deviceCode=SBECTD16p6934&rowLimit=5&dateFrom=2014-04-24T23%3A51%3A00.003Z&token=YOUR_TOKEN_HERE"
    queryUrlStringThe complete URL for the current call.
    "https://data.oceannetworks.ca/api/rawdata?method=getByDevice&token=YOUR_TOKEN_HERE&deviceCode=BARIX001&dateFrom=2017-06-08T00:00:00.000Z&dateTo=2017-06-08T00:00:00.010Z"

    Example Service Call

    https://data.oceannetworks.ca/api/rawdata?method=getByDevice&token=YOUR_TOKEN_HERE&deviceCode=BARIX001&dateFrom=2017-06-08T00:00:00.000Z&dateTo=2017-06-08T00:00:00.010Z

    ...

     {
        "data": {
            "lineTypes": [
                ">",
                "<",
                ">"
            ],
            "readings": [
                "version[0d]",
                "version,BARIONET 1.2",
                "getio,201[0d]"
            ],
            "times": [
                "2017-06-08T00:00:00.003Z",
                "2017-06-08T00:00:00.008Z",
                "2017-06-08T00:00:00.009Z"
            ]
        },
        "next"null,
        "queryUrl""https://data.oceannetworks.ca/api/rawdata?method=getByDevice&token=YOUR_TOKEN_HERE&deviceCode=BARIX001&dateFrom=2017-06-08T00:00:00.000Z&dateTo=2017-06-08T00:00:00.010Z"
    }

    ...

    If not specified, the default value is the end of time.

    • DateTime is represented in Coordinated Universal Time (UTC).

    • ISO 8601 Extended format without a time will be assumed to mean midnight (T00:00:000.000Z).
    • Queries with both dateFrom and dateTo in the ISO 8601 Duration format will not be accepted.

    dateTo=2016-08-01T00:00:00.000Z

    dateTo=2016-08-01

    dateTo=PT12H30M

    • Next 12 hours and 30 minutes, relative to the dateFrom.
    rowLimitIntegerThe limit on the number of raw data readings to return. If not specified the row limit is 100,000.rowLimit=300
    sizeLimitIntegerThe limit on the size of raw data readings to return specified in MB. If not specified the size limit is 250 MB.sizeLimit=20
    outputFormatString

    Array (default or if missing) (case insensitive)
    data will be output as three arrays for a given device. Array of lineTypes, array of readings, array of times

    Object (case insensitive)
    data will be output as a list of objects for a given device. Inside each data object, there are lineType, rawData, and sampleTime.
    Can be used if the user wants data object to have the same output format of getByStation method.

    outputFormat= array

    outputFormat = object

    getLatestBooleanSpecifies whether or not the latest raw data readings should be returned first. This is false by default. When set to true, readings are returned and pagination is done from latest to earliest.getLatest=true
    skipErrorsBoolean

    In the exceptional case when some portion of the requested data appears damaged, by default this service will return an error (HTTP status code 500, error code 143) with a description of the problem.

    If the user ever comes across this error, it's possible to obtain the original data without the damaged samples by setting the parameter skipErrors=true .

    ONC runs automated tests and has dedicated teams that detect and handle these exceptional cases at the earliest opportunity.

    skipErrors=true


    Response

    Success (outputFormat = Array)

    {
      "data": {
        "lineTypes": <Array of string>,
        "readings": <Array of string> OR <Array of Integer Array>,
        "times": <Array of String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')>
      },
      "metadata": {
        "locationName": <String>
      },
      "next": {
        "parameters": {
          "method""getByLocation",
          "rowLimit": <String>,
          "locationCode": <String>,
          "deviceCategoryCode": <String>,
          "dateFrom": <String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')>,
          "outputFormat": <String>,
          "token": <String>
        },
        "url": <String>
      },
      "queryUrl": <String>
    }



    Property

    Type

    Description

    Example

    dataObjectAn object containing the raw data readings and time stamps
    • data.lineTypes
    Array of StringsAn array of lineTypes, one for each reading in the requested date range. LineTypes are ">" for CommandSent, " " for DataReceived, and "<" for CommandResponse.
    [" "," "," "," "," "," "," "," "]
    • data.readings

    Array of Strings OR

    Array of Integer Arrays

    An array of readings one for each reading in the requested date range. If the raw data is text then this is an array of strings. If the raw data is binary then each item in the array is an array of integers.

    Text:

    • [ "2891917878B1F5102C4D16E27AD6B59B00" ]

    Binary:

    • [ [ -91, 16, 0, 123, 4, 0 ] ]


    • data.times
    Array of StringsAn array of timestamps one for each reading in the requested date range. Each timestamp is a string in ISO8601 (extended) format, yyyy-MM-dd'T'HH:mm:ss.SSS'Z'.
    [ "2014-04-25T00:00:00.005Z" ]
    metadataObjectAn object containing metadata items.

    • metadata.locationName
    StringThe name of the location for the requested location code.
    "Strait of Georgia VENUS Instrument Platform"
    nextObjectAn object containing information on how to make a rawdata call if the current call was unable to return all the data as a limit was exceeded. This is null if there is no more data in the requested range.
    • next.parameters
    ObjectAn object containing the set of parameters making up the query to get the next set of data in the requested date range. The parameters will include all parameters passed into the original URL plus dateFrom if dateFrom hadn't been specified.
    "parameters": {
          "method": "getByLocation",
          "rowLimit": "1",
          "locationCode": "SCVIP",
          "deviceCategoryCode": "CURRENTMETER",
          "dateFrom": "2014-04-25T00:00:00.006Z",
          "token": "YOUR_TOKEN_HERE"
        },
      • next.parameters.token
    StringAs passed into the original call
    "YOUR_TOKEN_HERE"
      • next.parameters.method
    StringgetByLocation, as passed into the original call.
    "getByLocation"
      • next.parameters.locationCode
    StringAs passed into the original call
    "SCVIP"
      • next.parameters.deviceCategoryCode
    StringAs passed into the original call
    "CURRENTMETER"
      • next.parameters.dateFrom
    StringThis is set to 1 millisecond more than the date of the last reading returned in the current call.
    "2014-04-25T00:00:00.006Z"
      • next.parameters.*
    StringAny optional parameters passed into the original call.
    "dateTo":"2009-08-15T17:50:00.000Z",
    "rowLimit": "1",
    "outputFormat": "object"
    • next.url
    StringThe complete URL that can be used to get the next set of data in the requested range.
    https://data.oceannetworks.ca/api/rawdata?
    method=

    ...

    getByLocation&

    ...

    rowLimit=1&locationCode=SCVIP&deviceCategoryCode=CURRENTMETER&
    token=YOUR_TOKEN_HERE&
    dateFrom=2014-04-25T00%3A00%3A00.006Z
    queryUrlStringThe complete URL for the current call.
    "https://data.oceannetworks.ca/api/rawdata?method=getByLocation&locationCode=NCBC&deviceCategoryCode=BPR&dateFrom=2009-07-24T17:50:00.000Z&rowLimit=5&token=YOUR_TOKEN_HERE"


    Success (outputFormat = Object)

    {
      "data":[ 
         
            "lineType": <String>,
            "rawData": <String> OR <Integer Array>,
            "sampleTime": <String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')>
         },
         ...
      ],
      "metadata": {
        "locationName": <String>
      },
      "next": {
        "parameters": {
          "method""getByLocation",
          "rowLimit": <String>,
          "locationCode": <String>,
          "deviceCategoryCode": <String>,
          "dateFrom": <String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')>,
          "outputFormat": <String>,
          "token": <String>
        },
        "url": <String>
      },
      "queryUrl": <String>
    }



    ...


       "data":[ 
          
             "lineType":">",
             "rawData":"version[0d]",
             "sampleTime":"2017-06-08T00:00:00.001Z"
          },
          
             "lineType":"<",
             "rawData":"version,BARIONET 1.2 Simulator",
             "sampleTime":"2017-06-08T00:00:00.002Z"
          },
          
             "lineType":">",
             "rawData":"getio,201[0d]",
             "sampleTime":"2017-06-08T00:00:00.003Z"
          }
       ],
       "next":null,
       "queryUrl":"https://data.oceannetworks.ca/api/rawdata?method=getByDevice&token=YOUR_TOKEN_HERE&deviceCode=BARIX001&dateFrom=2017-06-08T00:00:00.000Z&dateTo=2017-06-08T00:00:00.004Z&outputFormat=object"
    }

    ...

    Retrieve the raw data at a given location for the given device category. A date range is optional–when not specified, data from all time will be returned within (possibly default) row and size limits.

    Parameters

    ParameterTypeDescriptionExampleRequiredtokenStringAll Web Services require a token. This can be generated at http://data.oceannetworks.ca/Profile. Click on the "Web Services" tab and click "Generate Token".token=YOUR_TOKEN_HERElocationCodeString

    Return raw data from a specific Location.

    • Location Code must be valid and match exactly, including case.
    • Specific Location Codes can be obtained using the locations service.
    locationCode=SCVIPdeviceCategoryCodeString

    Return raw data belonging to a specific Device Category Code.

    • Device Category Code must be valid and match exactly, including case.
    • Specific Device Category Codes can be obtained using the deviceCategories service.
    deviceCategoryCode=CTDOptionaldateFromString

    Return raw data that has a timestamp on or after a specific date/time.

    Accepted DateTime formats:

    • yyyy-MM-dd'T'HH:mm:ss.SSS'Z' (ISO 8601 Extended)
    • yyyy-MM-dd (ISO 8601 Extended)
    • PnYnMnDTnHnMnS (ISO 8601 Duration)

    If not specified, the default value is the beginning of time.

    • DateTime is represented in Coordinated Universal Time (UTC).

    • ISO 8601 Extended format without a time will be assumed to mean midnight (T00:00:000.000Z).
    • Queries with both dateFrom and dateTo in the ISO 8601 Duration format will not be accepted.

    dateFrom=2010-07-27T00:00:00.000Z

    dateFrom=2010-07-27

    dateFrom=-P1DT1H

    • Previous 1 day and 1 hour, relative to the dateTo. Note the '-' before the P.
    dateToString

    Return scalar data that has a timestamp before a specific date/time.

    Accepted DateTime formats:

    Property

    Type

    Description

    Example

    dataArray of ObjectsAn array containing the raw data readings and time stamps
    • data.lineType
    StringA lineType. LineTypes are ">" for CommandSent, " " for DataReceived, and "<" for CommandResponse.
    ">"
    • data.rawData

    String OR Integer Array

    A single raw data reading. If the raw data is text then this is a string. If the raw data is binary then this is an array of integers. If conversion is turned off, a hexadecimal string is returned.

    Text:

    • "2891917878B1F5102C4D16E27AD6B59B00"

    Binary:

    • [60,58,57,0,-70,83]



    Binary: (convertHexToDecimal = false)

    • "a5 01 15 00 04"
    • data.sampleTime
    StringA timestamp. Each timestamp is a string in ISO8601 (extended) format, 
    yyyy-MM-dd'T'HH:mm:ss.SSS
    'Z' (ISO 8601 Extended)
  • yyyy-MM-dd (ISO 8601 Extended)
  • PnYnMnDTnHnMnS (ISO 8601 Duration)
  • 'Z'.
    "2014-04-25T00

    If not specified, the default value is the end of time.

    • DateTime is represented in Coordinated Universal Time (UTC).

    • ISO 8601 Extended format without a time will be assumed to mean midnight (T00:00:000.000Z).
    • Queries with both dateFrom and dateTo in the ISO 8601 Duration format will not be accepted.
    dateTo=2016-08-01T00
    :00:00.
    000Z

    dateTo=2016-08-01

    dateTo=PT12H30M

    • Next 12 hours and 30 minutes, relative to the dateFrom.
    rowLimitIntegerThe limit on the number of raw data readings to return. If not specified the row limit is 100,000.rowLimit=300sizeLimitIntegerThe limit on the size of raw data readings to return specified in MB. If not specified the size limit is 250 MB.sizeLimit=20outputFormatString

    Array (default or if missing) (case insensitive)
    data will be output as three arrays for a given device. Array of lineTypes, array of readings, array of times

    Object (case insensitive)
    data will be output as a list of objects for a given device. Inside each data object, there are lineType, rawData, and sampleTime.
    Can be used if the user wants data object to have the same output format of getByStation method.

    outputFormat= array

    outputFormat = object

    getLatestBooleanSpecifies whether or not the latest raw data readings should be returned first. This is false by default. When set to true, readings are returned and pagination is done from latest to earliest.getLatest=trueskipErrorsBoolean

    On rare occasions, badly formatted data without a leading time stamp can be encountered. In these cases the rawdata service will return an error (see below). This option provides a way to skip these instances and return the data.

    skipErrors=true will return all correctly formatted raw data with timestamps

    skipErrors=false (default) will return error message when there are some badly formatted raw data within requested time range

    Example of error message in the return:

    {
    "errors": [
    {
    "errorCode": 143,
    "errorMessage": "Badly formatted raw data could not be returned. Recommend use 'skipErrors=true' option to skip errors and return remaining data. Alternatively, use archivefile service to download raw data."
    }
    ]
    }

    skipErrors=true

    Response

    Success (outputFormat = Array)

    ...

    {
      "data": {
        "lineTypes": <Array of string>,
        "readings": <Array of string> OR <Array of Integer Array>,
        "times": <Array of String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')>
      },
      "metadata": {
        "locationName": <String>
      },
      "next": {
        "parameters": {
          "method""getByLocation",
          "rowLimit": <String>,
          "locationCode": <String>,
          "deviceCategoryCode": <String>,
          "dateFrom": <String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')>,
          "outputFormat": <String>,
          "token": <String>
        },
        "url": <String>
      },
      "queryUrl": <String>
    }

    ...

    Property

    ...

    Type

    ...

    Description

    ...

    Example

    ...

    • data.lineTypes

    ...

    [" "," "," "," "," "," "," "," "]

    ...

    • data.readings

    ...

    Array of Strings OR

    Array of Integer Arrays

    ...

    An array of readings one for each reading in the requested date range. If the raw data is text then this is an array of strings. If the raw data is binary then each item in the array is an array of integers.

    Text:

    • [ "2891917878B1F5102C4D16E27AD6B59B00" ]

    Binary:

    • [ [ -91, 16, 0, 123, 4, 0 ] ]

    ...

    • data.times

    ...

    [ "2014-04-25T00:00:00.005Z" ]

    ...

    • metadata.locationName

    ...

    "Strait of Georgia VENUS Instrument Platform"

    ...

    • next.parameters

    ...

    "parameters": {
          "method": "getByLocation",
          "rowLimit": "1",
          "locationCode": "SCVIP",
          "deviceCategoryCode": "CURRENTMETER",
          "dateFrom": "2014-04-25T00:00:00.006Z",
          "token": "YOUR_TOKEN_HERE"
        },

    ...

      • next.parameters.token

    ...

    "YOUR_TOKEN_HERE"

    ...

      • next.parameters.method

    ...

    "getByLocation"

    ...

      • next.parameters.locationCode

    ...

    "SCVIP"

    ...

      • next.parameters.deviceCategoryCode

    ...

    "CURRENTMETER"

    ...

      • next.parameters.dateFrom

    ...

    "2014-04-25T00:00:00.006Z"

    ...

      • next.parameters.*

    ...

    "dateTo":"2009-08-15T17:50:00.000Z",
    "rowLimit": "1",
    "outputFormat": "object"

    ...

    • next.url

    ...

    https://data.oceannetworks.ca/api/rawdata?
    method=getByLocation&rowLimit=1&locationCode=SCVIP&deviceCategoryCode=CURRENTMETER&
    token=YOUR_TOKEN_HERE&
    dateFrom=2014-04-25T00%3A00%3A00.006Z

    ...

    "https://data.oceannetworks.ca/api/rawdata?method=getByLocation&locationCode=NCBC&deviceCategoryCode=BPR&dateFrom=2009-07-24T17:50:00.000Z&rowLimit=5&token=YOUR_TOKEN_HERE"

    Success (outputFormat = Object)

    ...

    {
      "data":[ 
         
            "lineType": <String>,
            "rawData": <String> OR <Integer Array>,
            "sampleTime": <String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')>
         },
         ...
      ],
      "metadata": {
        "locationName": <String>
      },
      "next": {
        "parameters": {
          "method""getByLocation",
          "rowLimit": <String>,
          "locationCode": <String>,
          "deviceCategoryCode": <String>,
          "dateFrom": <String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')>,
          "outputFormat": <String>,
          "token": <String>
        },
        "url": <String>
      },
      "queryUrl": <String>
    }

    ...

    Property

    ...

    Type

    ...

    Description

    ...

    Example

    ...

    • data.lineType

    ...

    ">"

    ...

    • data.rawData

    ...

    String OR Integer Array

    ...

    A single raw data reading. If the raw data is text then this is a string. If the raw data is binary then this is an array of integers. If conversion is turned off, a hexadecimal string is returned.

    Text:

    • "2891917878B1F5102C4D16E27AD6B59B00"

    Binary:

    • [60,58,57,0,-70,83]

    Binary: (convertHexToDecimal = false)

    • "a5 01 15 00 04"

    ...

    • data.sampleTime

    ...

    "2014-04-25T00:00:00.005Z"

    ...

    • metadata.locationName

    ...

    "Strait of Georgia VENUS Instrument Platform"

    ...

    • next.parameters

    ...

    "parameters": {
          "method": "getByLocation",
          "rowLimit": "1",
          "locationCode": "SCVIP",
          "deviceCategoryCode": "CURRENTMETER",
          "dateFrom": "2014-04-25T00:00:00.006Z",
          "token": "YOUR_TOKEN_HERE"
        },

    ...

      • next.parameters.token

    ...

    "YOUR_TOKEN_HERE"

    ...

      • next.parameters.method

    ...

    "getByLocation"

    ...

      • next.parameters.locationCode

    ...

    "SCVIP"

    ...

      • next.parameters.deviceCategoryCode

    ...

    "CURRENTMETER"

    ...

      • next.parameters.dateFrom

    ...

    "2014-04-25T00:00:00.006Z"

    ...

      • next.parameters.*

    ...

    "dateTo":"2009-08-15T17:50:00.000Z",
    "rowLimit": "1",
    "outputFormat": "object"

    ...

    • next.url

    ...

    https://data.oceannetworks.ca/api/rawdata?
    method=getByLocation&rowLimit=1&locationCode=SCVIP&deviceCategoryCode=CURRENTMETER&
    token=YOUR_TOKEN_HERE&
    dateFrom=2014-04-25T00%3A00%3A00.006Z

    ...

    "https://data.oceannetworks.ca/api/rawdata?method=getByLocation&locationCode=NCBC&deviceCategoryCode=BPR&dateFrom=2009-07-24T17:50:00.000Z&rowLimit=5&token=YOUR_TOKEN_HERE"

    Examples

    Get 5 raw data readings for BPR data from Barkley Canyon Upper Slope (NCBC):

    ...

    005Z"
    metadataObjectAn object containing metadata items.

    • metadata.locationName
    StringThe name of the location for the requested location code.
    "Strait of Georgia VENUS Instrument Platform"
    nextObjectAn object containing information on how to make a rawdata call if the current call was unable to return all the data as a limit was exceeded. This is null if there is no more data in the requested range.
    • next.parameters
    ObjectAn object containing the set of parameters making up the query to get the next set of data in the requested date range. The parameters will include all parameters passed into the original URL plus dateFrom if dateFrom hadn't been specified.
    "parameters": {
          "method": "getByLocation",
          "rowLimit": "1",
          "locationCode": "SCVIP",
          "deviceCategoryCode": "CURRENTMETER",
          "dateFrom": "2014-04-25T00:00:00.006Z",
          "token": "YOUR_TOKEN_HERE"
        },
      • next.parameters.token
    StringAs passed into the original call
    "YOUR_TOKEN_HERE"
      • next.parameters.method
    StringgetByLocation, as passed into the original call.
    "getByLocation"
      • next.parameters.locationCode
    StringAs passed into the original call
    "SCVIP"
      • next.parameters.deviceCategoryCode
    StringAs passed into the original call
    "CURRENTMETER"
      • next.parameters.dateFrom
    StringThis is set to 1 millisecond more than the date of the last reading returned in the current call.
    "2014-04-25T00:00:00.006Z"
      • next.parameters.*
    StringAny optional parameters passed into the original call.
    "dateTo":"2009-08-15T17:50:00.000Z",
    "rowLimit": "1",
    "outputFormat": "object"
    • next.url
    StringThe complete URL that can be used to get the next set of data in the requested range.
    https://data.oceannetworks.ca/api/rawdata?
    method=getByLocation&rowLimit=1&locationCode=SCVIP&deviceCategoryCode=CURRENTMETER&
    token=YOUR_TOKEN_HERE&
    dateFrom=2014-04-25T00%3A00%3A00.006Z
    queryUrlStringThe complete URL for the current call.
    "https://data.oceannetworks.ca/api/rawdata?method=getByLocation&locationCode=NCBC&deviceCategoryCode=BPR&dateFrom=2009-07-24T17:50:00.000Z&rowLimit=5&token=YOUR_TOKEN_HERE"

    Examples

    Get 5 raw data readings for BPR data from Barkley Canyon Upper Slope (NCBC):

    {
      "data": {
        "lineTypes": [
          " ",
          " ",
          " ",
          " ",
          " "
        ],
        "readings": [
          "379B562059B0ECB82CA529C0783C479400",
          "379B562159B0EC6B2CA529C4783C470D00",
          "379B562259B0ED0F2CA529BB783C453400",
          "379B562359B0ED892CA529BD783C44D100",
          "379B562459B0ECEA2CA529BC783C461400"
        ],
        "times": [
          "2017-07-24T17:50:00.062Z",
          "2017-07-24T17:50:01.061Z",
          "2017-07-24T17:50:02.065Z",
          "2017-07-24T17:50:03.069Z",
          "2017-07-24T17:50:04.064Z"
        ]
      },
      "metadata": {
        "locationName""Upper Slope"
      },
      "next": {
        "parameters": {
          "method""getByLocation",
          "rowLimit""5",
          "locationCode""NCBC",
          "deviceCategoryCode""BPR",
          "dateFrom""2017-07-24T17:50:04.065Z",
          "token""YOUR_TOKEN_HERE"
        },
        "url""https://data.oceannetworks.ca/api/rawdata?method=getByLocation&rowLimit=5&locationCode=NCBC&deviceCategoryCode=BPR&dateFrom=2017-07-24T17%3A50%3A04.065Z&token=YOUR_TOKEN_HERE
      },
      "queryUrl""https://data.oceannetworks.ca/api/rawdata?method=getByLocation&locationCode=NCBC&deviceCategoryCode=BPR&dateFrom=2017-07-24T17:50:00.000Z&rowLimit=5&token=YOUR_TOKEN_HERE
    }


    Get 1 raw data reading for Current Meter (CURRENTMETER) data from Strait of Georgia VENUS Instrument Platform (SCVIP):

    {
      "data": {
        "lineTypes": [
          " "
        ],
        "readings": [
          [
            -91,
            16,
            0,
            -50,
            4,
            0,
            -99,
            -95,
            0,
            0,
            -2,
            0,
            65,
            0,
            -48,
            -2,
            95,
            89,
            90,
            99,
            97,
            96,
            -5,
            82
          ]
        ],
        "times": [
          "2014-04-25T00:00:00.087Z"
        ]
      },
      "metadata": {
        "locationName""Strait of Georgia VENUS Instrument Platform"
      },
      "next": {
        "parameters": {
          "method""getByLocation",
          "rowLimit""1",
          "locationCode""SCVIP",
          "deviceCategoryCode""CURRENTMETER",
          "dateFrom""2014-04-25T00:00:00.088Z",
          "token""YOUR_TOKEN_HERE"
        },
        "url""https://data.oceannetworks.ca/api/rawdata?method=getByLocation&rowLimit=1&locationCode=SCVIP&deviceCategoryCode=CURRENTMETER&dateFrom=2014-04-25T00%3A00%3A00.088Z&token=YOUR_TOKEN_HERE
      },
      "queryUrl""https://data.oceannetworks.ca/api/rawdata?method=getByLocation&locationCode=SCVIP&deviceCategoryCode=CURRENTMETER&token=YOUR_TOKEN_HERE&dateFrom=2014-04-25T00:00:00.000Z&rowLimit=1"
    }



    Anchor
    getByStation
    getByStation
    getByStation

    Expand
    titleDeprecated. Click here to expand...

    Retrieve raw data available at given station. Data can be most recent from instruments, or data that's been archived in a raw data file.

    Parameters

    ParameterTypeDescriptionExample
    Required
    tokenstringuser tokentoken=YOUR_TOKEN_HERE
    stationstringstation code (corresponds with a search tree node, the one used in Data Search page) station=IONA
    deviceCategorystringused to select which category of instruments at the station to use. Corresponds with the name column in the device category tabledeviceCategory=AISRECEIVER
    Optional
    dateFromstringISO8601 (extended) Date for the start time of the data. If not given, defaults to one hour before current time, so that last hour of data is returned (if there is data in the last hour), up to rowLimit number of rows.dateFrom=2012-01-02T00:12:42.000Z
    dateTostring

    ISO8601 (extended) Date for end time of data. Defaults to the current time if not provided.

    If no dateFrom is given and a dateTo is given, a date range error will be returned.

    The max amount of data returned will be rowLimit.

    dateTo=2012-01-02T00:13:42.000Z 
    rowLimitinteger

    The maximum number of data to return, within the constraints of the service. Note this will limit the data starting at the start time and ending at the row limit, not necessarily at the end time.

    default row limit: 100000

    Treat negative or 0 rowLimit as max rowLimit. Treat rowLimit > maxRowLimit as max row limit.

    rowLimit=10
    skipErrorsBoolean

    In the exceptional case when some portion of the requested data appears damaged, by default this service will return an error (HTTP status code 500, error code 143) with a description of the problem.

    If the user ever comes across this error, it's possible to obtain the original data without the damaged samples by setting the parameter skipErrors=true .

    ONC runs automated tests and has dedicated teams that detect and handle these exceptional cases at the earliest opportunity.

    skipErrors=true

    Response

    Success


    Sample <responseType> Response

    {  
        "data" : [
                  {
                    "rawData": <string>,
                    "sampleTime": <string>
                  },
                    ...
        ],
        "metadata": {
            "queryMetadata": {
                "stationCode" : <string>,
                "dateFrom"            : <string>,
                "dateTo"          : <string>,
                "deviceCategory"  : <string>,
                "rowLimit"            : <integer>
            }
            "dataMetadata": {
                "numberOfData"    : <integer>,
                "firstTimestamp"  : <string>,
                "lastTimestamp"       : <string>,
                "stationName"     : <string>,
                "hasMoreDataInRange": <boolean>
            }
        }
    }



    Property

    Type

    Description

    Example

    dataarray of objectsThe array containing the requested data, including the sample time and the raw data for each reading time.

    data.sampleTimestringThe sample time for a single reading time. ISO8601 Extended Format.
    "2015-09-01T00:21:21.000Z"
    data.rawDatastringThe string of raw data for the sampleTime
    "\c:1441212680,C:776,s:P-Cumshewa*1E\!AIVDO,1,1,9,A,4030p;1uvA@kDnSi;fNJgk7008<8,0*47"
    metadataobjectThe metadata for the query and data 
    metadata.queryMetadataobjectThe metadata for the query
    metadata.queryMetadata.stationCodestring

    part of the query metadata. The station code (search tree node code) that was queried

    "IONA"
    metadata.queryMetadata.deviceCategorystringpart of the query metadata. the device category requested.
    "AISRECEIVER"
    metadata.queryMetadata.dateFromstringpart of the query metadata. string date used in the query for the start time of the data
    "2015-09-01T00:21:21.000Z"
    metadata.queryMetadata.dateTostringpart of the query metadata. string ISO8601 date used in the query for the end time of the data. Can be null.
    "2015-09-18T02:23:21.000Z"
    metadata.queryMetadata.rowLimitintegerpart of the query metadata. the value given, if any, in the query limiting the size of the data
    100000
    metadata.dataMetadataobjectThe metadata for the data itself
    metadata.dataMetadata.numberOfDataintegerpart of the data metadata. the number of rows of data returned in the query
    100000
    metadata.dataMetadata.firstTimestampstringpart of the data metadata. string ISO8601 representing the first timestamp returned
    "2015-09-01T00:21:21.123Z"
    metadata.dataMetadata.lastTimestampstringpart of the data metadata. string ISO8601 representing the last timestamp returned
    "2015-09-01T03:22:18.908Z"
    metadata.dataMetadata.stationNamestringpart of the data metadata. The name of the station (device)
    "Iona Shore Station"
    metadata.dataMetadata.hasMoreDataInRangebooleanpart of the data metadata. Indicates whether all the data was returned with the query or whether more data is available in the requested range.
    true

    Example

    Get raw data from an AIS receiver at Iona Shore Station from the beginning of time to the present with the default 100,000-row limit:

    http

    ...

    ://data.oceannetworks.ca/api/rawdata?method=

    ...

    getByStation&

    ...

    deviceCategory=

    ...

    AISRECEIVER&

    ...

    station=IONA&token=YOUR_TOKEN_HERE

    ...

    Get

    ...

    data from AIS receiver at Iona Shore Station starting from September 1, 2015, at 21 minutes and 21 seconds after midnight:

     http://data.oceannetworks.ca/api/rawdata?

    ...

    token=YOUR_TOKEN_HERE&method=getByStation&station=IONA&deviceCategory=AISRECEIVER&dateFrom=2015-09-01T00:21:21.000Z


    {"data":
         [
          {
           "rawData":"\\c:1441061153,C:1990,s:P-Parke*58\\!AIVDM,2,1,8,B,55NP0eP26m;5L@O?CC0Lu8@tr0`Dq<Dr2222220N9@J885Kd0?4i@E531H88,0*79",
           "sampleTime":"2015-09-01T00:21:21.123Z"
           },
          {
            "rawData":"\\c:1441061153,C:1990,s:P-Parke*58\\!AIVDM,2,2,8,B,88888888880,2*2F",
            "sampleTime":"2015-09-01T00:21:21.250Z"
           },
           {
              "rawData":"\\c:1441061153,C:1992,s:P-Helmcken*38\\!AIVDM,1,1,,B,15N;600P1Do>6CjKe>iG8Owb26jl,0*57",
              "sampleTime":"2015-09-01T00:21:21.352Z"},
           ...
         }],
        "metadata":
              {"dataMetadata": {
                      "firstTimestamp":"2015-09-01T00:21:21.123Z",
                      "hasMoreDataInRange":false,
                      "lastTimestamp":"2015-09-01T01:02:08.013Z",
                      "numberOfData":100000,
                      "stationName":"Iona Shore Station"
                     },
              "queryMetadata":{
                     "deviceCategory":"AISRECEIVER",
                     "dateTo":null,
                     "rowLimit":null,
                     "dateFrom":"2015-09-01T00:21:21.000Z",
                     "stationCode":"IONA"
              }
         }
    }