[Geoserver-users] How to update/delete postgis tables via REST

Hello…
When using REST API to create a new feature type via POST command, to a given datastore properly set to postgres/postgis, geoserver successfully creates the table. I pretend to update the attributes/table of objects and do the corresponding update to postgis table. To do so, I use a PUT request. It successfully updates geoserver XML file of feature type, but the postgres table is not changed at all. Also, the geoserver log clearly states, as PUT feedback, that only metadata is updated.
How to reflect these changes in postgis table (for instance, create a new attribute/table field)? Is there something I am missing?
I have the same problem about rest DELETE request: I am able to delete everything from geoserver, but the table keeps intact in postgres, when it is supposed (I guess) to reflect the changes there as well.
Thanks in advance!

···

V

In the same way that changes made via the REST API (or the GUI) don’t affect your shapefiles on the disk there is no reason for changes to the GeoServer state to affect the tables in your database. In fact, I would be very angry if on deleting a store in GeoServer my very expensive and hard to collect data went missing in my database.

Ian

···

On 8 February 2018 at 18:25, João Afonso <joaodiasafonso@anonymised.com84…> wrote:

Hello…
When using REST API to create a new feature type via POST command, to a given datastore properly set to postgres/postgis, geoserver successfully creates the table. I pretend to update the attributes/table of objects and do the corresponding update to postgis table. To do so, I use a PUT request. It successfully updates geoserver XML file of feature type, but the postgres table is not changed at all. Also, the geoserver log clearly states, as PUT feedback, that only metadata is updated.
How to reflect these changes in postgis table (for instance, create a new attribute/table field)? Is there something I am missing?
I have the same problem about rest DELETE request: I am able to delete everything from geoserver, but the table keeps intact in postgres, when it is supposed (I guess) to reflect the changes there as well.
Thanks in advance!

V


Check out the vibrant tech community on one of the world’s most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Geoserver-users@anonymised.com.382…sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Ian Turton

Thanks for the answer! It is intended, then.
As REST can create a table, I thought there could be a way to do other
operations on it, other than inserts, updates, deletes, etc, on records. I
guess I wouldn't have searched for it if REST couldn't create tables.

Now it is only by curiosity: with a PUT command for, lets say, add an
attribute to a layer, it will change metadata. Doing so, it will make
metadata incoherent with database and will raise errors and prevent me to
read that layer. Is this behaviour intended?

--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html

Hi Ian,
what you say is very true, but a user may actually mean to delete the data. An extra option added to the request to also drop the data contents
could be interesting, and there is optional support for it in the underlying datastore API (various datastores do not implement it, but database based
ones do).

Same goes for the update of attributes, it is not supported, but the underlying datastore API has optional support for it (same as above,
database based datastore do support schema update).

Both are improvement/feature requests, so Joao can follow this guide if he wants to have them implemented:
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Cheers
Andrea

···

On Fri, Feb 9, 2018 at 10:44 AM, Ian Turton <ijturton@anonymised.com> wrote:

In the same way that changes made via the REST API (or the GUI) don’t affect your shapefiles on the disk there is no reason for changes to the GeoServer state to affect the tables in your database. In fact, I would be very angry if on deleting a store in GeoServer my very expensive and hard to collect data went missing in my database.

Ian


Check out the vibrant tech community on one of the world’s most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Geoserver-users@anonymised.com.382…sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

On 8 February 2018 at 18:25, João Afonso <joaodiasafonso@anonymised.com…> wrote:

Hello…
When using REST API to create a new feature type via POST command, to a given datastore properly set to postgres/postgis, geoserver successfully creates the table. I pretend to update the attributes/table of objects and do the corresponding update to postgis table. To do so, I use a PUT request. It successfully updates geoserver XML file of feature type, but the postgres table is not changed at all. Also, the geoserver log clearly states, as PUT feedback, that only metadata is updated.
How to reflect these changes in postgis table (for instance, create a new attribute/table field)? Is there something I am missing?
I have the same problem about rest DELETE request: I am able to delete everything from geoserver, but the table keeps intact in postgres, when it is supposed (I guess) to reflect the changes there as well.
Thanks in advance!

V


Check out the vibrant tech community on one of the world’s most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Geoserver-users@anonymised.comrge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Ian Turton

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.

On Fri, Feb 9, 2018 at 11:36 AM, Andrea Aime <andrea.aime@anonymised.com>
wrote:

Same goes for the update of attributes, it is not supported, but the
underlying datastore API has optional support for it (same as above,
database based datastore do support schema update).

Actually, I take it back, remembered it wrong, JDBCDataStore does not
implement updateSchema. One more thing to work on in case Joao wants to
get these new features implemented :slight_smile:

Cheers
Andrea

==

GeoServer Professional Services from the experts! Visit http://goo.gl/it488V
for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

I am interested! And I've read the guidelines posted in one of the replies,
but I'm also not sure how useful this might be for the community in general,
at the moment (considering the replies meanwhile).
I have no doubt that if a rest api already exists and have a logic behind
each HTTP request, to make it actually do what is documented is the minimum
one expects. Regarding databases, it could simply forbid operations but, at
the moment, it does half the job by updating only xml metadata files and
making geoserver incoherent with data itself (which, in consequence, makes
the layer not usable anymore).
As a workaround, as I control both frontend and backend, I was able to build
a separate piece of software to do these updates on database, on request
(alter and drop table, which were plain simple to make). What took a bit
more time to do was related to user authentication. Nothing of this would be
needed if put and delete behave properly on DB:)

--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html