h2. *Description*
_See the _[External Web Services|help:API]_ for method, token, and responseType usage and error messages._
API {color:#0000ff}{*}{_}archivefiles _{*}{color}allows user to search for available files in a station and download the file.
h3. URL
| [http://dmas.uvic.ca/api/archivefiles] |
|| Method || Description || Example ||
| [getList|http://internal.neptunecanada.ca/#archivefiles-getList] | Get a list of files for a given station, and filtered by others optional parameters. | method=getList |
| [getFile|http://internal.neptunecanada.ca/#archivefiles-getFile] | Download a file from DMAS Archiving System by specifying the file name. | method=getFile |
h2. getList
Get a list of files available in DMAS Archiving System for a given station. The list of filenames can be filtered by device category and time range.
h3. *Parameters*
|| Parameter || Type || Description || Example ||
| {color:#993300}{*}Required{*}{color} |
| station | string | Station code defined by DMAS. | |
| token | string | Credential token. | |
| {color:#993300}{*}Optional{*}{color} |
| deviceCategory | string | Device category code defined by DMAS. | |
| dateFrom | date | The date (in "yyyy-MM-ddTHH:mm:ss.SSSZ" format). | 2010-02-15T00:00:00.000Z |
| dateTo | date | The date (in "yyyy-MM-ddTHH:mm:ss.SSSZ" format). | 2010-03-15T18:00:00.000Z |
| dateArchivedFrom | date | The date (in "yyyy-MM-ddTHH:mm:ss.SSSZ" format). | 2010-04-15T00:00:00.000Z |
| dateArchivedTo | date | The date (in "yyyy-MM-ddTHH:mm:ss.SSSZ" format). | 2010-07-15T22:30:00.000Z |
| returnOptions | string | If there is no value given, only a list of filenames will be returned. \\
If the value is "all" there are more metadata information will be returned. | |
h3. Response
h4. Success
HTTP status code 200 will be returned in HTTP header.
If "returnOption" parameter is "all", a list of file names with their metadata information will be returned.
* Order of list will be by dateFrom ascending
{code}
[
{
"archivedDate": {date},
"compression": {string},
"dataProductFormatId": {integer}
"dateFrom": {date},
"dateTo": {date},
"deviceId":{integer},
"fileSize": {long},
"filename": {string},
"modifyDate": {date},
"uncompressedFileSize": {long}
},
]{code}
|| Property || Type || Description || Example ||
| archivedDate | date | The time stamp of current file in AD while it is archived | 2010-04-21T00:00:00.000Z |
| compressedSize | long | File size, in bytes, after compressed with GZip | |
| compression | string | The file extension if the file is compressed | gz |
| dataProductFormatId | integer | Data product format ID | 8 |
| dateFrom | date | The beginning time stamp the data is recorded in the file | 2010-04-21T00:00:00.000Z |
| dateModified | date | The last time stamp of any modification related to the file | 2010-04-22T01:55:00.000Z |
| dateTo | date | The end time stamp the data is recorded in the file | 2010-04-22T00:00:00.000Z |
| deviceId | integer | Device ID | |
| filename | string | The name of the file | |
| uncompressedSize | long | Original file size, in bytes, without compressed | |
If "returnOptions" parameter is NOT set, only a list of file names will be returned in JSON array object.
{code}[
{string},
{string}
]{code}
|| Type || Description || Example ||
| string | The name of the file | "BIOSONICSDTXU08003_20100129T000000.000Z.txt" |
h4.Sample syntax
[http://dmas.uvic.ca/api/archivefiles?method=getList&token=YOUR-TOKEN&station=FPDP.J1&deviceCategory=HYDROPHONE&dateFrom=2010-02-26T18:38:00.000Z&dateTo=2010-02-26T19:04:00.000Z&returnOptions=all]
{code}[
{
"archivedDate": "2010-02-26T19:29:15.000Z",
"compression": "gz",
"dataProductFormatId": 8,
"dateFrom": "2010-02-26T18:38:23.000Z",
"dateTo": "2010-02-26T18:43:28.000Z",
"deviceId": 21601,
"fileSize": 29325540,
"filename": "NAXYS_HYD_P004_20100226T183823.766Z.wav",
"modifyDate": "2010-02-26T19:29:15.000Z",
"uncompressedFileSize": 57600044
},
{
"archivedDate": "2010-03-17T19:11:41.000Z",
"compression": "gz",
"dataProductFormatId": 8,
"dateFrom": "2010-02-26T18:43:28.000Z",
"dateTo": "2010-02-26T18:48:28.000Z",
"deviceId": 21601,
"fileSize": 29092930,
"filename": "NAXYS_HYD_P004_20100226T184328.414Z.wav",
"modifyDate": "2010-03-17T19:11:41.000Z",
"uncompressedFileSize": 57600044
},
{
"archivedDate": "2010-02-26T18:53:34.000Z",
"compression": "gz",
"dataProductFormatId": 8,
"dateFrom": "2010-02-26T18:48:28.000Z",
"dateTo": "2010-02-26T18:53:34.000Z",
"deviceId": 21601,
"filename": "NAXYS_HYD_P004_20100226T184828.572Z.wav"
},
{
"archivedDate": "2010-03-17T23:17:50.000Z",
"compression": "gz",
"dataProductFormatId": 8,
"dateFrom": "2010-02-26T18:53:34.000Z",
"dateTo": "2010-02-26T18:58:34.000Z",
"deviceId": 21601,
"fileSize": 28719719,
"filename": "NAXYS_HYD_P004_20100226T185334.825Z.wav",
"modifyDate": "2010-03-17T23:17:50.000Z",
"uncompressedFileSize": 57600044
},
{
"archivedDate": "2010-02-26T20:40:40.000Z",
"compression": "gz",
"dataProductFormatId": 8,
"dateFrom": "2010-02-26T18:58:34.000Z",
"dateTo": "2010-02-26T19:03:34.000Z",
"deviceId": 21601,
"fileSize": 28891774,
"filename": "NAXYS_HYD_P004_20100226T185834.820Z.wav",
"modifyDate": "2010-02-26T20:40:40.000Z",
"uncompressedFileSize": 57600044
}
]
{code}
[http://dmas.uvic.ca/api/archivefiles?method=getList&token=YOUR-TOKEN&station=FPDP.J1&dateFrom=2012-03-05T00:00:00.000Z&dateTo=2012-03-06T00:00:00.000Z]
{code}[
"RDIADCP300WH15551_20120305T000000.000Z.rdi",
"RDIADCP300WH15551_20120305T000000.000Z.txt",
"RDIADCP300WH15551_20120305T060000.000Z.rdi",
"RDIADCP300WH15551_20120305T120000.000Z.rdi"
]{code}
h2. getFile
Download a file from DMAS Archiving System by specifying the file name. The file will be downloaded without any compression.
h3. *Parameters*
|| Parameter || Type || Description || Example ||
| {color:#993300}{*}Required{*}{color} |
| filename | string | A valid name of a file in DMAS Archiving System. | {color:#003366}NAXYS_02345_P008_20100107T185747.660Z.wav{color} |
| token | string | Credential token. | |
h3. Response
h4. Success
HTTP status code 200 will be returned in HTTP header and the requested file will be downloaded.
h4. Sample syntax
[NAXYS_02345_P008_20100107T185747.660Z.wav" class="external-link" rel="nofollow"linktype="raw" wikidestination="http://dmas.uvic.ca/api/archivefiles?method=getFile&token=YOUR-TOKEN&filename=NAXYS_02345_P008_20100107T185747.660Z.wav" originalalias="http://dmas.uvic.ca/api/archivefiles?method=getFile&token=SAMPLETOKEN123456789&filename=NAXYS_02345_P008_20100107T185747.660Z.wav" >http://dmas.uvic.ca/api/archivefiles?method=getFile&token=SAMPLETOKEN123456789&filename=NAXYS_02345_P008_20100107T185747.660Z.wav|http://dmas.uvic.ca/api/archivefiles?method=getFile&token=SAMPLETOKEN123456789&filename=<font color=] |