...
POST timeseries
Write timeseries data to the FEWS system using the timeseries sets defined by the filters. The timeSeries are stored in the piTimeSeriesXmlContent. The 'convertDatum' argument is to allow timeseries that support a datum to have their values converted to a value relative to the location height. If values are already relative to location then enter FALSE or omit.
Request parameters
filterId (string): Filter id for when the input timeseries maps to multiple internal timeseries. Within the scope of the filter the input timeseries should only map to one internal timeseries.
convertDatum (boolean): Convert values from relative location height to absolute height values
Body parameters
piTimeSeriesXmlContent (xml string, required): PiTimeseries xml file content in applicationfile encoded in the 'application/x-www-form-urlencoded formatContent-Type. Example of a piTimeSeriesXmlContent (unencoded):
Code Block <?xml version="1.0" encoding="UTF-8"?> <TimeSeries xmlns="http://www.wldelft.nl/fews/PI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wldelft.nl/fews/PI http://fews.wldelft.nl/schemas/version1.0/pi-schemas/pi_timeseries.xsd" version="1.12"> <timeZone>0.0</timeZone> <series> <header> <type>instantaneous</type> <locationId>63306260000</locationId> <parameterId>T.obs.mean</parameterId> <timeStep unit="nonequidistant"/> <startDate date="2013-01-01" time="00:40:00"/> <endDate date="2013-01-01" time="00:50:00"/> <missVal>-999.0</missVal> <stationName>DE BILT</stationName> <lat>51.76391247583424</lat> <lon>4.329717456157946</lon> <x>82000.0</x> <y>420000.0</y> <z>0.0</z> <units>m</units> </header> <event date="2013-01-01" time="00:40:00" value="13.0" flag="0"/> <event date="2013-01-01" time="00:50:00" value="13.0" flag="0"/> </series> </TimeSeries>
Response
- pi diag xml response with all diagnostic output.
Example request
The following example shows how timeSeries can created using the POST method. Take note that the TimeSeries have to be posted in PI XML Format in the body of the POST request using the piTimeSeriesXmlContent key. The value is the content of the PI XML Timeseries in application/x-www-form-urlencoded format.
Code Block |
---|
curl http://localhost:8080/FewsWebServices/rest/fewspiservice/v1/timeseries/ -i -X POST -H 'Content-Type: application/x-www-form-urlencoded' -d piTimeSeriesXmlContent=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0D%0A%3CTimeSeries%20xmlns%3D%22http%3A%2F%2Fwww.wldelft.nl%2Ffews%2FPI%22%20xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22%0D%0A%09%09%09xsi%3AschemaLocation%3D%22http%3A%2F%2Fwww.wldelft.nl%2Ffews%2FPI%20http%3A%2F%2Ffews.wldelft.nl%2Fschemas%2Fversion1.0%2Fpi-schemas%2Fpi_timeseries.xsd%22%20version%3D%221.12%22%3E%0D%0A%09%3CtimeZone%3E0.0%3C%2FtimeZone%3E%0D%0A%09%3Cseries%3E%0D%0A%09%09%3Cheader%3E%0D%0A%09%09%09%3Ctype%3Einstantaneous%3C%2Ftype%3E%0D%0A%09%09%09%3ClocationId%3E63306260000%3C%2FlocationId%3E%0D%0A%09%09%09%3CparameterId%3ET.obs.mean%3C%2FparameterId%3E%0D%0A%09%09%09%3CtimeStep%20unit%3D%22nonequidistant%22%2F%3E%0D%0A%09%09%09%3CstartDate%20date%3D%222013-01-01%22%20time%3D%2200%3A40%3A00%22%2F%3E%0D%0A%09%09%09%3CendDate%20date%3D%222013-01-01%22%20time%3D%2200%3A50%3A00%22%2F%3E%0D%0A%09%09%09%3CmissVal%3E-999.0%3C%2FmissVal%3E%0D%0A%09%09%09%3CstationName%3EDE%20BILT%3C%2FstationName%3E%0D%0A%09%09%09%3Clat%3E51.76391247583424%3C%2Flat%3E%0D%0A%09%09%09%3Clon%3E4.329717456157946%3C%2Flon%3E%0D%0A%09%09%09%3Cx%3E82000.0%3C%2Fx%3E%0D%0A%09%09%09%3Cy%3E420000.0%3C%2Fy%3E%0D%0A%09%09%09%3Cz%3E0.0%3C%2Fz%3E%0D%0A%09%09%09%3Cunits%3Em%3C%2Funits%3E%0D%0A%09%09%3C%2Fheader%3E%0D%0A%09%09%3Cevent%20date%3D%222013-01-01%22%20time%3D%2200%3A40%3A00%22%20value%3D%2213.0%22%20flag%3D%220%22%2F%3E%0D%0A%09%09%3Cevent%20date%3D%222013-01-01%22%20time%3D%2200%3A50%3A00%22%20value%3D%2213.0%22%20flag%3D%220%22%2F%3E%0D%0A%09%3C%2Fseries%3E%0D%0A%3C%2FTimeSeries%3E |
Example response
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?> <Diag xmlns="http://www.wldelft.nl/fews/PI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wldelft.nl/fews/PI http://fews. wldelft.nl/schemas/version1.0/pi-schemas/pi_diag.xsd" version="1.2"> <line level="2" description="Multiple time series sets found for parameter=T.obs.mean location=63306260000"/> <line level="3" description="Import.Info: External time series successfully mapped to FEWS time series 63306260000 T.obs.mean (m) nonequidistant Tue Jan 0 1 01:40:00 CET 2013 z=0.0"/> <line level="3" description="Import.info: 1 time series imported, 0 time series rejected"/> <line level="3" description="Import.info: The following locations-parameter combination imported 63306260000:T.obs.mean"/ </Diag> |
...
GET taskrunstatus
Track the status of a workflow using the taskRunId.
Request parameters
- taskId (string, required): task Id of a workflow.
maxWaitMillis (integer) time in milliseconds to wait for response
Response
Status of the workflow task. Possible response codes are:
I = Invalid,
P = Pending,
T = Terminated,
R = running,
F = Failed,
C = Completed fully successful,
D = Completed partly successful,
A = Approved,
B = Approved partly successful
null
= No status available (produces when method call times-out)
Example request
Code Block |
---|
curl localhost:8080/FewsWebServices/rest/fewspiservice/v1/taskrunstatus?documentVersion=1.23&taskId=1_0 |
Example response
Code Block |
---|
C |
POST runtask
Request parameters
- workflowId (string, required): Identifier of the task to run
- startTime (dateTime): Start of run period. Used for state selection period.
- timeZero (dateTime): Forecast time zero. If missing System time is used (optional)
- endTime (dateTime): End of run period. Used to define forecast length.
- coldStateId (string): Id of a coldstate. Can be used to force state selection (optional).
- scenarioId (string): Id of a predefined WhatIf scenario. Can be used to alter run parameters (optional).
- userId (string) User id of the user that runs the task.
- description (string): Descriptive text to identify run.
Body parameters
- piParametersXml (piXML url encoded): Contents of a a Pi ModelParameters XML file file. PI ModelParameters can be exported by the General Adapter to provide information to external models being run by FEWS. The xml file content has to be in applicationencoded in the 'application/x-www-form-urlencoded formatContent-Type.
Response
- String with the taskId of the task that is run.
Example request
Code Block |
---|
curl http://localhost:8080/FewsWebServices/rest/fewspiservice/v1/runtask/?workflowId=ImportObserved&startTime=2014-01-01T00:00:00+0000&timeZero=2014-01-01T00:00:00+0000&endTime=2014-01-01T00:30:00+0000 -i -X POST -H 'Content-Type: application/x-www-form-urlencoded' -d '' |
Example response
Code Block |
---|
10 |
GET timeseriesmodifiers
Request parameters
locationIds (string)
moduleInstanceIds (string)
startTime (dateTime)
endTime (dateTime)
userId (string)
modifierTypeId (string)
active (boolean, default true)
userDefinedModifierDescriptionKeyValuePair (string)
- documentFormat (string)
Response
Example request
Code Block |
---|
curl http://localhost:8080/FewsWebServices/rest/fewspiservice/v1/timeseriesmodifiers?onlyActiveModifiers=true |
Example response
Code Block |
---|
TODO |
GET modifiers
Request parameters
- not applicable
Response
Example request
Code Block |
---|
curl http://localhost:8080/FewsWebServices/rest/fewspiservice/v1/modifiers?onlyActiveModifiers=true |
Example response
Code Block |
---|
TODO |
POST modifiers
Request parameters
- not applicable
Response
Example request
Code Block |
---|
TODO |
Example response
Code Block |
---|
TODO |
GET workflows
Request parameters
- documentVersion (string, 1.9 or up): File format version (optional). For example: 1.23
Response
- xml workflows.
Example request
Code Block |
---|
curl http://localhost:8080/FewsWebServices/rest/fewspiservice/v1/workflows |
Example response
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?> <workflows xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.wldelft.nl/fews/PI" xsi:schemaLocation="http://www.wldelft.nl/fews/PI http:// fews.wldelft.nl/schemas/version1.0/pi-schemas/pi_workflows.xsd" version="1.23"> <workflow id="ImportObserved"> <name>Import Observed Data</name> <description>Import observed scalar data from external sources and process the imported data</description> </workflow> </workflows> |
...