2

I have set up a workspace named "foo" and set its namespace to "bar".

How can I find out its namespace setting via the REST API? The information is not included in a call to /workspaces/foo nor in the /namespaces/:

$ curl -u "admin:geoserver" -X GET "http://localhost:8080/geoserver/rest/workspaces/foo" | json_pp
{
   "workspace" : {
      "coverageStores" : "http://localhost:8080/geoserver/rest/workspaces/foo/coveragestores.json",
      "dataStores" : "http://localhost:8080/geoserver/rest/workspaces/foo/datastores.json",
      "dateCreated" : "2024-04-25 08:47:10.879 UTC",
      "dateModified" : "2024-04-25 08:51:56.6 UTC",
      "isolated" : true,
      "name" : "foo",
      "wmsStores" : "http://localhost:8080/geoserver/rest/workspaces/foo/wmsstores.json",
      "wmtsStores" : "http://localhost:8080/geoserver/rest/workspaces/foo/wmtsstores.json"
   }
}
$ curl -u "admin:geoserver" -X GET "http://localhost:8080/geoserver/rest/namespaces/" | json_pp
{
   "namespaces" : {
      "namespace" : [
         {
            "href" : "http://localhost:8080/geoserver/rest/namespaces/default.json",
            "name" : "default"
         },
         {
            "href" : "http://localhost:8080/geoserver/rest/namespaces/foo.json",
            "name" : "foo"
         }
      ]
   }
}

1 Answer 1

2

There is a difference between namespace and namespace URI. In the GUI there is a field for the namespace URI which is what I am after:

enter image description here

The namespace itself is using the workspace's name so this query gives me the URI:

curl -u "admin:geoserver" -X GET "http://localhost:8080/geoserver/rest/namespaces/foo" | json_pp
{
   "namespace" : {
      "isolated" : false,
      "prefix" : "foo",
      "uri" : "bar"
   }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.