resources.rst 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. .. _rest_api_resources:
  2. Resources
  3. =========
  4. ``/resource</path/to/resource>``
  5. ---------------------------------
  6. .. list-table::
  7. :widths: 10 30 10 20
  8. :header-rows: 1
  9. * - Method
  10. - Action
  11. - Status code
  12. - Parameters
  13. * - GET
  14. - Download a resource, list contents of directory, or show formatted resource metadata.
  15. - 200
  16. - operation (default | metadata); format (html | xml | json)
  17. * - HEAD
  18. - Show resource metadata in HTTP headers.
  19. - 200
  20. -
  21. * - PUT
  22. - Upload/move/copy a resource, create directories on the fly (overwrite if exists). For move/copy operations, place source path in body.
  23. Copying is not supported for directories.
  24. - 200 (exists) 201 (new)
  25. - operation (default | copy | move)
  26. * - DELETE
  27. - Delete a resource (recursively if directory)
  28. - 200
  29. -
  30. Exceptions
  31. ~~~~~~~~~~
  32. .. list-table::
  33. :header-rows: 1
  34. * - Exception
  35. - Status code
  36. * - GET or DELETE for a resource that does not exist
  37. - 404
  38. * - PUT to directory
  39. - 405
  40. * - PUT method=copy with source directory
  41. - 405
  42. * - PUT with source path that doesn't exist
  43. - 404
  44. * - POST
  45. - 405
  46. Headers
  47. ~~~~~~~
  48. .. list-table::
  49. :header-rows: 1
  50. * - Header
  51. - Description
  52. * - Last-Modified
  53. - When resource was last modified.
  54. * - Content-Type
  55. - Will guess mime-type from extension or content.
  56. * - Resource-Type (custom)
  57. - directory | resource
  58. * - Resource-Parent (custom)
  59. - Path to parent
  60. Format
  61. ~~~~~~
  62. Examples are given in XML. The JSON and HTML formats are analogue.
  63. Metadata
  64. ^^^^^^^^
  65. .. code-block:: xml
  66. <ResourceMetaData>
  67. <name> nameOfFile </name>
  68. <parent> <path> path/to/parent </path>
  69. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate"
  70. href="http://localhost:8080/geoserver/rest/resource/path/to/parent?operation=metadata&format=xml"
  71. type="application/xml"/>
  72. </parent>
  73. <lastModified> date </lastModified>
  74. <type> undefined | resource | directory </type>
  75. </ResourceMetaData>
  76. Directories
  77. ^^^^^^^^^^^
  78. .. code-block:: xml
  79. <ResourceDirectory>`
  80. <name> nameOfDirectory </name>
  81. <parent> <path> path/to/parent </path>
  82. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate"
  83. href="http://localhost:8080/geoserver/rest/resource/path/to/parent?operation=metadata&format=xml"
  84. type="application/xml"/>
  85. </parent>
  86. <lastModified> date </lastModified>
  87. <children>
  88. <child>
  89. <name> ... </name>
  90. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate"
  91. href="http://localhost:8080/geoserver/rest/resource/path/to/child"/>
  92. </child>
  93. <child>
  94. ...
  95. </child>
  96. ...
  97. </children>`
  98. </ResourceDirectory>