Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
h2. *Description*

_See the _[External Web Services|http://internal.neptunecanada.ca/display/DS/External+Web+Services]_ for method, token, and responseType usage and error messages._

Gets the most recent raw data from an instrument, or raw data between two given dates.
If no time is specified, the data will be limited to the last hour of data.
If time is specified, the data is limited to 100,000 rows.
h3. URL

| http://dmas.uvic.ca/api/rawdata|

|| Method || Description || Example ||
| [getByStation|#getByStation] | Retrieve raw data available at given station. | method={{getByStation}} |
h2. getByStation

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.

h3.Parameters

|| Parameter || Type || Description || Example ||
|| {color:#993300}*Required*{color} |
| token| String| User Token | token={{1234567890adbcde123}} |
|station| string  |station code (corresponds with a search tree node, the one used in Data Search page) |station={{IONA}}|
|deviceCategory|string|used to select which category of instruments at the station to use. 
Corresponds with the name column in the device category table. | deviceCategory={{DEVICECATEGORY}} \\e.g., deviceCategory=AISRECEIVER |
|| {color:#993300}*Optional*{color} |
|dateFrom|string|ISO8601 (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={{2015-01-02T00:12:42.000Z}}|
|dateTo | string | 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={{2015-12-31T23:59:59.000Z}}|
|rowLimit | integer | 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={{5000}}|


h3. Response


h4. Success
{code} {   "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}
        }
    }
}{code}

|| Property || Type || Description || Example ||
| data| string | The string containing the requested data, including the sample time and the raw data for each reading time |  |
| sampleTime| integer | The sample time for a single reading time. ISO8601 Extended Format. | {{2015-09-01T00:21:21.000Z}}|
| rawData| string | The 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"}}|
| metadata| string| The metadata for the query and data | |
|queryMetadata |string | The metadata for the query itself| |
|* stationCode | string | Query metadata: The station code (search tree node code) that was queried. | |
|* deviceCategory | string |Query metadata: the device category requested.| |
|* dateFrom | string | Query metadata: string date used in the query for the start time of the data| |
|* dateTo | string | Query metadata: string date used in the query for the end time of the data||
|* rowLimit| integer| Query metadata: the value given, if any, in the query limiting the size of the data| |
|dataMetadata |string | The metadata for the data itself| |
|* numberOfData |integer|Data metadata: the number of rows of data returned in the query. | |
|* firstTimeStamp|string|Data metadata: string ISO8601 representing the first timestamp returned. | |   
|* lastTimeStamp|string|Data metadata: string ISO8601 representing the last timestamp returned. | |  
|* stationName|string|Data metadata: name of the station (device)| |  
|* hasMoreDataInRange | boolean | Data metadata: indicates whether all the data was returned with the query or whether more data is available in the requested range.  | |



h3. Example

Get most recent hour of raw data from an AIS receiver at Iona Shore Station:
http://dmas.uvic.ca/api/rawdata?method=getByStation&deviceCategory=AISRECEIVER&station=IONA&token=SAMPLETOKEN1234567893c6cc174-9b36-44b6-8dd5-e9a562c93ae2
Get data from AIS receiver at Iona Shore Station starting from September 1, 2015, at 21 minutes and 21 seconds after midnight:
 http://dmas.uvic.ca/api/rawdata?token=123431231231233c6cc174-9b36-44b6-8dd5-e9a562c93ae2&method=getByStation&station=IONA&deviceCategory=AISRECEIVER&dateFrom=2015-09-01T00:21:21.000Z

...