rest.rst 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. .. _features_templating_rest:
  2. Features Templatring Rest API
  3. ==============================
  4. Introduction
  5. -------------
  6. The Features Templating Rest API allows performing CRUD operation over Features Templates and Template Layer Rules.
  7. Template Configuration
  8. -----------------------
  9. ``/rest/featurestemplates``
  10. Finds all templates in the global (``features-templating``) directory or creates a new template in the global directory.
  11. .. list-table::
  12. :header-rows: 1
  13. :widths: 5 20 20 20 10 10
  14. * - Method
  15. - Consumes
  16. - Produces
  17. - Action
  18. - Supported parameters
  19. - Response
  20. * - GET
  21. -
  22. - application/xml, application/json.
  23. - List of all the templates available in the ``features-templating`` directory.
  24. -
  25. - 200. List of rules in XML or JSON.
  26. * - POST
  27. - application/xml, text/xml, application/json, text/json, application/xhtml+xml, application/zip.
  28. - text/plain.
  29. - Add the template in the request body (text or zip file) as a new Template in the ``features-templating`` directory.
  30. - templateName (mandatory when posting a raw template, optional when posting a zip file)
  31. - 201. Created ``Location`` header.
  32. ``/rest/workspaces/<workspace name>/featurestemplates``
  33. Finds all templates in the ``workspace`` directory or creates a new template in the ``workspace`` directory.
  34. .. list-table::
  35. :header-rows: 1
  36. :widths: 5 20 20 20 10 10
  37. * - Method
  38. - Consumes
  39. - Produces
  40. - Action
  41. - Supported parameters
  42. - Response
  43. * - GET
  44. -
  45. - application/xml, application/json.
  46. - List of all the templates available in the ``workspace`` directory
  47. -
  48. - 200. List of rules in XML or JSON.
  49. * - POST
  50. - application/xml, text/xml, application/json, text/json, application/xhtml+xml, application/zip.
  51. - text/plain.
  52. - Add the template in the request body (text or zip file) as a new Template in the ``workspace`` directory.
  53. - templateName (mandatory when posting a raw template, optional when posting a zip file)
  54. - 201. Created ``Location`` header.
  55. ``/rest/workspaces/<workspace name>/featuretypes/<featureType name>/featurestemplates``
  56. Finds all templates in the ``featuretype`` directory or creates a new template in the ``featuretype`` directory.
  57. .. list-table::
  58. :header-rows: 1
  59. :widths: 5 20 20 20 10 10
  60. * - Method
  61. - Consumes
  62. - Produces
  63. - Action
  64. - Supported parameters
  65. - Response
  66. * - GET
  67. -
  68. - application/json, application/xml.
  69. - List of all the templates available in the ``featuretype`` directory
  70. -
  71. - 200. List of rules in XML or JSON.
  72. * - POST
  73. - application/xml, text/xml, application/json, text/json, application/xhtml+xml, application/zip.
  74. - text/plain.
  75. - Add the template in the request body (text or zip file) as a new Template in the ``Feature Type`` directory.
  76. - templateName (mandatory when posting a raw template, optional when posting a zip file)
  77. - 201. Created ``Location`` header.
  78. ``/rest/featurestemplates/<template name>``
  79. If the template with the specified name exists in the global (``features-templating``) directory, returns the template or replaces the template content with the one in the request body.
  80. .. list-table::
  81. :header-rows: 1
  82. :widths: 5 20 20 20 10
  83. * - Method
  84. - Consumes
  85. - Produces
  86. - Action
  87. - Response
  88. * - GET
  89. -
  90. - application/xml, application/json, application/xhtml+xml.
  91. - the template with the specified name if present in the ``features-templating`` directory.
  92. - 200. The template.
  93. * - PUT
  94. - application/xml, text/xml, application/json, text/json, application/xhtml+xml, application/zip.
  95. - text/plain.
  96. - replace the template, if found in the ``features-templating`` directory with the template in the request body (text or zip file).
  97. - 201.
  98. * - DELETE
  99. -
  100. -
  101. - delete the template, if found in the ``features-templating`` directory.
  102. - 204.
  103. ``/rest/workspaces/<workspace name>/featurestemplates/<template name>``
  104. If the template with the specified name exists in the ``workspace`` directory, returns the template or replaces the template content with the one in the request body.
  105. .. list-table::
  106. :header-rows: 1
  107. :widths: 5 20 20 20 10
  108. * - Method
  109. - Consumes
  110. - Produces
  111. - Action
  112. - Response
  113. * - GET
  114. -
  115. - application/xml, application/json, application/xhtml+xml.
  116. - the template with the specified name if present in the ``workspace`` directory.
  117. - 200. The template.
  118. * - PUT
  119. - application/xml, text/xml, application/json, text/json, application/xhtml+xml, application/zip.
  120. - text/plain.
  121. - replace the existing template, if found in the ``workspace`` directory with the template in the request body (text or zip file).
  122. - 201.
  123. * - DELETE
  124. -
  125. -
  126. - delete the template, if found in the ``workspace`` directory.
  127. - 204.
  128. ``/rest/workspaces/<workspace name>/featuretypes/<featureType name>``
  129. ``/featurestemplates/<template name>``
  130. If the template with the specified name exists in the ``featuretype`` directory, returns the template or replaces the template content with the one in the request body.
  131. .. list-table::
  132. :header-rows: 1
  133. :widths: 5 20 20 20 10
  134. * - Method
  135. - Consumes
  136. - Produces
  137. - Action
  138. - Response
  139. * - GET
  140. -
  141. - application/xml, application/json, application/xhtml+xml.
  142. - the template with the specified name if present in the ``featuretype`` directory.
  143. - 200. The template.
  144. * - PUT
  145. - application/xml, text/xml, application/json, text/json, application/xhtml+xml, application/zip.
  146. - text/plain.
  147. - replace the existing template, if found in the ``featuretype`` directory with the template in the request body (text or zip file).
  148. - 201.
  149. * - DELETE
  150. -
  151. -
  152. - delete the template, if found in the ``featuretype`` directory.
  153. - 204.
  154. Template Rule Configuration
  155. ----------------------------
  156. ``/rest/workspaces/<workspace name>/featuretypes/<featureType name>/templaterules``
  157. Finds all the configured template rules for the ``featuretype`` or creates a new one.
  158. .. list-table::
  159. :header-rows: 1
  160. :widths: 5 20 20 20 10
  161. * - Method
  162. - Consumes
  163. - Produces
  164. - Action
  165. - Response
  166. * - GET
  167. -
  168. - application/xml, application/json.
  169. - List of all the template rules available for the ``featuretype``.
  170. - 200. List of rules in XML or JSON.
  171. * - POST
  172. - application/xml, text/xml, application/json, text/json.
  173. - text/plain.
  174. - Add the template rule in the request body.
  175. - 201. Created ``Location`` header.
  176. ``/rest/workspaces/<workspace name>/featuretypes/<featureType name>``
  177. ``/templaterules/<rule identifier>``
  178. Finds, replaces, updates or deletes the template rule with the specified identifier.
  179. .. list-table::
  180. :header-rows: 1
  181. :widths: 5 20 20 20 10
  182. * - Method
  183. - Consumes
  184. - Produces
  185. - Action
  186. - Response
  187. * - GET
  188. -
  189. - application/xml, application/json.
  190. - The rule with the specified ``rule identifier``.
  191. - 200. List of rules in XML or JSON.
  192. * - PUT
  193. - application/xml, text/xml, application/json, text/json.
  194. - text/plain.
  195. - Replace the rule with the specified id with the one provided in the request body.
  196. - 201.
  197. * - PATCH
  198. - application/xml, text/xml, application/json, text/json.
  199. - text/plain.
  200. - Allows partial updates of the rule with the specified id using the fields specified in the rule provided in the request body. It uses a `JSON merge patch like strategy <https://datatracker.ietf.org/doc/html/rfc7386>`_
  201. - 201.
  202. * - DELETE
  203. -
  204. -
  205. - Delete the rule with the specified id.
  206. - 204.
  207. Data Object Transfer
  208. ~~~~~~~~~~~~~~~~~~~~
  209. Both XML and JSON are supported for transfer of data objects.
  210. Encoding of a template rule in XML::
  211. <Rule>
  212. <ruleId>..</ruleId>
  213. <priority>..</priority>
  214. <templateName>..</templateName>
  215. <outputFormat>..</outputFormat>
  216. <cqlFilter>..</cqlFilter>
  217. <profileFilter>...</profileFilter>
  218. </Rule>
  219. Encoding of a rule in JSON::
  220. {"Rule": {"ruleId":..,"priority":..,"templateName":"..","outputFormat":"..","cqlFilter":"..","profileFilter":".."}}
  221. When applying partial updates missing attributes/element in incoming object are left unchanged. Properties can be set to null. E.g. the following example will allow to set the profileFilter to null:
  222. XML::
  223. <Rule>
  224. <profileFilter xsi:nil="true"/>
  225. </Rule>
  226. JSON::
  227. {"Rule":{"profileFilter":null}}