Changes

Jump to navigation Jump to search
21 bytes removed ,  16:49, 18 July 2022
no edit summary
=URL Architecture=
The A request to the root URL lists returns all available databases. The following examples assume thatyou have created a database instance from the [https://files.basex.org/xml/factbook.xml factbook.xml] document:
:<code>http://localhost:8984/rest</code>
<syntaxhighlight lang="xml">
<databases resources="1" xmlns="http://basex.org/rest"> <database resources="125742" size="181359943813599">factbookarticles</database> ...
</databases>
</syntaxhighlight>
The resources of a database can be (directories, resource metadata) are listed by specifying the if a database, and potential sub directories, in the URL.In the given example, a single XML document an optional directory path is stored in the ''factbook'' databasespecified:
:<code>http://localhost:8984/rest/factbookarticles</code>
<syntaxhighlight lang="xml">
<database name="factbook" resources="1articles" xmlns:rest="http://basex.org/rest"> <dir>binaries</dir> <resource type="xml" content-type="application/xml" size="77192">factbook1973-02-08-xltp325.xml</resource> ...
</database>
</syntaxhighlight>
 
The {{Code|dir}} elements were introduced with {{Announce|Version 10}}. Before, information on all resources was listed that were located in the specified path or any of its subdirectories.
The contents of If the path to a database can be retrieved by directly addressing single resource is specified, the resourceitself will be returned: :<code>http://localhost:8984/rest/factbook/factbook.xml</code>
If a resource is not found, an HTTP response will be generated with :<code>404http://localhost:8984/rest/articles/1973-02-08-xltp325.xml</code> as status code.
==Parameters==
* Return the first five city names of the <b>factbook</b> database:
<syntaxhighlight lang="xml">
<rest:query xmlns:rest="http://basex.org/rest"> <rest:text><![CDATA[ (//city/name)[position() <= 5] ]]></rest:text></rest:query>
</syntaxhighlight>
;Version 10.0
* Updated: Results in the {{Code|rest}} namespace will be returned unprefixed.
* Updated: {{Code|dir}} elements are returned when listing the contents of a database.
;Version 9.0
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu