layers.rst 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. .. _rest_layers:
  2. Layers
  3. ======
  4. The REST API allows you to list, create, upload, update, and delete layers in GeoServer.
  5. .. note:: Read the :api:`API reference for /layers <layers.yaml>`.
  6. Listing all layers
  7. ------------------
  8. **List all layers on the server, in JSON format:**
  9. *Request*
  10. .. admonition:: curl
  11. ::
  12. curl -u admin:geoserver -XGET http://localhost:8080/geoserver/rest/layers.json
  13. *Response*
  14. ::
  15. {
  16. "layers": {
  17. "layer": [
  18. {
  19. "name": "giant_polygon",
  20. "href": "http://localhost:8080/geoserver/rest/layers/giant_polygon.json"
  21. },
  22. {
  23. "name": "poi",
  24. "href": "http://localhost:8080/geoserver/rest/layers/poi.json"
  25. },
  26. ...
  27. ]
  28. }
  29. }
  30. **List all layers on the server, in XML format:**
  31. *Request*
  32. .. admonition:: curl
  33. ::
  34. curl -u admin:geoserver -XGET http://localhost:8080/geoserver/rest/layers.xml
  35. *Response*
  36. .. code-block:: xml
  37. <layers>
  38. <layer>
  39. <name>giant_polygon</name>
  40. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/layers/giant_polygon.xml" type="application/xml"/>
  41. </layer>
  42. <layer>
  43. <name>poi</name>
  44. <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/layers/poi.xml" type="application/xml"/>
  45. </layer>
  46. ...
  47. </layers>