API reference for geoserver

46 Views Asked by At

I'm trying to update Abstract and Keyword fields for a specific layer in Geoserver (v2.24.2) via REST. However, the documentation isn't really up to date and does not cover those. I've gotten far enogh to update the Attribution and Metadata fields correctly using following body:

<?xml version="1.0" encoding="UTF-8"?>
<layer>
    <metadata>
        <entry key="buffer">somerandomnumber</entry>
    </metadata>
    <attribution>
        <title>update this field using Postman</title>
    </attribution>
</layer>

And the layers endpoint: https://myhost/geoserver/rest/layers/layername

How do I (if at all) access the title, abstract and keywords (+vocabulary) ones?

I've tried backtracking the references using both the REST JSON response .../geoserver/rest/workspaces/myworkspace/datastores/mylayer/featuretypes/mylayer.json and tracking the request using a browser and updating the fields. But to no luck. I also read most of the posts here referencing Geoserver + API

1

There are 1 best solutions below

2
Ian Turton On

In general the best way to solve REST issues is to request the relevant information with a GET request and use that as a template to show you what to send back.

Update

So if you look at the featuretype (http://localhost:8080/geoserver/rest/workspaces/sf/datastores/sf/featuretypes/roads.xml) you will see

<featureType>
   <name>roads</name>
   <nativeName>roads</nativeName>
   <namespace><name>sf</name>
   <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/namespaces/sf.xml" type="application/xml" />
   </namespace>
   <title>Spearfish roads</title>
   <abstract>Sample data from GRASS, road layout, Spearfish, South Dakota, USA</abstract>
   <keywords><string>sfRoads</string><string>spearfish</string><string>roads</string></keywords>

And the json variant will work too - http://localhost:8080/geoserver/rest/workspaces/sf/datastores/sf/featuretypes/roads.json