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') 
        file.write(resp.text) 
        file.close() 
  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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.