I have 300+ layers in my GeoServer layer library, I have just created a custom gridset I would like to use for all of my layers. I don't want to go through my whole library adding the gridset manually through the UI, so I have played around with the GeoServer rest API and I am able to modify layers with the following command:

curl -v -u admin:geoserver -XPOST -H "Content-type: text/xml" -d @ui_UI00000ENNR.xml  "http://localhost:8080/geoserver/gwc/rest/layers/ui:UI00000ENNR.xml"

And this is the contents of the ui_UI00000ENNR.xml file:

<?xml version="1.0" encoding="UTF-8"?>

My plan is to create a template xml file and then loop through my list of layers, populating the xml file and running the curl command for each layer. The only problem is I don't know the id for each layer, <id>LayerInfoImpl-288ccd00:163bb872e8d:-7ff6</id>, in the example above. Does anyone know how I could pull all layer names and there associated ids from GeoServer? Or is there a much quicker way of doing what I want to accomplish?

  • I think you can leave that ID out and GeoServer will auto populate it
    – Ian Turton
    Jun 1 '18 at 16:11

As Ian Turton said GeoServer autopopulates the ID and my method that I proposed worked.

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.