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:

      <name>create spatial index</name>


PUT /geoserver/rest/workspaces/uk/datastores/roads.xml

Anyone have any ideas?



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:

C:\data\states>curl -v -u admin:geoserver -XPUT -H "Content-type: text/plain" -d "file:///data/states/" "http://localhost:8080/geoserver/rest/workspaces/topp/datastores/shapefiles/external.shp?configure=all"

The config file can now be reached from


For making the changes which you want the datastore.xml file should be edited like this:

    <entry key="memory mapped buffer">false</entry>
    <entry key="create spatial index">true</entry>
    <entry key="charset">ISO-8859-1</entry>
    <entry key="cache and reuse memory maps">false</entry>
    <entry key="url">file:/c:/data/states/</entry>
    <entry key="namespace">http://www.openplans.org/topp</entry>

Save the edited file as "put.xml" and PUT it

C:\data\states>curl -v -u admin:geoserver -XPUT -H "Content-type: text/xml" -d @put.xml http://localhost:8080/geoserver/

This works for me.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.