Analogues to the KiQS, the WriteServices are called with service=kisters&type= writeservices in the URL. However, since all commands manipulate or add data, instead of a standard HTTP GET request, a POST or PUT has to be sent. Currently, KiWIS does not make any difference between these two verbs.

1.  setTimeseriesValues:

This command is intended to insert time series data into existing normal time series. The request requires a single ts_id or ts_path to identify the target time series. Optionally the flage truncate=true|false can be set, default is false. If set to true, the sent data will replace the content of the whole time series.

The body of the request needs to have JSON content with header 'Content- Type: application/json', the actual JSON equals the familiar dajson format, just without the metadata. Required is the set of columns and the data array containing the values:

[
     {
     "columns":"Timestamp,Value",
     "data": [
             ["2012-05-28T00:00:00.000+01:00",236],
             ["2012-05-29T00:00:00.000+01:00",234],
             ["2012-05-30T00:00:00.000+01:00",226]
             ]
     }
]
CODE

The columns 'Timestamp' and 'Value' (case insensitive) will be sufficient to write single column data into time series. The quality code will be set to the default value for new values in WISKI. If a specific code should be set, the column name 'Status' can be used:

[
     {
     "columns":"Timestamp,Value",
     "data": [
             ["2012-05-28T00:00:00.000+01:00",236, 120],
             ["2012-05-29T00:00:00.000+01:00",234,120], 
             ["2012-05-30T00:00:00.000+01:00",226,120]
             ]
     }
]

CODE

The given quality code must be defined in WISKI or it will be ignored. Any other value or status columns can be written by adding the WISKI internal column name to the column's entry. This also means that it is NOT possible to use any other defined KiWIS return field names like 'Absolute Value' to write data, instead the actual column name from WISKI has to be used. Mappings may be added in the future.

Full example that utilizes the cURL command line tool:

curl -X POST -H "Content-Type: application/json" -d "[
 {
 \"columns\":\"Timestamp,Value\",
 \"data\": [
   [\"2012-05-28T00:00:00.000+01:00\",236],	
   [\"2012-05-29T00:00:00.000+01:00\",234],
   [\"2012-05-30T00:00:00.000+01:00\",226]
   ]
 }
]"
"http://localhost:8080/KiWIS/KiWIS?datasource=0&service=kisters&t ype=writeServices&req uest=settimeseriesvalues&ts_id=1587010"
 
CODE
2.  setEnsembleTimeseriesValues:

This command is intended to insert time series data into existing ensemble/forecast time series. The request requires a single ts_id or ts_path to identify the target time series. The body of the request needs to have JSON content with header 'Content-Type: application/json', the actual JSON equals the familiar dajson format for ensemble time series.

Example body:

[
     {
        "ensembleDate": "2016-09-29T07:00:00+01:00",
        "ensembleDispatchInfo": "2016-09-29",
        "quality": 200,
        "columns": "Timestamp,Forecast", "data": [
          [
            "2016-09-29T07:00:00.000+01:00", "0.2"
          ],
          [
            "2016-09-29T07:15:00.000+01:00", "0.1"
          ]
        ]
     }
]

CODE

The ensembleDate is the timestamp where the ensemble will be stored. The ensembleDispatchInfo is a unique key to identify a single ensemble or model run, both fields are mandatory. The optional quality defines the quality code for the whole ensemble, default is zero (0).

The columns attribute has to list the Timestamp plus all ensemble members that should be written for an ensemble. Unlike with setTimeseriesValues where arbitrary WISKI defined columns may be written as long as the keys are known, the column list here matches the one returned by KiWIS for the same time series.

Full example that utilizes the cURL command line tool:

curl -X PUT -H "Content-Type: application/json" -d "[
 {
   \"ensembledate\": \"2016-09-29T07:00:00+01:00\",
   \"ensembleDispatchInfo\": \"2016-09-29\",
   \"quality\": 200,
   \"columns\": \"Timestamp,Forecast\",
   \"data\": [
     [
      \"2016-09-29T07:00:00+01:00\",
      \"0.2\"
     ],
   [
     \"2016-09-29T07:15:00+01:00\",
     \"0.1\"
   ]
   ]
 }
]"
"http://localhost:8080/KiWIS/KiWIS?request=setEnsembleTimeseries Values&ts_id=1057920 10&service=kisters&type=writeServices&datasource=0"

CODE