Database Reference
In-Depth Information
Figure 13-17. Storing a document via the REST Server API with cURL
If you specify a collection that does not exist, eXist will automati‐
cally create the necessary collection hierarchy for you.
Once the document is stored, you can retrieve it by doing an HTTP GET on the
resource URI; for example:
curl http://localhost:8080/exist/rest/db/docs/personal/my-doc.xml
Likewise, if you wish to see it listed in its collection, you can retrieve the collection's
contents by doing an HTTP GET on the collection URI; for example:
curl http://localhost:8080/exist/rest/db/docs/personal
Deleting collections and documents
You may delete collections and documents in eXist via the REST Server API, by sub‐
mitting DELETE requests whose URIs indicate the collections or documents you wish
to remove. If the parent collection of the document or collection you are DELETE ing
does not allow execute and write access by other users, then you will also need to pro‐
vide a username and password for an account that does have execute and write
access.
For example, the following cURL command will delete the XML document my-
doc.xml from the collection /db/docs/personal :
curl -i -X DELETE
http://aretter:12345@localhost:8080/exist/rest/db/docs/personal/my-doc.xml
Its parameters are explained in Table 13-3 and its output illustrated in Figure 13-18 .
 
Search WWH ::




Custom Search