Time for action – managing data stores
Did you enjoy using cURL and Python? Where we are again with cURL and Python, 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:
>>> myUrl = 'http://localhost:8080/geoserver/rest/workspaces/NaturalEarth/datastores' >>> headers = {'Accept': 'text/xml'} >>> resp = requests.get(myUrl,auth=('admin','password'),headers=headers)
In cURL, use the following command:
curl -u admin:password -XGET -H 'Accept: text/xml ' http://localhost:8080/geoserver/rest/workspaces/NaturalEarth/datastor es -o naturalEarthDataStores.xml
The response contains all the data stores linked to the workspace. The only attribute is the name and the link to retrieve the detailed information about each one:
<dataStores> <dataStore> <name>Natural Earth Shapes</name> ...