transforms.yaml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. ---
  2. swagger: '2.0'
  3. info:
  4. version: 1.0.0
  5. title: GeoServer XSLT transforms
  6. description: A transform contains a style sheet that can be used to generate a new textual output format of user choosing for WFS
  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. /services/wfs/transforms:
  15. get:
  16. operationId: getTransforms
  17. tags:
  18. - "Transforms"
  19. summary: List available transformations.
  20. description: Displays a list of all the transforms information available 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/TransformList"
  30. examples:
  31. application/xml: |
  32. <transforms>
  33. <transform>
  34. <name>test</name>
  35. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/restng/services/wfs/transforms/test.xml" type="application/atom+xml"/>
  36. </transform>
  37. <transform>
  38. <name>test1</name>
  39. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/restng/services/wfs/transforms/test1.xml" type="application/atom+xml"/>
  40. </transform>
  41. </transforms>
  42. application/json: |
  43. {
  44. "transforms": {
  45. "transform": [
  46. {
  47. "name": "test",
  48. "href": "http://localhost:8080/geoserver/restng/services/wfs/transforms/test.json"
  49. },
  50. {
  51. "name": "test1",
  52. "href": "http://localhost:8080/geoserver/restng/services/wfs/transforms/test1.json"
  53. }
  54. ]
  55. }
  56. }
  57. post:
  58. operationId: postTransform
  59. tags:
  60. - "Transforms"
  61. summary: Add a new transform
  62. description: Adds a new transform to the server. If the content type used is application/xml the server will assume a <transform> definition is being posted, and the XSLT will have to be uploaded separately using a PUT request with content type application/xslt+xml against the transformation resource. If the content type used is application/xslt+xml the server will assume the XSLT itself is being posted, and the name, sourceFormat, outputFormat, outputMimeType query parameters will be used to fill in the transform configuration instead.
  63. parameters:
  64. - name: transformBody
  65. description: Transform body to upload.
  66. in: body
  67. required: true
  68. schema:
  69. $ref: "#/definitions/Transform"
  70. - name: name
  71. in: query
  72. required: false
  73. description: Name of the transformation.
  74. type: string
  75. - name: sourceFormat
  76. in: query
  77. required: false
  78. description: Source format of the transformation.
  79. type: string
  80. - name: outputFormat
  81. in: query
  82. required: false
  83. description: Output format of the transformation.
  84. type: string
  85. - name: outputMimeType
  86. in: query
  87. required: false
  88. description: Output mime type of the transformation.
  89. type: string
  90. - name: fileExtension
  91. in: query
  92. required: false
  93. description: The extension of the file generated by the transformation.
  94. type: string
  95. consumes:
  96. - application/xml
  97. - application/xslt+xml
  98. - application/json
  99. - text/html
  100. responses:
  101. 201:
  102. description: Created
  103. put:
  104. operationId: putTransform
  105. tags:
  106. - "Transforms"
  107. description: Invalid. Use POST for adding a new transformation.
  108. responses:
  109. 405:
  110. description: Method Not Allowed
  111. delete:
  112. operationId: deleteTransform
  113. tags:
  114. - "Transforms"
  115. description: Invalid.
  116. responses:
  117. 405:
  118. description: Method Not Allowed
  119. /services/wfs/transforms/{transform}:
  120. get:
  121. operationId: getTransform
  122. tags:
  123. - "Transforms"
  124. summary: Retrieve a transformation.
  125. description: Retrieves a single transformation.
  126. produces:
  127. - application/xml
  128. - application/xslt+xml
  129. - application/json
  130. - text/html
  131. parameters:
  132. - name: transform
  133. in: path
  134. required: true
  135. description: Name of the transformation.
  136. type: string
  137. responses:
  138. 200:
  139. description: OK
  140. schema:
  141. $ref: "#/definitions/Transform"
  142. examples:
  143. application/xml: |
  144. <transform>
  145. <name>test1</name>
  146. <sourceFormat>text/xml; subtype=gml/2.1.2</sourceFormat>
  147. <outputFormat>text/html</outputFormat>
  148. <xslt>test1.xslt</xslt>
  149. </transform>
  150. application/json: |
  151. {
  152. "transform": {
  153. "name": "test1",
  154. "sourceFormat": "text/xml; subtype=gml/2.1.2",
  155. "outputFormat": "text/html",
  156. "xslt": "test1.xslt"
  157. }
  158. }
  159. application/xslt+xml: |
  160. <?xml version="1.0" encoding="ISO-8859-1"?>
  161. <xsl:stylesheet version="1.0" xmlns:wfs="http://www.opengis.net/wfs"
  162. xmlns:tiger="http://www.census.gov" xmlns:gml="http://www.opengis.net/gml"
  163. xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  164. <xsl:template match="/">
  165. <html>
  166. <body>
  167. <xsl:for-each select="wfs:FeatureCollection/gml:featureMember/*">
  168. <h2><xsl:value-of select="@fid"/></h2>
  169. <table border="1">
  170. <tr>
  171. <th>Attribute</th>
  172. <th>Value</th>
  173. </tr>
  174. <!-- [not(*)] strips away all nodes having
  175. children, in particular, geometries -->
  176. <xsl:for-each select="./*[not(*)]">
  177. <tr>
  178. <td>
  179. <xsl:value-of select="name()" />
  180. </td>
  181. <td>
  182. <xsl:value-of select="." />
  183. </td>
  184. </tr>
  185. </xsl:for-each>
  186. </table>
  187. </xsl:for-each>
  188. </body>
  189. </html>
  190. </xsl:template>
  191. </xsl:stylesheet>
  192. post:
  193. operationId: postTranform
  194. tags:
  195. - "Transforms"
  196. description: Invalid.
  197. responses:
  198. 405:
  199. description: Method Not Allowed
  200. put:
  201. operationId: putTranform
  202. tags:
  203. - "Transforms"
  204. summary: Modify a single transform
  205. description: Modifies a single transform.
  206. parameters:
  207. - name: transformBody
  208. description: Transform body to upload.
  209. in: body
  210. required: true
  211. schema:
  212. $ref: "#/definitions/Transform"
  213. - name: transform
  214. in: path
  215. required: true
  216. description: Name of the transformation.
  217. type: string
  218. consumes:
  219. - application/xml
  220. - application/json
  221. - application/xslt+xml
  222. responses:
  223. 200:
  224. description: OK
  225. 401:
  226. description: Unauthorized
  227. delete:
  228. operationId: deleteTranform
  229. tags:
  230. - "Transforms"
  231. summary: Delete transformation
  232. description: Deletes a transformation.
  233. parameters:
  234. - name: transform
  235. in: path
  236. required: true
  237. description: Name of the transformation.
  238. type: string
  239. responses:
  240. 200:
  241. description: OK
  242. 401:
  243. description: Unauthorized
  244. definitions:
  245. TransformList:
  246. title: transforms
  247. type: array
  248. items:
  249. $ref: '#/definitions/TransformListItem'
  250. TransformListItem:
  251. title: transform
  252. type: object
  253. properties:
  254. name:
  255. type: string
  256. description: Name of the transformation
  257. href:
  258. type: string
  259. description: URL to the transformation
  260. Transform:
  261. title: transform
  262. xml:
  263. name: transform
  264. type: object
  265. properties:
  266. name:
  267. type: string
  268. description: Name of the transformation
  269. sourceFormat:
  270. type: string
  271. description: Source format accepted by the transformation
  272. outputFormat:
  273. type: string
  274. description: Output format produced by the transformation
  275. xslt:
  276. type: string
  277. description: Style sheet associated with the transformation