Managing data stores

Did you enjoy using cURL and Python? We hope so, as we are going to use cURL and Python again, since you are now so skilled! So, let's get information about data stores:

  1. The GET operation lets you know which data stores are available in the configuration. Retrieve the information in Python using the following code:
      import requests 
      myUrl =        'http://localhost:8080/geoserver/rest/        workspaces/Packt/datastores' 
      headers = {'Accept': 'text/xml'} 
      resp = requests.get(myUrl,auth=('admin','pwd'),headers=headers) 
      if resp.status_code == 200: 
        file = open('datastores_py.xml','w') 
  1. In cURL, use the following command:
      $ curl -u admin:pwd -XGET -H 'Accept: text/xml' http://localhost:8080/geoserver/rest/workspaces/ ...

Get GeoServer Beginner's Guide - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.