Workspace Commands#
Manage GeoServer workspaces. Workspaces are logical containers for organizing related data stores and layers.
List Workspaces#
List all workspaces in GeoServer.
1
| ./geoserver-cli workspace list
|
Output:
1
2
3
| my_workspace
another_workspace
default_workspace
|
Get Workspace#
Get details for a specific workspace.
1
2
3
4
5
| # Get by name
./geoserver-cli workspace get my_workspace
# Get default workspace
./geoserver-cli workspace get --default
|
Output:
1
| my_workspace http://localhost:8080/geoserver/rest/workspaces/my_workspace.json
|
Create Workspace#
Create a new workspace.
1
| ./geoserver-cli workspace create my_new_workspace
|
Output:
1
| Workspace "my_new_workspace" created.
|
Delete Workspace#
Delete a workspace. Requires --yes flag for safety.
1
| ./geoserver-cli workspace delete my_workspace --yes
|
Output:
1
| Workspace "my_workspace" deleted.
|
!!! warning “Deletion is Permanent”
Deleting a workspace removes all associated datastores and layers. This action cannot be undone.
Examples#
Create and Verify Workspace#
1
2
3
4
5
6
7
8
| # Create workspace
./geoserver-cli workspace create production
# Verify it exists
./geoserver-cli workspace get production
# List all workspaces
./geoserver-cli workspace list
|
Get Default Workspace#
1
2
3
4
5
| # Get GeoServer's default workspace
./geoserver-cli workspace get --default
# Set as your CLI default
export GEOSRVCLI_DEFAULT_WORKSPACE=$(./geoserver-cli workspace get --default | cut -f1)
|