rest-adminrule.rst 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. .. _rest_api_geofence_server_adminrule:
  2. AdminRules 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 an AdminRule in XML::
  13. <AdminRule>
  14. <id>..</id>
  15. <priority>..</priority>
  16. <userName>..</userName>
  17. <roleName>..</roleName>
  18. <addressRange>..</addressRange>
  19. <workspace>..</workspace>
  20. <access>..</access>
  21. </AdminRule>
  22. Encoding of a rule in JSON::
  23. {"id":..,"priority":..,"userName":"..","roleName":"..","addressRange":"..","workspace":"..","access":".."}
  24. 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
  25. (the latter two may be used for updates to distinguish from "do not change this field").
  26. ``access`` should be either ``ADMIN`` or ``USER``.
  27. ``addressRange`` is a string in CIDR notation (block/bits: e.g. ``127.0.0.1/32``).
  28. Encoding of a list of rules in XML::
  29. <AdminRules count="n">
  30. <AdminRule> ... </AdminRule>
  31. <AdminRule> ... </AdminRule>
  32. ...
  33. </AdminRules>
  34. The result of a count would not include the actual <AdminRule> tags.
  35. Encoding of a list of rules in JSON::
  36. {"count":n,"adminrules":[{..},{..},..]}
  37. Filter Parameters
  38. ~~~~~~~~~~~~~~~~~
  39. All filter parameters are optional.
  40. .. list-table::
  41. :header-rows: 1
  42. :widths: 15 10 70
  43. * - Name
  44. - Type
  45. - Description
  46. * - page
  47. - number
  48. - 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.
  49. * - entries
  50. - number
  51. - 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.
  52. * - userName
  53. - string
  54. - Filter rules on username (excludes all other specified usernames).
  55. * - userAny
  56. - 0 or 1.
  57. - Specify whether rules matching any username should be included or not.
  58. * - roleName
  59. - string
  60. - Filter rules on rolename (excludes all other specified rolenames).
  61. * - roleAny
  62. - 0 or 1.
  63. - Specify whether rules matching any rolename should be included or not.
  64. * - workspace
  65. - string
  66. - Filter rules on workspace (excludes all other specified workspaces).
  67. * - workspaceAny
  68. - 0 or 1.
  69. - Specify whether rules matching any workspace should be included or not.
  70. Requests
  71. --------
  72. ``/geofence/rest/adminrules/``
  73. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  74. Query all adminrules or add a new adminrule.
  75. .. list-table::
  76. :header-rows: 1
  77. :widths: 10 20 20 20
  78. * - Method
  79. - Action
  80. - Supported parameters
  81. - Response
  82. * - GET
  83. - List all adminrules, with respect to any added filters
  84. - page, entries, userName, userAny, roleName, roleAny, workspace, workspaceAny
  85. - 200 OK. List of adminrules in XML.
  86. * - POST
  87. - Add a new adminrule
  88. - None
  89. - 201 Inserted. Created ``ID`` header.
  90. ``/geofence/rest/adminrules/count``
  91. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  92. Counts (filtered) adminrules.
  93. .. list-table::
  94. :header-rows: 1
  95. :widths: 10 20 20 20
  96. * - Method
  97. - Action
  98. - Supported parameters
  99. - Response
  100. * - GET
  101. - Count all adminrules, with respect to any added filters
  102. - userName, userAny, roleName, roleAny, workspace, workspaceAny
  103. - 200 OK. Rule list count in XML.
  104. ``/geofence/rest/adminrules/id/<id>``
  105. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  106. Query, modify or delete a specific adminrule.
  107. .. list-table::
  108. :header-rows: 1
  109. :widths: 10 20 20 20
  110. * - Method
  111. - Action
  112. - Supported parameters
  113. - Response
  114. * - GET
  115. - Read adminrule information
  116. - None
  117. - 200 OK. AdminRule in XML.
  118. * - POST
  119. - Modify the adminrule, unspecified fields remain unchanged.
  120. - None
  121. - 200 OK.
  122. * - DELETE
  123. - Delete the adminrule
  124. - None
  125. - 200 OK.