Overview

The AqualarmRest import function (<importType>AqualarmRest</importType>) imports data from the aqualarm services that return JSON content.

The service can be found at https://www.aqualarm.nl/apwb/

HTTPS communication

The Aqualarm service is using HTTPS. Since Aqualarm uses a PKI overheid certificate which isn't available to the import, it should be made known to FEWS. 

The process of making the certificates available has been documented at: How to configure secure https connection to Matroos.

For aqualarm the following certificates have to be imported in the truststore:

StaatderNederlandenRootCA-G2.crt : public certificate of the staat der nederlanden, valid until 2020.

client.truststore : truststore with imported certificates

Configuring the Import

To make the importer known to FEWS, the import module has to be declared in the moduleInstanceDescriptors.xml in the RegionConfigFiles directory of the FEWS configuration:

<?xml version="1.0" encoding="UTF-8"?>
<moduleInstanceDescriptors xmlns="http://www.wldelft.nl/fews"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
		xsi:schemaLocation="http://www.wldelft.nl/fews
		http://fews.wldelft.nl/schemas/version1.0/moduleInstanceDescriptors.xsd" version="1.0">
...
	<moduleInstanceDescriptor id="ImportAqualarm"/>
...
</moduleInstanceDescriptors>

An example of the AqualarmRest import configuration is given here. The importType is named AqualarmRest which should be configured in the general section of the import. The URL to the service should be configured here as well. The actual data to be retrieved can be tuned by setting the relativeViewPeriod and the timeSeries to specify the locations and parameters. N.B.: the used parameters and locations have to be mapped with an idMap to the actual id's that are used by the Aqualarm service (IdAqualarm in this example). TimeZone is assumed to be configured in the general section, otherwise GMT is assumed.

<?xml version="1.0" encoding="UTF-8"?>
<timeSeriesImportRun xmlns="http://www.wldelft.nl/fews" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wldelft.nl/fews 
    http://fews.wldelft.nl/schemas/version1.0/timeSeriesImportRun.xsd">
	<import>
		<general>
			<importType>AqualarmRest</importType>
			<serverUrl>https://www.aqualarm.nl/apwb</serverUrl>
			<user>dummy_username</user>
			<password>dummy_password</password>
			<relativeViewPeriod unit="day" start="-30" end="0" startOverrulable="true" endOverrulable="true"/>
			<idMapId>IdAqualarm</idMapId>
			<importTimeZone>
				<timeZoneName>GMT+2</timeZoneName>
			</importTimeZone>
		</general>
		<timeSeriesSet>
			<moduleInstanceId>ImportAqualarm</moduleInstanceId>
			<valueType>scalar</valueType>
			<parameterId>Chl.observed</parameterId>
			<locationId>Lobith</locationId>
			<timeSeriesType>external historical</timeSeriesType>
			<timeStep unit="nonequidistant"/>
			<readWriteMode>add originals</readWriteMode>
		</timeSeriesSet>
		<timeSeriesSet>
			<moduleInstanceId>ImportAqualarm</moduleInstanceId>
			<valueType>scalar</valueType>
			<parameterId>Chl.observed</parameterId>
			<locationId>Eijsden</locationId>
			<timeSeriesType>external historical</timeSeriesType>
			<timeStep unit="nonequidistant"/>
			<readWriteMode>add originals</readWriteMode>
		</timeSeriesSet>
	</import>
</timeSeriesImportRun>

The previous timeseries will be mapped using the IdAqualarm id mapping. As an example the internal FEWS location Lobith is mapped to the aqualarm location code: LOBI:

 <?xml version="1.0" encoding="UTF-8"?>
<idMap version="1.1" xmlns="http://www.wldelft.nl/fews" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wldelft.nl/fews http://fews.wldelft.nl/schemas/version1.0/idMap.xsd">
   <parameter internal="Chl.observed"  external="chloride"/>
   <location external="LOBI" internal="Lobith" />
   <location external="EIJS" internal="Eijsden" />
</idMap>

Example JSON response from the AqualarmRest service.

[
 {
 "value": 64,
 "timeStamp": "2018-06-21T07:00:00Z"
 },
 {
 "value": 65,
 "timeStamp": "2018-06-22T07:00:00Z"
 }
]
  • No labels