Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am able to add individual tables to Geoserver using,

curl -u admin:geoserver -v -XPOST -H 'Content-type: text/xml' -d '<featureType><name>quadrella_indica</name></featureType>' http://localhost:8080/geoserver/rest/workspaces/opengeo/datastores/species/featuretypes

But I need to loop through the entire list of shp file and so,

for f in *.shp
   curl -u admin:geoserver -v -XPOST -H 'Content-type: text/xml' -d    '<featureType><name>${a%.*}</name></featureType>' http://localhost:8080/geoserver/rest/workspaces/opengeo/datastores/species/featuretypes 

Only returns a 400 Bad request error,

* About to connect() to localhost port 8080 (#0)
*   Trying ::1... connected
* Server auth using Basic with user 'admin'
> POST /geoserver/rest/workspaces/opengeo/datastores/species/featuretypes HTTP/1.1
> Authorization: Basic YWRtaW46Z2Vvc2VydmVy
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/ libidn/1.23 librtmp/2.3
> Host: localhost:8080
> Accept: */*
> Content-type: text/xml
> Content-Length: 47
* upload completely sent off: 47out of 47 bytes
< HTTP/1.1 400 Bad Request
< Server: Apache-Coyote/1.1
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Date: Sun, 25 Nov 2012 18:19:31 GMT
< Connection: close
* Closing connection #0
Trying to create new feature type inside the store, but no attributes were specified

The above error is repeated for all the shp files that are being added to geoserver. Any idea what is wrong?

share|improve this question
up vote 0 down vote accepted

I could not solve why this was not working and so ended up creating a perl command that works just fine.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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