[Geoserver-users] Adding layers to Geoserver with REST API

Hello,

I’m still having problems with adding layers to Geoserver using REST API.

I’m triying to explain my problem.

First, I created the workspace with :

curl -u user:pwd -v -XPOST -H “Content-type: text/xml” -d “test” http://localhost:8081/geoserver/rest/workspaces

It looked to be OK !

Then, I tried to put the zip file (pamper.zip, containing all shp, prj and other required files) with the following command

curl -u admin:geoserver -XPUT -H ‘Content-type: application/zip’ --data-binary @c:/pampers.zip http://localhost:8081/geoserver/rest/workspaces/test/datastores/pampers/file.shp

But I got :

java.io.IOException: Wrong magic number, expected 9994, got 1347093252

It seems to be as if Geoserver has treated my zip file as a shape file, because a “pampers” directory was created in my " geoserver\data\data" directory, but there is only one file in there : pampers.shp that has the same size of the original zip file.

What’s wrong in my code ???

thanks in advance

Eric