Update SRID in GeoServer layer via REST

I need to change the SRS of a layer and also set it as “Reproject Native to Declared”, using the REST API, but I can’t do it.

I tried the following command, it runs and doesn’t give an error, but it also doesn’t work (i.e., it doesn’t make the change to the layer).

curl.exe -v -u admin:geoserver -XPUT -H "Content-type: text/xml" -d "<layer><featureType><srs>EPSG:3857</srs><projectionPolicy>FORCE_DECLARED</projectionPolicy></featureType></layer>" http://localhost:8080/geoserver/rest/layers/geocursos:lote_geo2

Does anyone know how I can do it? And another thing, what is the “tag” for “Reproject Native to Declared” in projectionPolicy?

Best Regards,

Fernando Quadro
http://www.fernandoquadro.com.br/
https://www.linkedin.com/in/fernandoquadro/

I always start by using the gui to make the setup I wish to automate - that is a good way to figure out the “Reproject Native to Declared” example. You can then remove sections until you have a minimal example.

Checking the docs: GeoServer API Docs

Shows REPROJECT_TO_DECLARED in the json example for PUT.