The GeoServer REST API docs here does not detail how to do this. I'd like to create a PostGIS table and corresponding featureType in GeoServer using the REST API, without having to chain requests.

For now I can upload a shapefile to geosever, but not to PostGIS. I can also create a PostGIS data store in a separate request. Unfortunately, its not possible to use an existing PostGIS data store when uploading a new shapefile. Anyone with experience on how to achieve, please assist.


I don't think you can do this using GeoServer - it isn't what the REST interface (or GeoServer) was designed to do. You need to use shp2psql (or any other uploader like ogr2ogr) to add shapefiles to PostGIS. The GeoServer REST interface is designed for adding new stores/layers etc to GeoServer.

| improve this answer | |
  • Hi Iant. That's what I thought. But its possible to create layers, postgis data store, workspaces, and features types based on existing tables using the REST API without much effort. So, I figured that it should be possible to upload the shape file to the postgis directly, and create corresponding feature type, all in one request. So far, I'm able to do this, but in 3 different requests: a request to create postgis data store, a request to create feature type, and a request to upload shape file to the data store (which is a postgis data store). – okello Jun 18 '12 at 11:33
  • Just to add: Im doing all this from an app I'm developing. Not from a command line. Im using C#. But I can translate cURL commands provided to C#. – okello Jun 18 '12 at 12:14

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.