Hi,
I tried via POST as commands. Can somebody please provide me a working
example ?
There is no dedicated command for duplicating resources in a single database, but you can use XQuery (with the available COPY command, the full database is duplicated). The following command script presents one way to do it:
<commands> <create-db name='test'/> <add path='source.xml'><xml/></add> <xquery> db:add('test', db:get('test', 'source.xml'), 'target.xml') </xquery> <xquery>.</xquery> </commands>
Two more questions in that context. What is the recommended header
Content-Type xml or text/plain?
It may depend on the… context ;·) Feel free to give us more information on your use case.
Does it make sense rto use the http://basex_rest_url/?command url or
just the REST URL?
The 'command' query parameter is sufficient for simple requests, but you might encounter limits when supplying more data. Next, it should not be used to set passwords, as GET requests will end up in the database logs (unless this is prevented by setting specific options).
Hope this helps, Christian