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:
- 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()
- In cURL, use the following command:
$ curl -u admin:pwd -XGET -H 'Accept: text/xml' http://localhost:8080/geoserver/rest/workspaces/ ...