DataStream Public API (1.0.0)

Download OpenAPI specification:

License: MIT

Read-only, programmatic access to the publicly available water quality data hosted on DataStream - dataset metadata, monitoring locations, and observations.

Built on OData v4. Every endpoint returns the same JSON envelope and filters the same way.

This API is in Beta - changes will happen. We do our best to keep you informed of any breaking changes.

Before you start

  • An API key is required. Send it in the x-api-key header on every request. Request one.
  • Rate limit: 2 requests/sec, no parallel requests. Exceeding it returns 429.
  • Server-side only. Requests from browser front-ends aren't supported.
  • Encode $ as %24 in parameter names - send %24filter=..., not $filter=.... An unencoded $ is rejected at the edge before it reaches the API, and it is the single most common cause of an unexpected 400.

Modules

We have built modules to wrap around our API to make it easier to use. They handle pagination, rate limiting and URL encoding for you, including the %24 rule above.

Attribution

Many datasets are published under licences that require attribution. Retrieve Citation, Licence and DOI from /Metadata before publishing or redistributing.

Datasets

Dataset-level metadata: citation, licence, DOI, temporal extent.

Query dataset metadata

Retrieves the dataset-level metadata for the datasets that meet your query criteria.

Authorizations:
apiKey
query Parameters
$select
Array of strings <= 23 items unique
Items Enum: "Id" "DOI" "Version" "DatasetName" "DataStewardEmail" "DataCollectionOrganization" "DataUploadOrganization" "ProgressCode" "MaintenanceFrequencyCode" "Abstract" "DataCollectionInformation" "DataProcessing" "FundingSources" "DataSourceURL" "OtherDataSources" "Citation" "Licence" "Disclaimer" "TopicCategoryCode" "Keywords" "CreateTimestamp" "PublishedTimestamp" "TemporalExtent"

Fields to return. Defaults to every allowed field.

$filter
string

OData filter expression, e.g. CharacteristicName eq 'pH' and ActivityStartYear ge '2020'. lte and gte are accepted as deprecated aliases of le and ge.

Field Available operators
DOI eq ne in
LocationId eq ne in
ActivityMediaName eq ne in
ActivityGroupType eq ne in
CharacteristicName eq ne in
MonitoringLocationType eq ne in
ActivityStartDateYear eq ne in gt ge lt le
ActivityStartYear eq ne in gt ge lt le
RegionId eq ne in
Latitude eq ne gt ge lt le
Longitude eq ne gt ge lt le
DatasetName eq ne in startswith endswith substringof
CreateTimestamp eq ne gt ge lt le

RegionId is filter-only - it is never returned, so its values appear nowhere else in this reference. Partner hubs: hub.atlantic, hub.greatlakes, hub.lakewinnipeg, hub.mackenzie, hub.pacific. Countries: admin.2.ca. Provinces and territories: admin.4.ca. followed by ab, bc, mb, nb, nl, ns, nt, nu, on, pe, qc, sk or yt. These values are subject to change.

ActivityGroupType is not part of the published data schema. It accepts: Continuous Data, Field Measure, Lab Sample, Other, Quality Control - Field Measure, Quality Control - Lab Sample, Unspecified.

ActivityMediaName, CharacteristicName and MonitoringLocationType match a controlled vocabulary published in the DataStream data schema. Its values grow with the schema, so they are not reproduced here.

$top
integer [ 1 .. 10000 ]
Default: 10
$count
boolean
Default: false

Return only the count of matching rows (an estimate for large counts).

$skiptoken
string

Cursor for pagination, e.g. Id:1234. Use the Link header or @odata.nextLink from the previous response.

Responses

Request samples

curl -G -H 'x-api-key: PRIVATE-API-KEY' \
     https://api.datastream.org/v1/odata/v4/Metadata \
     --data-urlencode "\$select=DOI,DatasetName,Citation,Licence,Version" \
     --data-urlencode "\$filter=DOI eq '10.25976/xxxx-xx00'" \
     --data-urlencode "\$top=10000"

Response samples

Content type
application/json
{
  • "odata.count": 1234,
  • "value": [
    ]
}

Locations

Monitoring locations and their coordinates.

Query monitoring locations

Retrieves the location information that meets your query criteria.

Authorizations:
apiKey
query Parameters
$select
Array of strings <= 12 items unique
Items Enum: "Id" "DOI" "ID" "Name" "Latitude" "Longitude" "HorizontalCoordinateReferenceSystem" "HorizontalAccuracyMeasure" "HorizontalAccuracyUnit" "VerticalMeasure" "VerticalUnit" "MonitoringLocationType"

Fields to return. Defaults to every allowed field.

