REST API for updates are established
The functionality of updating records is needed, not only for usual work, but especially for transferring data from old database to new database (combining different station records from different networks (but describing the same station) into one new record with different entries in the 'codes'-column).
Therefore, the update functionality has to be implemented before the data transfer is started.
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Sabine Schröder changed due date to June 15, 2020
changed due date to June 15, 2020
- Sabine Schröder added .doing label
added .doing label
- Sabine Schröder mentioned in commit 5b112a36
mentioned in commit 5b112a36
- Author Owner
A first (rudimentary) patch API was installed for stationmeta.
This API needs to be further tested (and tests have to be added to pytest and production_tests.sh).The patch API should also use the changelog tables (see #17 (closed)).
This will be implemented in the next step. - Sabine Schröder mentioned in commit 9710d33e
mentioned in commit 9710d33e
- Author Owner
The syntax of the patch API was adapted to the standard way:
curl -X PATCH -H "Content-Type:application/json" -d '{"stationmeta": {"name": "Mount Bla"}}' http://127.0.0.1:8000/stationmeta/China11
This (and another fix) has been done in commit 9710d33e.
- Sabine Schröder mentioned in commit cbad53cd
mentioned in commit cbad53cd
- Author Owner
The command
curl -X PATCH -H "Content-Type:application/json" -d '{"stationmeta": {"roles": [{"role": "PointOfContact", "contact_id": 43, "status": "active"},{"role": "PrincipalInvestigator", "contact_id": 41, "status": "active"}]}}' http://127.0.0.1:8000/stationmeta/China11
overwrites roles for a given station ("China11").
With commit cbad53cd, roles can be completely deleted from a stationmeta's entry:
curl -X PATCH http://127.0.0.1:8000/stationmeta/delete_field/China11?field=roles
Edited by Sabine Schröder - Sabine Schröder mentioned in commit 8640a43c
mentioned in commit 8640a43c
- Author Owner
With the above commit (8640a43c) the command
curl -X PATCH -H "Content-Type:application/json" -d '{"stationmeta": {"name": "Mount Thai"}}' http://127.0.0.1:8000/stationmeta/China11?description=rename%20station
also writes one(!) entry to the changelog table (see #17 (closed)).
Still to do:
- write type_of_change in human-readable format
- automatically determine type_of_change
- show author (not author_id)
- write changelog table for every change done while patching
- ...
- Sabine Schröder mentioned in commit fcd5e3e4
mentioned in commit fcd5e3e4
- Author Owner
With the above commit (fcd5e3e4) the patch API for time series is installed in the same way as for stationmeta.
This means that the commandcurl -X PATCH -H "Content-Type:application/json" -d '{"timeseries": {"order": 10}}' http://127.0.0.1:8000/timeseries/3?description=reset%20order
also writes one(!) entry to the changelog table (see #17 (closed)).
The same issues mentioned in https://gitlab.version.fz-juelich.de/toar/toardb_fastapi/-/issues/9#note_60569 have still to be done for this patch API.
- Sabine Schröder mentioned in commit b3a7c520
mentioned in commit b3a7c520
- Author Owner
Appending/(Inserting new data) to table data can be done with the same command as creating for a time series the first time, f. ex.:
curl -X POST -H 'Content-Type: multipart/form-data; charset=utf-8; boundary=__X_PAW_BOUNDARY__' -F "file=@fixtures/o3_DEUB001_2017_2017_v1-0.dat" "http://127.0.0.1:8000/data/"
will insert data for the year 2017 to the time series of Westerland (which hasn't been there before).
As soon as one value in table data is to be overwritten, the above command will fail!
(which is the desired behavior) - Sabine Schröder mentioned in commit 0daad653
mentioned in commit 0daad653
- Sabine Schröder mentioned in commit a3f62ebd
mentioned in commit a3f62ebd
- Sabine Schröder mentioned in commit 90d30342
mentioned in commit 90d30342
- Author Owner
patch API for deleting of fields (see https://gitlab.version.fz-juelich.de/toar/toardb_fastapi/-/issues/9#note_60562) should also create entries in changelog table.
- Sabine Schröder mentioned in commit e2ebce2b
mentioned in commit e2ebce2b
- Sabine Schröder mentioned in commit 1468d723
mentioned in commit 1468d723