usage.rst 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. Sample Usage
  2. ------------
  3. LDP API
  4. =======
  5. The following are very basic examples of LDP interaction. For a more complete
  6. reference, please consult the `Fedora API guide
  7. <https://wiki.duraspace.org/display/FEDORA4x/RESTful+HTTP+API+-+Containers>`__.
  8. **Note**: At the moment the LDP API only support the Turtle format for
  9. serializing and deserializing RDF.
  10. Create an empty LDP container (LDPC)
  11. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  12. ::
  13. curl -X POST http://localhost:8000/ldp
  14. Create a resource with RDF payload
  15. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  16. ::
  17. curl -X POST -H'Content-Type:text/turtle' --data-binary '<> <urn:ns:p1> <urn:ns:o1> .' http://localhost:8000/ldp
  18. Create a resource at a specific location
  19. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  20. ::
  21. curl -X PUT http://localhost:8000/ldp/res1
  22. Create a binary resource
  23. ~~~~~~~~~~~~~~~~~~~~~~~~
  24. ::
  25. curl -X PUT -H'Content-Type:image/png' --data-binary '@/home/me/image.png' http://localhost:8000/ldp/bin1
  26. Retrieve an RDF resource (LDP-RS)
  27. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  28. ::
  29. curl http://localhost:8000/ldp/res1
  30. Retrieve a non-RDF source (LDP-NR)
  31. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  32. ::
  33. curl http://localhost:8000/ldp/bin1
  34. Or::
  35. curl http://localhost:8000/ldp/bin1/fcr:content
  36. Or::
  37. curl -H'Accept:image/png' http://localhost:8000/ldp/bin1
  38. Retrieve RDF metadata of a LDP-NR
  39. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  40. ::
  41. curl http://localhost:8000/ldp/bin1/fcr:metadata
  42. Or::
  43. curl -H'Accept:text/turtle' http://localhost:8000/ldp/bin1
  44. Soft-delete a resource
  45. ~~~~~~~~~~~~~~~~~~~~~~~
  46. ::
  47. curl -X DELETE http://localhost:8000/ldp/bin1
  48. Restore ("resurrect") a resource
  49. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  50. ::
  51. curl -X POST http://localhost:8000/ldp/bin1/fcr:tombstone
  52. Permanently delete ("forget") a soft-deleted resource
  53. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  54. **Note**: the following command cannot be issued after the previous one. It has
  55. to be issued on a soft-deleted, non-resurrected resource.
  56. ::
  57. curl -X DELETE http://localhost:8000/ldp/bin1/fcr:tombstone
  58. Immediately forget a resource
  59. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  60. ::
  61. curl -X DELETE -H'Prefer:no-tombstone' http://localhost:8000/ldp/res1
  62. Python API
  63. ----------
  64. **TODO**