$filter
string

OData filter expression, e.g. CharacteristicName eq 'pH' and ActivityStartYear ge '2020'. lte and gte are accepted as deprecated aliases of le and ge.

Field Available operators
DOI eq ne in
LocationId eq ne in
ActivityMediaName eq ne in
ActivityGroupType eq ne in
CharacteristicName eq ne in
MonitoringLocationType eq ne in
ActivityStartDateYear eq ne in gt ge lt le
ActivityStartYear eq ne in gt ge lt le
RegionId eq ne in
Latitude eq ne gt ge lt le
Longitude eq ne gt ge lt le
Name eq ne in

RegionId is filter-only - it is never returned, so its values appear nowhere else in this reference. Partner hubs: hub.atlantic, hub.greatlakes, hub.lakewinnipeg, hub.mackenzie, hub.pacific. Countries: admin.2.ca. Provinces and territories: admin.4.ca. followed by ab, bc, mb, nb, nl, ns, nt, nu, on, pe, qc, sk or yt. These values are subject to change.

ActivityGroupType is not part of the published data schema. It accepts: Continuous Data, Field Measure, Lab Sample, Other, Quality Control - Field Measure, Quality Control - Lab Sample, Unspecified.

ActivityMediaName, CharacteristicName and MonitoringLocationType match a controlled vocabulary published in the DataStream data schema. Its values grow with the schema, so they are not reproduced here.

$top
integer [ 1 .. 10000 ]
Default: 10
$count
boolean
Default: false

Return only the count of matching rows (an estimate for large counts).

$skiptoken
string

Cursor for pagination, e.g. Id:1234. Use the Link header or @odata.nextLink from the previous response.

Responses

Request samples

curl -G -H 'x-api-key: PRIVATE-API-KEY' \
     https://api.datastream.org/v1/odata/v4/Locations \
     --data-urlencode "\$select=Id,DOI,Name,Latitude,Longitude" \
     --data-urlencode "\$filter=DOI eq '10.25976/xxxx-xx00'" \
     --data-urlencode "\$top=10000"

Response samples

Content type
application/json
{
  • "odata.count": 1234,
  • "value": [
    ]
}

Data

Observations and full DataStream-schema records.

Query observations

Retrieves the observations that meet your query criteria.

Authorizations:
apiKey
query Parameters
$select
Array of strings <= 34 items unique
Items Enum: "Id" "DOI" "LocationId" "CharacteristicName" "ActivityType" "ActivityMediaName" "ActivityStartDate" "ActivityStartTime" "ActivityStartTimeZone" "ActivityEndDate" "ActivityEndTime" "ActivityEndTimeZone" "ActivityDepthHeightMeasure" "ActivityDepthHeightUnit" "SampleCollectionEquipmentName" "MethodSpeciation" "ResultSampleFraction" "ResultValue" "ResultUnit" "ResultValueType" "ResultDetectionCondition" "ResultDetectionQuantitationLimitUnit" "ResultDetectionQuantitationLimitMeasure" "ResultDetectionQuantitationLimitType" "ResultStatusID" "ResultComment" "ResultAnalyticalMethodID" "ResultAnalyticalMethodContext" "ResultAnalyticalMethodName" "AnalysisStartDate" "AnalysisStartTime" "AnalysisStartTimeZone" "LaboratoryName" "LaboratorySampleID"

Fields to return. Defaults to every allowed field.

$filter
string

OData filter expression, e.g. CharacteristicName eq 'pH' and ActivityStartYear ge '2020'. lte and gte are accepted as deprecated aliases of le and ge.

Field Available operators
DOI eq ne in
LocationId eq ne in
ActivityMediaName eq ne in
ActivityGroupType eq ne in
CharacteristicName eq ne in
MonitoringLocationType eq ne in
ActivityStartDateYear eq ne in gt ge lt le
ActivityStartYear eq ne in gt ge lt le
RegionId eq ne in

RegionId is filter-only - it is never returned, so its values appear nowhere else in this reference. Partner hubs: hub.atlantic, hub.greatlakes, hub.lakewinnipeg, hub.mackenzie, hub.pacific. Countries: admin.2.ca. Provinces and territories: admin.4.ca. followed by ab, bc, mb, nb, nl, ns, nt, nu, on, pe, qc, sk or yt. These values are subject to change.

ActivityGroupType is not part of the published data schema. It accepts: Continuous Data, Field Measure, Lab Sample, Other, Quality Control - Field Measure, Quality Control - Lab Sample, Unspecified.

ActivityMediaName, CharacteristicName and MonitoringLocationType match a controlled vocabulary published in the DataStream data schema. Its values grow with the schema, so they are not reproduced here.

