I am trying to change the properties of an existing Geoserver data store via the REST API. I have created the data store from an existing folder of shapefiles. However, I need to change the "charset" and "Create spatial index if missing/outdated" properties but I cannot for the life of me figure out how to do it.
I have tried sending the following XML as a PUT request to the data store but it doesn't work:
<DataStore>
<parameters>
<Parameter>
<name>create spatial index</name>
<value>true</value>
</Parameter>
<Parameter>
<name>charset</name>
<value>ISO-8859-1</value>
</Parameter>
</parameters>
</DataStore>
REST:
http://localhost/geoserver/rest/workspaces/uk/datastores/roads.xml
PUT /geoserver/rest/workspaces/uk/datastores/roads.xml
Anyone have any ideas?
Thanks
Best Answer
I was testing with GeoServer 2.6-RC1. Version 2.4.x is very soon out of maintenance so I did not feel like playing with it. I apologize it you can't update yet.
First thing that I learned is that you must PUT the whole datastore configuration file and not only the changed parts. Second lesson was that the configuration file does not look the same in GeoServer 2.6 than in this document http://docs.geoserver.org/stable/en/user/data/app-schema/data-stores.html. I finally studied the datastore config file by changing some settings with the GUI admin utility.
With this command I created a new datastore from directory of shapefiles:
The config file can now be reached from
For making the changes which you want the datastore.xml file should be edited like this:
Save the edited file as "put.xml" and PUT it
This works for me.