rest.rst 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. .. _rest_api_geofence_server:
  2. GeoFence Rest API
  3. =================
  4. Security
  5. --------
  6. The Geofence Rest API is only accessible to users with the role ROLE_ADMIN.
  7. Input/Output
  8. ------------
  9. Data Object Transfer
  10. ~~~~~~~~~~~~~~~~~~~~
  11. Both XML and JSON are supported for transfer of data objects. The default is XML. Alternatively, JSON may be used by setting the 'content-type' (POST) and 'accept' (GET) http headers to 'application/json' in your requests.
  12. Encoding of a rule in XML::
  13. <Rule>
  14. <id>..</id>
  15. <priority>..</priority>
  16. <userName>..</userName>
  17. <roleName>..</roleName>
  18. <workspace>..</workspace>
  19. <layer>..</layer>
  20. <service>..</service>
  21. <request>..</request>
  22. <subfield>..</subfield>
  23. <access> ALLOW | DENY | LIMIT </access>
  24. <!-- for LIMIT access rules-->
  25. <limits>
  26. <allowedArea>..</allowedArea>
  27. <catalogMode> HIDE | CHALLENGE | MIXED </catalogMode>
  28. </limits>
  29. <!-- for ALLOW access rules with specified layer -->
  30. <layerDetails>
  31. <layerType> VECTOR | RASTER | LAYERGROUP </layerType>
  32. <defaultStyle>..</defaultStyle>
  33. <cqlFilterRead>..</cqlFilterRead>
  34. <cqlFilterWrite>..</cqlFilterWrite>
  35. <allowedArea>..</allowedArea>
  36. <catalogMode> HIDE | CHALLENGE | MIXED </catalogMode>
  37. <allowedStyle>..</allowedStyle>
  38. ..
  39. <attribute>
  40. <name>..</name>
  41. <datatype>..</datatype>
  42. <accessType> NONE | READONLY | READWRITE </accessType>
  43. </attribute>
  44. ..
  45. </layerDetails>
  46. </Rule>
  47. Encoding of a rule in JSON::
  48. {"Rule": {"id":..,"priority":..,"userName":"..","roleName":"..","workspace":"..","layer":"..","service":"..","request":"..","subfield":"..","access":".."}}
  49. In case a rule that has "any" ("*") for a particular field the field is either not included (default), left empty or specified with a single asterisk
  50. (the latter two may be used for updates to distinguish from "do not change this field").
  51. Encoding of a list of rules in XML::
  52. <Rules count="n">
  53. <Rule> ... </Rule>
  54. <Rule> ... </Rule>
  55. ...
  56. </Rules>
  57. The result of a count would not include the actual <Rule> tags.
  58. Encoding of a list of rules in JSON::
  59. {"count":n,"rules":[{..},{..},..]}
  60. Filter Parameters
  61. ~~~~~~~~~~~~~~~~~
  62. All filter parameters are optional.
  63. .. list-table::
  64. :header-rows: 1
  65. :widths: 15 10 70
  66. * - Name
  67. - Type
  68. - Description
  69. * - page
  70. - number
  71. - Used for paging a list of rules. Specifies the number of the page. Leave out for no paging. If specified, ``entries`` should also be specified.
  72. * - entries
  73. - number
  74. - Used for paging a list of rules. Specifies the number of entries per page. Leave out for no paging. If specified, ``page`` should also be specified.
  75. * - userName
  76. - string
  77. - Filter rules on username (excludes all other specified usernames).
  78. * - userAny
  79. - 0 or 1.
  80. - Specify whether rules for 'any' username are included or not.
  81. * - roleName
  82. - string
  83. - Filter rules on rolename (excludes all other specified rolenames).
  84. * - roleAny
  85. - 0 or 1.
  86. - Specify whether rules for 'any' rolename are included or not.
  87. * - service
  88. - string
  89. - Filter rules on service (excludes all other specified services).
  90. * - serviceAny
  91. - 0 or 1.
  92. - Specify whether rules for 'any' service are included or not.
  93. * - request
  94. - string
  95. - Filter rules on request (excludes all other specified requests).
  96. * - requestAny
  97. - 0 or 1.
  98. - Specify whether rules for 'any' request are included or not.
  99. * - workspace
  100. - string
  101. - Filter rules on workspace (excludes all other specified workspaces).
  102. * - workspaceAny
  103. - 0 or 1.
  104. - Specify whether rules for 'any' workspace are included or not.
  105. * - layer
  106. - string
  107. - Filter rules on layer (excludes all other specified layers).
  108. * - layerAny
  109. - 0 or 1.
  110. - Specify whether rules for 'any' layer are included or not.
  111. Requests
  112. --------
  113. ``/rest/geofence/rules/``
  114. ~~~~~~~~~~~~~~~~~~~~~~~~~
  115. Query all rules or add a new rule.
  116. .. list-table::
  117. :header-rows: 1
  118. :widths: 10 20 20 20
  119. * - Method
  120. - Action
  121. - Supported parameters
  122. - Response
  123. * - GET
  124. - List all rules, with respect to any added filters
  125. - page, entries, userName, userAny, roleName, roleAny, service, serviceAny, request, requestAny, workspace, workspaceAny, layer, layerAny
  126. - 200 OK. List of rules in XML.
  127. * - POST
  128. - Add a new rule
  129. - None
  130. - 201 Inserted. Created ``ID`` header.
  131. ``/rest/geofence/rules/count``
  132. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  133. Counts (filtered) rules.
  134. .. list-table::
  135. :header-rows: 1
  136. :widths: 10 20 20 20
  137. * - Method
  138. - Action
  139. - Supported parameters
  140. - Response
  141. * - GET
  142. - Count all rules, with respect to any added filters
  143. - userName, userAny, roleName, roleAny, service, serviceAny, request, requestAny, workspace, workspaceAny, layer, layerAny
  144. - 200 OK. Rule list count in XML.
  145. ``/rest/geofence/rules/id/<id>``
  146. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  147. Query, modify or delete a specific rule.
  148. .. list-table::
  149. :header-rows: 1
  150. :widths: 10 20 20 20
  151. * - Method
  152. - Action
  153. - Supported parameters
  154. - Response
  155. * - GET
  156. - Read rule information
  157. - None
  158. - 200 OK. Rule in XML.
  159. * - POST
  160. - Modify the rule, unspecified fields remain unchanged.
  161. - None
  162. - 200 OK.
  163. * - DELETE
  164. - Delete the rule
  165. - None
  166. - 200 OK.