Database Reference
In-Depth Information
_start=starting-position
When you pass a query by the
_query
parameter and the result is a sequence,
specifies at which position to start returning results from the sequence. The
default is
1
.
_wrap=yes | no
Indicates whether returned query results (and collection contents) should be
wrapped in an
exist:result
root element (the namespace prefix
exist
is bound
to the namespace
http://exist.sourceforge.net/NS/exist
). The default is
yes
for collection contents and queries passed in the
_query
parameter, and
no
otherwise.
_source=yes | no
Indicates whether the query should display its source code. You must explicitly
allow this by adding the name of the query file to
$EXIST_HOME/descriptor.xml
in the
allow-source
section (and then restart eXist for the changes to take
effect).
PUT Requests
HTTP
PUT
requests can be used to store or update documents in the database. The
remainder of the URI (the part after
/exist/rest
) is used as the target location of the
document.
As an example of how to do this, we will use eXist's own
httpclient
extension mod‐
ule to store an XML document into the database:
let
$
URI
:=
'http://localhost:8080/exist/rest/db/apps/exist-book/data/put-example.xml'
return
httpclient:put
(
xs:anyURI
(
$
URI
),
<new-file-by-rest-put/>
,
false
(),
())
Be aware that this is an example to show you how to use HTTP
PUT
. If you want to store a document into the database from your
own XQuery program, it is more efficient to avoid the HTTP over‐
head and use
xmldb:store
instead (see
“Creating Resources and
Collections” on page 109
).
DELETE Requests
An HTTP
DELETE
request does exactly what its name implies: it deletes the collection
or resource pointed to by the remainder of the URL (the part after
/exist/rest
) from
the database. The returned HTTP status code will indicate whether the deletion was
successful.
Search WWH ::
Custom Search