Styles

A style describes how a resource (feature type or coverage) should be symbolized or rendered by the Web Map Service. In GeoServer styles are specified with SLD.

/styles[.<format>]

Controls all styles.

Method Action Status code Formats Default Format Parameters
GET Return all styles 200 HTML, XML, JSON HTML  
POST Create a new style 201 with Location header SLD, XML, JSON See note below   name
PUT   405      
DELETE   405     purge

When executing a POST or PUT request with an SLD style, the Content-type header should be set to application/vnd.ogc.sld+xml.

Parameters

name

The name parameter specifies the name to be given to the style. This option is most useful when executing a POST request with a style in SLD format, and an appropriate name can be not be inferred from the SLD itself.

/styles/<s>[.<format>]

Controls a given style.

Method Action Status code Formats Default Format
GET Return style s 200 SLD, HTML, XML, JSON HTML
POST   405    
PUT Modify style s 200 SLD, XML, JSON, See note above  
DELETE Delete style s 200    

Exceptions

Exception Status code
GET for a style that does not exist 404
PUT that changes name of style 403
DELETE against style which is referenced by existing layers 403

Parameters

purge

The purge parameter specifies whether the underlying SLD file for the style should be deleted on disk. Allowable values for this parameter are “true” or “false”. When set to “true” the underlying file will be deleted.

/workspaces/<ws>/styles[.<format>]

Controls all styles in a given workspace.

Method Action Status code Formats Default Format Parameters
GET Return all styles within workspace ws 200 HTML, XML, JSON HTML  
POST Create a new style within workspace ws 201 with Location header SLD, XML, JSON, See note above   name
PUT   405      
DELETE   405     purge

/workspaces/<ws>/styles/<s>[.<format>]

Controls a particular style in a given workspace.

Method Action Status code Formats Default Format
GET Return style s within workspace ws 200 SLD, HTML, XML, JSON HTML
POST   405    
PUT Modify style s within workspace ws 200 SLD, XML, JSON See note above  
DELETE Delete style s within workspace ws 200