$top
integer [ 1 .. 10000 ]
Default: 10
$count
boolean
Default: false

Return only the count of matching rows (an estimate for large counts).

$skiptoken
string

Cursor for pagination, e.g. Id:1234. Use the Link header or @odata.nextLink from the previous response.

Responses

Request samples

curl -G -H 'x-api-key: PRIVATE-API-KEY' \
     https://api.datastream.org/v1/odata/v4/Observations \
     --data-urlencode "\$select=DOI,ActivityStartDate,CharacteristicName,ResultValue,ResultUnit" \
     --data-urlencode "\$filter=DOI eq '10.25976/xxxx-xx00' and CharacteristicName in ('Temperature, water', 'pH')" \
     --data-urlencode "\$top=10000"

Response samples

Content type
application/json
{
  • "odata.count": 1234,
  • "value": [
    ]
}

Query records (CSV-oriented full rows)

Retrieves the data in the DataStream schema format with all columns that meet your query criteria.

Authorizations:
apiKey
query Parameters
$select
Array of strings <= 44 items unique
Items Enum: "Id" "DOI" "DatasetName" "MonitoringLocationID" "MonitoringLocationName" "MonitoringLocationLatitude" "MonitoringLocationLongitude" "MonitoringLocationHorizontalCoordinateReferenceSystem" "MonitoringLocationHorizontalAccuracyMeasure" "MonitoringLocationHorizontalAccuracyUnit" "MonitoringLocationVerticalMeasure" "MonitoringLocationVerticalUnit" "MonitoringLocationType" "ActivityType" "ActivityMediaName" "ActivityStartDate" "ActivityStartTime" "ActivityStartTimeZone" "ActivityEndDate" "ActivityEndTime" "ActivityEndTimeZone" "ActivityDepthHeightMeasure" "ActivityDepthHeightUnit" "SampleCollectionEquipmentName" "CharacteristicName" "MethodSpeciation" "ResultSampleFraction" "ResultValue" "ResultUnit" "ResultValueType" "ResultDetectionCondition" "ResultDetectionQuantitationLimitMeasure" "ResultDetectionQuantitationLimitUnit" "ResultDetectionQuantitationLimitType" "ResultStatusID" "ResultComment" "ResultAnalyticalMethodID" "ResultAnalyticalMethodContext" "ResultAnalyticalMethodName" "AnalysisStartDate" "AnalysisStartTime" "AnalysisStartTimeZone" "LaboratoryName" "LaboratorySampleID"

Fields to return. Defaults to every allowed field.

$filter
string

OData filter expression, e.g. CharacteristicName eq 'pH' and ActivityStartYear ge '2020'. lte and gte are accepted as deprecated aliases of le and ge.

Field Available operators
DOI eq ne in
LocationId eq ne in
ActivityMediaName eq ne in
ActivityGroupType eq ne in
CharacteristicName eq ne in
MonitoringLocationType eq ne in
ActivityStartDateYear eq ne in gt ge lt le
ActivityStartYear eq ne in gt ge lt le
RegionId eq ne in

RegionId is filter-only - it is never returned, so its values appear nowhere else in this reference. Partner hubs: hub.atlantic, hub.greatlakes, hub.lakewinnipeg, hub.mackenzie, hub.pacific. Countries: admin.2.ca. Provinces and territories: admin.4.ca. followed by ab, bc, mb, nb, nl, ns, nt, nu, on, pe, qc, sk or yt. These values are subject to change.

ActivityGroupType is not part of the published data schema. It accepts: Continuous Data, Field Measure, Lab Sample, Other, Quality Control - Field Measure, Quality Control - Lab Sample, Unspecified.

ActivityMediaName, CharacteristicName and MonitoringLocationType match a controlled vocabulary published in the DataStream data schema. Its values grow with the schema, so they are not reproduced here.

$top
integer [ 1 .. 10000 ]
Default: 10
$count
boolean
Default: false

Return only the count of matching rows (an estimate for large counts).

$skiptoken
string

Cursor for pagination, e.g. Id:1234. Use the Link header or @odata.nextLink from the previous response.

Responses

Request samples

curl -G -H 'x-api-key: PRIVATE-API-KEY' \
     https://api.datastream.org/v1/odata/v4/Records \
     --data-urlencode "\$select=DOI,ActivityStartDate,CharacteristicName,ResultValue,ResultUnit" \
     --data-urlencode "\$filter=DOI eq '10.25976/xxxx-xx00' and ActivityStartYear ge '2020'" \
     --data-urlencode "\$top=10000"

Response samples

Content type
application/json
{
  • "odata.count": 1234,
  • "value": [
    ]
}