styles.yaml 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985
  1. ---
  2. swagger: '2.0'
  3. info:
  4. version: 1.0.0
  5. title: GeoServer Styles
  6. description: A style describes how a resource is symbolized or rendered by the Web Map Service.
  7. contact:
  8. name: GeoServer
  9. email: 'geoserver-users@osgeo.org'
  10. url: 'https://geoserver.org/comm/'
  11. host: localhost:8080
  12. basePath: /geoserver/rest
  13. paths:
  14. /styles:
  15. get:
  16. operationId: getStyles
  17. tags:
  18. - "Styles"
  19. summary: Get a list of styles
  20. description: Displays a list of all styles on the server. Use the "Accept:" header to specify format or append an extension to the endpoint (example "/styles.xml" for XML).
  21. produces:
  22. - application/xml
  23. - application/json
  24. - text/html
  25. responses:
  26. 200:
  27. description: OK
  28. schema:
  29. $ref: "#/definitions/StyleList"
  30. examples:
  31. application/xml: |
  32. <styles>
  33. <style>
  34. <name>burg</name>
  35. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/styles/burg.xml" type="application/xml"/>
  36. </style>
  37. <style>
  38. <name>capitals</name>
  39. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/styles/capitals.xml" type="application/xml"/>
  40. </style>
  41. </styles>
  42. application/json: |
  43. {"styles":
  44. {"style":
  45. [ {"href":"http://localhost:8080/geoserver/rest/styles/burg.json", "name":"burg"},
  46. {"href":"http://localhost:8080/geoserver/rest/styles/capitals.json", "name":"capitals"}]}}
  47. post:
  48. operationId: postStyles
  49. tags:
  50. - "Styles"
  51. summary: Add a new style
  52. description: |
  53. Adds a new style entry to the server.
  54. Using POST with the `application/xml` or `application/json` content only adds the style info to the catalog and does not upload style content. PUT to `/styles/{style}` to upload the style in this case.
  55. Use POST with a style file (`application/vnd.ogc.sld+xml` or `application/vnd.ogc.se+xml` for SLD; additional style types are added by extensions) to generate a style info and upload the style all at once. Then separately PUT the style info at `/styles/{style}` to make any desired changes to the generated catalog entry.
  56. You can also use POST with a ZIP file to upload a SLD 1.0 (`application/vnd.ogc.sld+xml`) file and any associated icon files, and then separately PUT the style info at /styles/{style}. POST with a ZIP file does not support any other style types.
  57. parameters:
  58. - $ref: "#/parameters/StyleInfoPost"
  59. - name: name
  60. in: query
  61. type: string
  62. description: The name of the style. Used only when POSTing a style file or ZIP bundle, to determine the name of the style in the catalog. Generated from the filename if not provided.
  63. required: false
  64. - name: Content-Type
  65. in: header
  66. type: string
  67. description: Content-Type of the style file. Used to determine style encoding when POSTing a style file (e.g. SLD or SE).
  68. required: false
  69. consumes:
  70. - application/xml
  71. - application/json
  72. - application/zip
  73. - text/xml
  74. - text/json
  75. - application/vnd.ogc.sld+xml
  76. - application/vnd.ogc.se+xml
  77. - application/vnd.geoserver.geocss+css
  78. - application/vnd.geoserver.ysld+yaml
  79. - application/vnd.geoserver.mbstyle+json
  80. produces:
  81. - text/plain
  82. responses:
  83. 201:
  84. description: Created
  85. put:
  86. operationId: putStyles
  87. tags:
  88. - "Styles"
  89. description: Invalid. Use POST for adding a new style, or use PUT with /styles/{style} to edit/upload an existing style.
  90. responses:
  91. 405:
  92. description: Method Not Allowed
  93. delete:
  94. operationId: deleteStyles
  95. tags:
  96. - "Styles"
  97. description: Invalid. Use /styles/{style} instead.
  98. responses:
  99. 405:
  100. description: Method Not Allowed
  101. /styles/{style}:
  102. get:
  103. operationId: getStyle
  104. tags:
  105. - "Styles"
  106. summary: Retrieve a style
  107. description: |
  108. Retrieves a single style. Used to both request the style info and the style definition body, depending on the media type requested. The media type can be specified either by using the "Accept:" header or by appending an extension to the endpoint. For example, a style info can be requested in XML format using "/styles/{style}.xml" or "Accept: application/xml". (Also available: "{style}.json", "Accept: application/json" "{style}.html", and "Accept: text/html").
  109. The style definition body can be requested by either appending the file extension of the style file (e.g., "{style}.sld" or "{style}.css") or by specifying the correct media type for the style definition in the "Accept" header.
  110. Be aware that by default, if extension is specified, it will override media type. For example if you use SLD 1.1.0 style and specify .sld extension (which provides SLD 1.0.0 result), but use application/vnd.ogc.se+xml media type (which provides SLD 1.1.0 result), response still will be presented in sld version 1.0.0
  111. Below are common style formats and the corresponding media types that can be used in the Accept header to request the style definition body.
  112. - application/vnd.ogc.sld+xml for SLD 1.0.0 SLDs
  113. - application/vnd.ogc.se+xml for SLD 1.1.0 SLDs
  114. - application/vnd.geoserver.geocss+css for css styles
  115. - application/vnd.geoserver.ysld+yaml for ysld styles
  116. - application/vnd.geoserver.mbstyle+json for mb styles
  117. produces:
  118. - application/xml
  119. - application/json
  120. - application/vnd.ogc.sld+xml
  121. - application/vnd.ogc.se+xml
  122. - text/html
  123. parameters:
  124. - name: style
  125. in: path
  126. required: true
  127. description: Name of the style to retrieve.
  128. type: string
  129. responses:
  130. 200:
  131. description: OK
  132. schema:
  133. $ref: "#/definitions/Style"
  134. examples:
  135. application/xml: |
  136. <style>
  137. <name>rain</name>
  138. <format>sld</format>
  139. <languageVersion>
  140. <version>1.0.0</version>
  141. </languageVersion>
  142. <filename>rain.sld</filename>
  143. </style>
  144. application/json: |
  145. {"style":
  146. {"name":"rain", "format":"sld",
  147. "languageVersion": {"version":"1.0.0"},
  148. "filename":"rain.sld"}
  149. }
  150. application/vnd.ogc.sld+xml: |
  151. <?xml version="1.0" encoding="UTF-8"?>
  152. <StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
  153. xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  154. xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
  155. <NamedLayer>
  156. <Name>rain</Name>
  157. <UserStyle>
  158. <Name>rain</Name>
  159. <Title>Rain distribution</Title>
  160. <FeatureTypeStyle>
  161. <Rule>
  162. <RasterSymbolizer>
  163. <Opacity>1.0</Opacity>
  164. <ColorMap>
  165. <ColorMapEntry color="#FF0000" quantity="0" />
  166. <ColorMapEntry color="#FFFFFF" quantity="100"/>
  167. <ColorMapEntry color="#00FF00" quantity="2000"/>
  168. <ColorMapEntry color="#0000FF" quantity="5000"/>
  169. </ColorMap>
  170. </RasterSymbolizer>
  171. </Rule>
  172. </FeatureTypeStyle>
  173. </UserStyle>
  174. </NamedLayer>
  175. </StyledLayerDescriptor>
  176. post:
  177. operationId: postStyle
  178. tags:
  179. - "Styles"
  180. description: Invalid. Use PUT to edit a style, or POST with /styles to add a new style.
  181. parameters:
  182. - name: style
  183. in: path
  184. required: true
  185. description: Name of the style to retrieve.
  186. type: string
  187. responses:
  188. 405:
  189. description: Method Not Allowed
  190. put:
  191. operationId: putStyle
  192. tags:
  193. - "Styles"
  194. summary: Modify a single style
  195. description: |
  196. Modifies a single style.
  197. Use the "Accept:" header to specify format or append an extension to the endpoint (example `/styles/{style}.xml` for XML).
  198. Using PUT with the `application/xml` or `application/json` content modifies the style info in the catalog and does not alter the style content.
  199. Using PUT with any other format will modify the content of the style. You can also use PUT with a ZIP file to upload a SLD 1.0 (`application/vnd.ogc.sld+xml`) file and any associated icon files
  200. parameters:
  201. - $ref: "#/parameters/StyleInfoPut"
  202. - name: style
  203. in: path
  204. required: true
  205. description: Name of the style to edit.
  206. type: string
  207. - name: raw
  208. in: query
  209. description: When set to "true", will forgo parsing and encoding of the uploaded style content, and instead the style will be streamed directly to the GeoServer configuration. Use this setting if the content and formatting of the style is to be preserved exactly. May result in an invalid and unusable style if the payload is malformed. Allowable values are "true" or "false" (default). Only used when uploading a style file.
  210. type: boolean
  211. required: false
  212. default: false
  213. consumes:
  214. - application/json
  215. - application/zip
  216. - text/xml
  217. - application/xml
  218. - text/json
  219. - application/vnd.ogc.sld+xml
  220. - application/vnd.ogc.se+xml
  221. - application/vnd.geoserver.geocss+css
  222. - application/vnd.geoserver.mbstyle+json
  223. - application/vnd.geoserver.ysld+yaml
  224. responses:
  225. 200:
  226. description: OK
  227. 401:
  228. description: Unauthorized
  229. delete:
  230. operationId: deleteStyle
  231. tags:
  232. - "Styles"
  233. summary: Delete style
  234. description: Deletes a style.
  235. parameters:
  236. - name: style
  237. in: path
  238. required: true
  239. description: Name of the style to delete.
  240. type: string
  241. - name: purge
  242. in: query
  243. required: false
  244. default: false
  245. description: Specifies whether the underlying file containing the style should be deleted on disk.
  246. type: boolean
  247. - name: recurse
  248. in: query
  249. required: false
  250. default: false
  251. description: Removes references to the specified style in existing layers.
  252. type: boolean
  253. responses:
  254. 200:
  255. description: OK
  256. 401:
  257. description: Unauthorized
  258. /workspaces/{workspace}/styles:
  259. get:
  260. operationId: getWorkspaceStyles
  261. tags:
  262. - "Styles"
  263. summary: Get a list of styles in a given workspace
  264. description: Displays a list of all styles in a given workspace. Use the "Accept:" header to specify format or append an extension to the endpoint (example "/workspaces/{workspace}/styles.xml" for XML).
  265. parameters:
  266. - name: workspace
  267. in: path
  268. required: true
  269. description: Name of workspace
  270. type: string
  271. produces:
  272. - application/xml
  273. - application/json
  274. - text/html
  275. responses:
  276. 200:
  277. description: OK
  278. schema:
  279. $ref: "#/definitions/StyleList"
  280. examples:
  281. application/xml: |
  282. <styles>
  283. <style>
  284. <name>burg</name>
  285. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/workspaces/sf/styles/burg.xml" type="application/xml"/>
  286. </style>
  287. <style>
  288. <name>dem</name>
  289. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/workspaces/sf/styles/dem.xml" type="application/xml"/>
  290. </style>
  291. </styles>
  292. application/json: |
  293. {
  294. "styles": {
  295. "style": [
  296. {
  297. "name": "burg",
  298. "href": "http://localhost:8080/geoserver/rest/workspaces/sf/styles/burg.json"
  299. },
  300. {
  301. "name": "dem",
  302. "href": "http://localhost:8080/geoserver/rest/workspaces/sf/styles/dem.json"
  303. }
  304. ]
  305. }
  306. }
  307. post:
  308. operationId: postWorkspaceStyles
  309. tags:
  310. - "Styles"
  311. summary: Add a new style to a given workspace
  312. description: |
  313. Adds a new style entry to the server.
  314. Using POST with the `application/xml` or `application/json` content only adds the style info to the catalog and does not upload style content. PUT to `/workspaces/{workspace}/styles/{style}` to upload the style in this case.
  315. Use POST with a style file (`application/vnd.ogc.sld+xml` or `application/vnd.ogc.sld+xml` for SLD; additional style types are added by extensions) to generate a style info and upload the style all at once. Then separately PUT the style info at `/workspaces/{workspace}/styles/{style}` to make any desired changes to the generated catalog entry.
  316. You can also use POST with a ZIP file to upload a SLD 1.0 (`application/vnd.ogc.sld+xml`) file and any associated icon files, and then separately PUT the style info at /workspaces/{workspace}/styles/{style}. POST with a ZIP file does not support any other style types.
  317. parameters:
  318. - name: workspace
  319. in: path
  320. required: true
  321. description: Name of workspace
  322. type: string
  323. - $ref: "#/parameters/StyleInfoPost"
  324. - name: name
  325. in: query
  326. type: string
  327. description: The name of the style. Used only when POSTing a style file or ZIP bundle, to determine the name of the style in the catalog. Generated from the filename if not provided.
  328. required: false
  329. - name: Content-Type
  330. in: header
  331. type: string
  332. description: Content-Type of the style file. Used to determine style encoding when POSTing a style file (e.g. SLD or SE).
  333. required: false
  334. consumes:
  335. - application/xml
  336. - application/json
  337. - application/zip
  338. - text/html
  339. - text/json
  340. - application/vnd.ogc.sld+xml
  341. - application/vnd.ogc.se+xml
  342. - application/vnd.geoserver.geocss+css
  343. - application/vnd.geoserver.ysld+yaml
  344. - application/vnd.geoserver.mbstyle+json
  345. produces:
  346. - text/plain
  347. responses:
  348. 201:
  349. description: Created
  350. put:
  351. operationId: putWorkspaceStyles
  352. tags:
  353. - "Styles"
  354. description: Invalid. Use POST for adding a new style, or use PUT with /workspaces/{workspace}/styles/{style} to edit/upload an existing style.
  355. parameters:
  356. - name: workspace
  357. in: path
  358. required: true
  359. description: Name of workspace
  360. type: string
  361. responses:
  362. 405:
  363. description: Method Not Allowed
  364. delete:
  365. operationId: deleteWorkspaceStyles
  366. tags:
  367. - "Styles"
  368. description: Invalid. Use /workspaces/{workspace}/styles/{style} instead.
  369. parameters:
  370. - name: workspace
  371. in: path
  372. required: true
  373. description: Name of workspace
  374. type: string
  375. responses:
  376. 405:
  377. description: Method Not Allowed
  378. /rest/workspaces/{workspace}/styles/{style}:
  379. get:
  380. operationId: getWorkspaceStyle
  381. tags:
  382. - "Styles"
  383. summary: Retrieve a style from a given workspace
  384. description: |
  385. Retrieves a single style. Used to both request the style info and the style definition body, depending on the media type requested. The media type can be specified either by using the "Accept:" header or by appending an extension to the endpoint. For example, a style info can be requested in XML format using "/styles/{style}.xml" or "Accept: application/xml". (Also available: "{style}.json", "Accept: application/json" "{style}.html", and "Accept: text/html").
  386. The style definition body can be requested by either appending the file extension of the style file (e.g., "{style}.sld" or "{style}.css") or by specifying the correct media type for the style definition in the "Accept" header.
  387. Be aware that by default, if extension is specified, it will override media type. For example if you use SLD 1.1.0 style and specify .sld extension (which provides SLD 1.0.0 result), but use application/vnd.ogc.se+xml media type (which provides SLD 1.1.0 result), response still will be presented in sld version 1.0.0
  388. Below are common style formats and the corresponding media types that can be used in the Accept header to request the style definition body.
  389. - application/vnd.ogc.sld+xml for SLD 1.0.0 SLDs
  390. - application/vnd.ogc.se+xml for SLD 1.1.0 SLDs
  391. - application/vnd.geoserver.geocss+css for css styles
  392. - application/vnd.geoserver.ysld+yaml for ysld styles
  393. - application/vnd.geoserver.mbstyle+json for mb styles
  394. produces:
  395. - application/xml
  396. - application/json
  397. - application/vnd.ogc.sld+xml
  398. - application/vnd.ogc.se+xml
  399. - text/html
  400. parameters:
  401. - name: workspace
  402. in: path
  403. required: true
  404. description: Name of the workspace for style definitions
  405. type: string
  406. - name: style
  407. in: path
  408. required: true
  409. description: Name of the style to retrieve.
  410. type: string
  411. responses:
  412. 200:
  413. description: OK
  414. schema:
  415. $ref: "#/definitions/StyleWorkspace"
  416. examples:
  417. application/xml: |
  418. <style>
  419. <name>burg</name>
  420. <workspace>
  421. <name>sf</name>
  422. </workspace>
  423. <format>sld</format>
  424. <languageVersion>
  425. <version>1.0.0</version>
  426. </languageVersion>
  427. <filename>burg.sld</filename>
  428. </style>
  429. application/json: |
  430. {"style":
  431. {"name":"burg",
  432. "workspace": {"name":"sf"},
  433. "format":"sld",
  434. "languageVersion":{"version":"1.0.0"},
  435. "filename":"burg.sld"}}
  436. application/vnd.ogc.sld+xml: |
  437. <StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
  438. xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  439. xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
  440. <NamedLayer>
  441. <Name>redflag</Name>
  442. <UserStyle>
  443. <Name>burg</Name>
  444. <Title>A small red flag</Title>
  445. <Abstract>A sample of how to use an SVG based symbolizer</Abstract>
  446. <FeatureTypeStyle>
  447. <Rule>
  448. <Title>Red flag</Title>
  449. <PointSymbolizer>
  450. <Graphic>
  451. <ExternalGraphic>
  452. <OnlineResource xlink:type="simple" xlink:href="burg02.svg" />
  453. <Format>image/svg+xml</Format>
  454. </ExternalGraphic>
  455. <Size>
  456. <ogc:Literal>20</ogc:Literal>
  457. </Size>
  458. </Graphic>
  459. </PointSymbolizer>
  460. </Rule>
  461. </FeatureTypeStyle>
  462. </UserStyle>
  463. </NamedLayer>
  464. </StyledLayerDescriptor>
  465. post:
  466. operationId: postWorkspaceStyle
  467. tags:
  468. - "Styles"
  469. description: Invalid. Use PUT to edit a style, or POST with /workspaces/{workspace}/styles to add a new style.
  470. parameters:
  471. - name: workspace
  472. in: path
  473. required: true
  474. description: Name of the workspace for style definitions
  475. type: string
  476. - name: style
  477. in: path
  478. required: true
  479. description: Name of the style to retrieve.
  480. type: string
  481. responses:
  482. 405:
  483. description: Method Not Allowed
  484. put:
  485. operationId: putWorkspaceStyle
  486. tags:
  487. - "Styles"
  488. summary: Modify a single style in a given workspace
  489. description: |
  490. Modifies a single style in a given workspace.
  491. Use the "Accept:" header to specify format or append an extension to the endpoint (example `/workspaces/{workspace}/styles/{style}.xml` for XML).
  492. Using PUT with the `application/xml` or `application/json` content modifies the style info in the catalog and does not alter the style content.
  493. Using PUT with any other format will modify the content of the style. You can also use PUT with a ZIP file to upload a SLD 1.0 (`application/vnd.ogc.sld+xml`) file and any associated icon files
  494. parameters:
  495. - $ref: "#/parameters/StyleInfoPut"
  496. - name: workspace
  497. in: path
  498. required: true
  499. description: Name of the workspace for style definitions
  500. type: string
  501. - name: style
  502. in: path
  503. required: true
  504. description: Name of the style to retrieve.
  505. type: string
  506. - name: raw
  507. in: query
  508. description: When set to "true", will forgo parsing and encoding of the uploaded style content, and instead the style will be streamed directly to the GeoServer configuration. Use this setting if the content and formatting of the style is to be preserved exactly. May result in an invalid and unusable style if the payload is malformed. Allowable values are "true" or "false" (default). Only used when uploading a style file.
  509. type: boolean
  510. required: false
  511. consumes:
  512. - application/json
  513. - application/zip
  514. - text/xml
  515. - application/xml
  516. - text/json
  517. - application/vnd.ogc.sld+xml
  518. - application/vnd.ogc.se+xml
  519. - application/vnd.geoserver.geocss+css
  520. - application/vnd.geoserver.ysld+yaml
  521. - application/vnd.geoserver.mbstyle+json
  522. responses:
  523. 200:
  524. description: OK
  525. 401:
  526. description: Unauthorized
  527. delete:
  528. operationId: deleteWorkspaceStyle
  529. tags:
  530. - "Styles"
  531. summary: Delete style in a given workspace
  532. description: Deletes a style in a given workspace.
  533. parameters:
  534. - name: workspace
  535. in: path
  536. required: true
  537. description: Name of the workspace for style definitions
  538. type: string
  539. - name: style
  540. in: path
  541. required: true
  542. description: Name of the style to delete.
  543. type: string
  544. - name: purge
  545. in: query
  546. required: false
  547. default: false
  548. description: Specifies whether the underlying file containing the style should be deleted on disk.
  549. type: boolean
  550. - name: recurse
  551. in: query
  552. required: false
  553. default: false
  554. description: Removes references to the specified style in existing layers.
  555. type: boolean
  556. responses:
  557. 200:
  558. description: OK
  559. 401:
  560. description: Unauthorized
  561. /rest/layers/{layer}/styles:
  562. get:
  563. operationId: getLayerStyles
  564. tags:
  565. - "Styles"
  566. summary: Get a list of layer alternate styles
  567. description: Displays a list of all alternate styles for a given layer. Use the "Accept:" header to specify format or append an extension to the endpoint (example "/layers/{layer}/styles.xml" for XML).
  568. parameters:
  569. - name: layer
  570. in: path
  571. required: true
  572. description: Name of the layer to manage styles for
  573. type: string
  574. produces:
  575. - application/xml
  576. - application/json
  577. - text/html
  578. responses:
  579. 200:
  580. description: OK
  581. schema:
  582. $ref: "#/definitions/StyleList"
  583. examples:
  584. application/xml: |
  585. <styles>
  586. <style>
  587. <name>pophatch</name>
  588. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/layers/topp:states/styles/pophatch.xml" type="application/xml"/>
  589. </style>
  590. <style>
  591. <name>polygon</name>
  592. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/layers/topp:states/styles/polygon.xml" type="application/xml"/>
  593. </style>
  594. </styles>
  595. application/json: |
  596. {
  597. "styles": {
  598. "style": [
  599. {
  600. "name": "pophatch",
  601. "href": "http://localhost:8080/geoserver/rest/layers/topp:states/styles/pophatch.json"
  602. },
  603. {
  604. "name": "polygon",
  605. "href": "http://localhost:8080/geoserver/rest/layers/topp:states/styles/polygon.json"
  606. }
  607. ]
  608. }
  609. }
  610. post:
  611. operationId: postLayerStyles
  612. tags:
  613. - "Styles"
  614. summary: Add a new style
  615. description: Adds a new style entry to the layer. The style named in styleBody must already exist, and will not be altered by this request.
  616. parameters:
  617. - name: layer
  618. in: path
  619. required: true
  620. description: Name of the layer to manage styles for
  621. type: string
  622. - name: styleBody
  623. description: Style body information naming an existing style to add to the layer
  624. in: body
  625. required: true
  626. schema:
  627. $ref: "#/definitions/StyleInfoPost"
  628. - name: default
  629. type: boolean
  630. in: query
  631. description: Whether to make this the default style for the layer.
  632. default: false
  633. required: false
  634. consumes:
  635. - application/xml
  636. - application/json
  637. responses:
  638. 201:
  639. description: Created
  640. put:
  641. operationId: putLayerStyles
  642. tags:
  643. - "Styles"
  644. description: Invalid. Use POST to modify the styles for a layer.
  645. parameters:
  646. - name: layer
  647. in: path
  648. required: true
  649. description: Name of the layer to manage styles for
  650. type: string
  651. responses:
  652. 405:
  653. description: Method Not Allowed
  654. delete:
  655. operationId: deleteLayerStyles
  656. tags:
  657. - "Styles"
  658. description: Invalid.
  659. parameters:
  660. - name: layer
  661. in: path
  662. required: true
  663. description: Name of the layer to manage styles for
  664. type: string
  665. responses:
  666. 405:
  667. description: Method Not Allowed
  668. parameters:
  669. StyleInfoPost:
  670. name: styleBody
  671. description: >
  672. The style body of a request
  673. JSON or XML style uploads follow the schema. For example:
  674. - application/xml:
  675. ```
  676. <style>
  677. <name>roads_style</name>
  678. <filename>roads.sld</filename>
  679. </style>
  680. ```
  681. - application/json:
  682. ```
  683. {
  684. "style": {
  685. "name": "roads_style",
  686. "filename": "roads.sld"
  687. }
  688. }
  689. ```
  690. Otherwise, the style body is an actual style:
  691. - application/zip:
  692. ```
  693. <ZIP file containing SLD and icons>
  694. ```
  695. - application/vnd.ogc.sld+xml:
  696. ```
  697. <?xml version="1.0" encoding="UTF-8"?>
  698. <StyledLayerDescriptor version="1.0.0"
  699. xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
  700. xmlns="http://www.opengis.net/sld"
  701. xmlns:ogc="http://www.opengis.net/ogc"
  702. xmlns:xlink="http://www.w3.org/1999/xlink"
  703. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  704. <!-- a Named Layer is the basic building block of an SLD document -->
  705. <NamedLayer>
  706. <Name>default_line</Name>
  707. <UserStyle>
  708. <!-- Styles can have names, titles and abstracts -->
  709. <Title>Default Line</Title>
  710. <Abstract>A sample style that draws a line</Abstract>
  711. <!-- FeatureTypeStyles describe how to render different features -->
  712. <!-- A FeatureTypeStyle for rendering lines -->
  713. <FeatureTypeStyle>
  714. <Rule>
  715. <Name>rule1</Name>
  716. <Title>Blue Line</Title>
  717. <Abstract>A solid blue line with a 1 pixel width</Abstract>
  718. <LineSymbolizer>
  719. <Stroke>
  720. <CssParameter name="stroke">#0000FF</CssParameter>
  721. </Stroke>
  722. </LineSymbolizer>
  723. </Rule>
  724. </FeatureTypeStyle>
  725. </UserStyle>
  726. </NamedLayer>
  727. </StyledLayerDescriptor>
  728. ```
  729. in: body
  730. required: true
  731. schema:
  732. $ref: "#/definitions/StyleInfoPost"
  733. StyleInfoPut:
  734. name: styleBody
  735. description: >
  736. The style body of a request.
  737. For a PUT, only values which should be changed need to be included.
  738. JSON or XML style uploads follow the schema, and alter the style configuration. For example:
  739. - application/xml:
  740. ```
  741. <style>
  742. <name>roads_style</name>
  743. <languageVersion>
  744. <version>1.0.0</version>
  745. </languageVersion>
  746. <filename>roads.sld</filename>
  747. <legend>
  748. <width>32</width>
  749. <height>32</height>
  750. <format>image/png; charset=UTF-8</format>
  751. <onlineResource>legend.png</onlineResource>
  752. </legend>
  753. </style>
  754. ```
  755. - application/json:
  756. ```
  757. {
  758. "style": {
  759. "name": "roads_style",
  760. "languageVersion": {
  761. "version": "1.0.0"
  762. },
  763. "filename": "roads.sld",
  764. "legend": {
  765. "format": "image/png; charset=UTF-8",
  766. "height": 32,
  767. "width": 32,
  768. "onlineResource": "grass_fill.png"
  769. }
  770. }
  771. }
  772. ```
  773. Otherwise, the style body is an actual style:
  774. - application/zip:
  775. ```
  776. <ZIP file containing SLD and icons>
  777. ```
  778. - application/vnd.ogc.sld+xml:
  779. ```
  780. <?xml version="1.0" encoding="UTF-8"?>
  781. <StyledLayerDescriptor version="1.0.0"
  782. xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
  783. xmlns="http://www.opengis.net/sld"
  784. xmlns:ogc="http://www.opengis.net/ogc"
  785. xmlns:xlink="http://www.w3.org/1999/xlink"
  786. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  787. <!-- a Named Layer is the basic building block of an SLD document -->
  788. <NamedLayer>
  789. <Name>default_line</Name>
  790. <UserStyle>
  791. <!-- Styles can have names, titles and abstracts -->
  792. <Title>Default Line</Title>
  793. <Abstract>A sample style that draws a line</Abstract>
  794. <!-- FeatureTypeStyles describe how to render different features -->
  795. <!-- A FeatureTypeStyle for rendering lines -->
  796. <FeatureTypeStyle>
  797. <Rule>
  798. <Name>rule1</Name>
  799. <Title>Blue Line</Title>
  800. <Abstract>A solid blue line with a 1 pixel width</Abstract>
  801. <LineSymbolizer>
  802. <Stroke>
  803. <CssParameter name="stroke">#0000FF</CssParameter>
  804. </Stroke>
  805. </LineSymbolizer>
  806. </Rule>
  807. </FeatureTypeStyle>
  808. </UserStyle>
  809. </NamedLayer>
  810. </StyledLayerDescriptor>
  811. ```
  812. in: body
  813. required: true
  814. schema:
  815. $ref: "#/definitions/StyleInfoPost"
  816. definitions:
  817. StyleInfoPost:
  818. title: style
  819. type: object
  820. properties:
  821. name:
  822. type: string
  823. description: Name of style
  824. example: roads_style
  825. filename:
  826. type: string
  827. description: Name of filename containing SLD code
  828. example: roads.sld
  829. StyleList:
  830. title: styles
  831. type: array
  832. items:
  833. $ref: '#/definitions/StyleListItem'
  834. StyleListItem:
  835. title: style
  836. type: object
  837. properties:
  838. name:
  839. type: string
  840. description: Name of style
  841. href:
  842. type: string
  843. description: URL to style definition
  844. Style:
  845. type: object
  846. title: style
  847. properties:
  848. name:
  849. type: string
  850. description: Name of style
  851. format:
  852. type: string
  853. description: Format of style
  854. languageVersion:
  855. type: object
  856. properties:
  857. version:
  858. type: string
  859. description: Version of style format
  860. filename:
  861. type: string
  862. description: File name of the style
  863. StyleWorkspace:
  864. type: object
  865. title: style
  866. properties:
  867. name:
  868. type: string
  869. description: Name of style
  870. workspace:
  871. type: object
  872. properties:
  873. name:
  874. type: string
  875. description: Name of workspace containing the style
  876. format:
  877. type: string
  878. description: Format of style
  879. languageVersion:
  880. type: object
  881. properties:
  882. version:
  883. type: string
  884. description: Version of style format
  885. filename:
  886. type: string
  887. description: File name of the style
  888. StyleLayer:
  889. type: object
  890. title: style
  891. properties:
  892. name:
  893. type: string
  894. description: Name of style
  895. layer:
  896. type: object
  897. properties:
  898. name:
  899. type: string
  900. description: Name of layer containing the style
  901. format:
  902. type: string
  903. description: Format of style
  904. languageVersion:
  905. type: object
  906. properties:
  907. version:
  908. type: string
  909. description: Version of style format
  910. filename:
  911. type: string
  912. description: File name of the style