Book Image

GeoServer Cookbook

By : Stefano Iacovella
Book Image

GeoServer Cookbook

By: Stefano Iacovella

Overview of this book

Table of Contents (17 chapters)
GeoServer Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Creating and editing data stores with REST


Data stores connect GeoServer to your data. You can't use data that is not supported by GeoServer without a built-in connector or a plugin. Of course, the REST interface supports all operations on data stores. If you plan to automate GeoServer configurations, it is very important to understand how data stores can be created and edited.

The resource exposed is in the following form:

/workspaces/<ws>/datastores

Here, ws stands for the workspace on which the data store is linked.

How to do it…

  1. As usual, you can use the GET operation to retrieve information about which data stores are available in the configuration for a specific workspace. Let's retrieve information in Python:

    >>> myUrl = 'http://localhost:8080/geoserver/rest/workspaces/NaturalEarth/datastores'
    >>> headers = {'Accept': 'text/xml'}
    >>> resp = requests.get(myUrl,auth=('admin','geoserver'),headers=headers)
    
  2. Now do the same with cURL:

    $ curl -u admin:geoserver...