resource.yaml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. ---
  2. swagger: '2.0'
  3. info:
  4. version: 1.0.0
  5. title: GeoServer Resources
  6. description: A resource is any item in the data directory that does not represent configuration. Typical resources include styles and icons.
  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. /resource/{pathToResource}:
  15. parameters:
  16. - name: pathToResource
  17. in: path
  18. type: string
  19. required: true
  20. description: The full path to the resource. Required, but may be empty; a request to `/resource` references the top level resource directory.
  21. get:
  22. operationId: resourceGet
  23. tags:
  24. - "Resource"
  25. description: |
  26. Download a resource, list contents of directory, or show formatted resource metadata.
  27. Response content depends upon parameters.
  28. With `operation=default`, if the request is made against a non-directory resource, the content of the resource is returned.
  29. For example, `/resource/styles/default_point.sld?operation=default`
  30. ```
  31. <?xml version="1.0" encoding="UTF-8"?>
  32. <StyledLayerDescriptor version="1.0.0"
  33. xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
  34. xmlns="http://www.opengis.net/sld"
  35. xmlns:ogc="http://www.opengis.net/ogc"
  36. xmlns:xlink="http://www.w3.org/1999/xlink"
  37. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  38. <!-- a Named Layer is the basic building block of an SLD document -->
  39. <NamedLayer>
  40. <Name>default_point</Name>
  41. <UserStyle>
  42. <!-- Styles can have names, titles and abstracts -->
  43. <Title>Default Point</Title>
  44. <Abstract>A sample style that draws a point</Abstract>
  45. <!-- FeatureTypeStyles describe how to render different features -->
  46. <!-- A FeatureTypeStyle for rendering points -->
  47. <FeatureTypeStyle>
  48. <Rule>
  49. <Name>rule1</Name>
  50. <Title>Red Square</Title>
  51. <Abstract>A 6 pixel square with a red fill and no stroke</Abstract>
  52. <PointSymbolizer>
  53. <Graphic>
  54. <Mark>
  55. <WellKnownName>square</WellKnownName>
  56. <Fill>
  57. <CssParameter name="fill">#FF0000</CssParameter>
  58. </Fill>
  59. </Mark>
  60. <Size>6</Size>
  61. </Graphic>
  62. </PointSymbolizer>
  63. </Rule>
  64. </FeatureTypeStyle>
  65. </UserStyle>
  66. </NamedLayer>
  67. </StyledLayerDescriptor>
  68. ```
  69. If the request is made against a directory resource, a "ResourceDirectory" response is returned, containing information about the directory and its children.
  70. Examples:
  71. - `http://localhost:8080/geoserver/rest/resource/logs?operation=default&format=xml`
  72. ```
  73. <ResourceDirectory>
  74. <name>logs</name>
  75. <parent>
  76. <path>/</path>
  77. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://localhost:8080/geoserver/rest/resource/" rel="alternate" type="application/xml"/>
  78. </parent>
  79. <lastModified>2017-09-15 18:50:54.0 UTC</lastModified>
  80. <children>
  81. <child>
  82. <name>DEFAULT_LOGGING.xml</name>
  83. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://localhost:8080/geoserver/rest/resource/logs/DEFAULT_LOGGING.xml" rel="alternate" type="application/octet-stream"/>
  84. </child>
  85. <child>
  86. <name>geoserver.log</name>
  87. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://localhost:8080/geoserver/rest/resource/logs/geoserver.log" rel="alternate" type="application/octet-stream"/>
  88. </child>
  89. <child>
  90. <name>geoserver.log.1</name>
  91. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://localhost:8080/geoserver/rest/resource/logs/geoserver.log.1" rel="alternate" type="application/octet-stream"/>
  92. </child>
  93. <child>
  94. <name>geoserver.log.2</name>
  95. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://localhost:8080/geoserver/rest/resource/logs/geoserver.log.2" rel="alternate" type="application/octet-stream"/>
  96. </child>
  97. <child>
  98. <name>GEOSERVER_DEVELOPER_LOGGING.xml</name>
  99. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://localhost:8080/geoserver/rest/resource/logs/GEOSERVER_DEVELOPER_LOGGING.xml" rel="alternate" type="application/octet-stream"/>
  100. </child>
  101. <child>
  102. <name>GEOTOOLS_DEVELOPER_LOGGING.xml</name>
  103. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://localhost:8080/geoserver/rest/resource/logs/GEOTOOLS_DEVELOPER_LOGGING.xml" rel="alternate" type="application/octet-stream"/>
  104. </child>
  105. <child>
  106. <name>PRODUCTION_LOGGING.xml</name>
  107. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://localhost:8080/geoserver/rest/resource/logs/PRODUCTION_LOGGING.xml" rel="alternate" type="application/octet-stream"/>
  108. </child>
  109. <child>
  110. <name>QUIET_LOGGING.xml</name>
  111. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://localhost:8080/geoserver/rest/resource/logs/QUIET_LOGGING.xml" rel="alternate" type="application/octet-stream"/>
  112. </child>
  113. <child>
  114. <name>TEST_LOGGING.xml</name>
  115. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://localhost:8080/geoserver/rest/resource/logs/TEST_LOGGING.xml" rel="alternate" type="application/octet-stream"/>
  116. </child>
  117. <child>
  118. <name>VERBOSE_LOGGING.xml</name>
  119. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://localhost:8080/geoserver/rest/resource/logs/VERBOSE_LOGGING.xml" rel="alternate" type="application/octet-stream"/>
  120. </child>
  121. </children>
  122. </ResourceDirectory>
  123. ```
  124. - `http://localhost:8080/geoserver/rest/resource/logs?operation=default&format=json`
  125. ```
  126. {"ResourceDirectory":{"name":"logs","parent":{"path":"\/","link":{"href":"http:\/\/localhost:8080\/geoserver\/rest\/resource\/","rel":"alternate","type":"application\/json"}},"lastModified":"2017-09-15 18:50:54.0 UTC","children":{"child":[{"name":"DEFAULT_LOGGING.xml","link":{"href":"http:\/\/localhost:8080\/geoserver\/rest\/resource\/logs\/DEFAULT_LOGGING.xml","rel":"alternate","type":"application\/octet-stream"}},{"name":"geoserver.log","link":{"href":"http:\/\/localhost:8080\/geoserver\/rest\/resource\/logs\/geoserver.log","rel":"alternate","type":"application\/octet-stream"}},{"name":"geoserver.log.1","link":{"href":"http:\/\/localhost:8080\/geoserver\/rest\/resource\/logs\/geoserver.log.1","rel":"alternate","type":"application\/octet-stream"}},{"name":"geoserver.log.2","link":{"href":"http:\/\/localhost:8080\/geoserver\/rest\/resource\/logs\/geoserver.log.2","rel":"alternate","type":"application\/octet-stream"}},{"name":"GEOSERVER_DEVELOPER_LOGGING.xml","link":{"href":"http:\/\/localhost:8080\/geoserver\/rest\/resource\/logs\/GEOSERVER_DEVELOPER_LOGGING.xml","rel":"alternate","type":"application\/octet-stream"}},{"name":"GEOTOOLS_DEVELOPER_LOGGING.xml","link":{"href":"http:\/\/localhost:8080\/geoserver\/rest\/resource\/logs\/GEOTOOLS_DEVELOPER_LOGGING.xml","rel":"alternate","type":"application\/octet-stream"}},{"name":"PRODUCTION_LOGGING.xml","link":{"href":"http:\/\/localhost:8080\/geoserver\/rest\/resource\/logs\/PRODUCTION_LOGGING.xml","rel":"alternate","type":"application\/octet-stream"}},{"name":"QUIET_LOGGING.xml","link":{"href":"http:\/\/localhost:8080\/geoserver\/rest\/resource\/logs\/QUIET_LOGGING.xml","rel":"alternate","type":"application\/octet-stream"}},{"name":"TEST_LOGGING.xml","link":{"href":"http:\/\/localhost:8080\/geoserver\/rest\/resource\/logs\/TEST_LOGGING.xml","rel":"alternate","type":"application\/octet-stream"}},{"name":"VERBOSE_LOGGING.xml","link":{"href":"http:\/\/localhost:8080\/geoserver\/rest\/resource\/logs\/VERBOSE_LOGGING.xml","rel":"alternate","type":"application\/octet-stream"}}]}}}
  127. ```
  128. With `operation=metadata`, a "ResourceMetadata" object is returned. If the resource is a directory, this metadata object will not list the children of the directory.
  129. Examples:
  130. - `http://localhost:8080/geoserver/rest/resource/styles/default_point.sld?operation=metadata&format=xml`
  131. ```
  132. <ResourceMetadata>
  133. <name>default_point.sld</name>
  134. <parent>
  135. <path>/styles</path>
  136. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://localhost:8080/geoserver/rest/resource/styles" rel="alternate" type="application/xml"/>
  137. </parent>
  138. <lastModified>2017-01-18 19:02:38.0 UTC</lastModified>
  139. <type>resource</type>
  140. </ResourceMetadata>
  141. ```
  142. - `http://localhost:8080/geoserver/rest/resource/styles/default_point.sld?operation=metadata&format=json`
  143. ```
  144. {"ResourceMetadata":{"name":"default_point.sld","parent":{"path":"\/styles","link":{"href":"http:\/\/localhost:8080\/geoserver\/rest\/resource\/styles","rel":"alternate","type":"application\/json"}},"lastModified":"2017-01-18 19:02:38.0 UTC","type":"resource"}}
  145. ```
  146. produces:
  147. - application/xml
  148. - application/json
  149. - text/plain
  150. - "*/*"
  151. parameters:
  152. - name: operation
  153. in: query
  154. type: string
  155. description: The type of GET operation. `default` returns a list of the contained resources in the case of a directory resource, or the actual resource contents in the case of a resource resource.`metadata` requests a metadata summary of the resource.
  156. required: false
  157. default: default
  158. enum:
  159. - default
  160. - metadata
  161. - name: format
  162. in: query
  163. type: string
  164. description: The format of the response. Only applicable for the `metadata` operation, or for a directory resource.
  165. required: false
  166. default: html
  167. enum:
  168. - html
  169. - xml
  170. - json
  171. responses:
  172. 200:
  173. description: OK
  174. headers:
  175. Last-Modified:
  176. type: string
  177. description: When resource was last modified.
  178. Content-Type:
  179. type: string
  180. description: Will guess mime-type from extension or content.
  181. Resource-Type:
  182. type: string
  183. description: Resource type (custom)
  184. enum:
  185. - directory
  186. - resource
  187. Resource-Parent:
  188. type: string
  189. description: Path to parent (custom)
  190. 404:
  191. description: Resource not found.
  192. head:
  193. operationId: resourceHead
  194. tags:
  195. - "Resource"
  196. description: Show resource metadata in HTTP headers.
  197. responses:
  198. 200:
  199. description: OK
  200. headers:
  201. Last-Modified:
  202. type: string
  203. description: When resource was last modified.
  204. Content-Type:
  205. type: string
  206. description: Will guess mime-type from extension or content.
  207. Resource-Type:
  208. type: string
  209. description: Resource type (custom)
  210. enum:
  211. - directory
  212. - resource
  213. Resource-Parent:
  214. type: string
  215. description: Path to parent (custom)
  216. 404:
  217. description: Resource not found.
  218. post:
  219. operationId: resourcePost
  220. tags:
  221. - "Resource"
  222. description: Invalid. Use PUT to create a resource.
  223. responses:
  224. 405:
  225. description: Method not allowed.
  226. put:
  227. operationId: resourcePut
  228. tags:
  229. - "Resource"
  230. description: Upload/move/copy a resource, create directories on the fly (overwrite if exists). For move/copy operations, place source path in body. Copying is not supported for directories.
  231. parameters:
  232. - name: operation
  233. in: query
  234. type: string
  235. description: The type of PUT operation. `default` creates a new resource or alters an existing resource. `move` moves the resource to a new location. `copy` duplicates the resource to a new location
  236. required: false
  237. default: default
  238. enum:
  239. - default
  240. - move
  241. - copy
  242. - name: resourceBody
  243. in: body
  244. description: The content of the resource to upload. In the case of a `move` or `copy` operation, this is instead the path to the source resource to move/copy from.
  245. schema:
  246. type: string
  247. format: binary
  248. consumes:
  249. - "*/*"
  250. responses:
  251. 200:
  252. description: OK (existing resource)
  253. 201:
  254. description: Created (new resource)
  255. 404:
  256. description: Source path that doesn't exist
  257. 405:
  258. description: PUT to directory or copy where source path is directory
  259. delete:
  260. operationId: resourceDelete
  261. tags:
  262. - "Resource"
  263. description: Delete a resource (recursively if directory)
  264. responses:
  265. 200:
  266. description: OK
  267. 404:
  268. description: Resource not found.
  269. definitions:
  270. ResourceMetadata:
  271. type: object
  272. description: Metadata about a resource
  273. properties:
  274. name:
  275. type: string
  276. description: The name of the resource, including the extension if applicable.
  277. parent:
  278. type: object
  279. description: The parent resource of this one
  280. properties:
  281. path:
  282. type: string
  283. description: The full path to the parent resource
  284. link:
  285. type: object
  286. description: A link to the parent resource
  287. properties:
  288. href:
  289. type: string
  290. description: The link to the resource
  291. rel:
  292. type: string
  293. description: Relationship between the current resource and the linked resource
  294. enum:
  295. - alternate
  296. type:
  297. type: string
  298. description: The mime type returned by the link
  299. lastModified:
  300. type: string
  301. description: The last modified date of the resource
  302. type:
  303. type: string
  304. description: Type of resource.
  305. enum:
  306. - resource
  307. - directory
  308. ResourceDirectory:
  309. type: object
  310. description: Metadata about a directory of resources
  311. allOf:
  312. - $ref: "#/definitions/ResourceMetadata"
  313. - properties:
  314. children:
  315. type: object
  316. description: List of child resources in the directory
  317. properties:
  318. child:
  319. type: array
  320. items:
  321. type: object
  322. description: A child resource
  323. properties:
  324. name:
  325. type: string
  326. description: The name of the resource, including the extension if applicable.
  327. link:
  328. type: object
  329. description: A link to the child resource
  330. properties:
  331. href:
  332. type: string
  333. description: The link to the resource
  334. rel:
  335. type: string
  336. description: Relationship between the current resource and the linked resource
  337. enum:
  338. - alternate
  339. type:
  340. type: string
  341. description: The mime type returned by the link