Database Reference
In-Depth Information
You can use cURL to make a
GET
request to eXist, by specifying
-X GET
to the
curl
command and then the URI. For example, the following cURL command would
return a listing of the
/db/apps
collection in the database, as shown in
Figure 13-16
:
curl -X GET http://localhost:8080/exist/rest/db/apps
Figure 13-16. Browsing the REST Server API with cURL
The default HTTP request method in cURL is
GET
, so you can
actually omit the
-X GET
parameter for conciseness if you wish.
Just as with retrieving a collection, you can retrieve the content of a resource in the
database by appending its name to the collection in the request URI. For example, the
following cURL command retrieves the resource
some-document.xml
from the collec‐
tion
/db
:
curl http://localhost:8080/exist/rest/db/some-document.xml
If you wish to redirect the output from cURL to a file, you can use
the
-o
argument (e.g.,
-o myfile.xml
). Also, if you wish to see the
HTTP request and response details as well as the content of the
response, you may also provide the
-v
argument to cURL for ver‐
bose output.
Search WWH ::
Custom Search