hi, My objective is to delete the collections/files through the DELETE request using HTTP module. The DELETE operation does fine, when I ran it from BasexGUI. But if i put the same query inside delete.xq and invoke it by http://localhost:8984/rest?run=delete.xq, The request never returns any response and possibly got hanged. I need to restart the database to make the database to function.
I am enclosing the xq i used,
import module namespace http='http://expath.org/ns/http-client';
declare function local:cleanlist() { ('sample/record1','sample/record2','sample/record3') };
declare function local:cleandb() { try { for $cl in local:cleanlist() return http:send-request(<http:request method="DELETE" href="http://localhost:8984/rest/%7B$cl%7D" status-only = "true" username = "admin" password = "admin" send-authorization="true"> </http:request>)
} catch err { err:description } };
<cleandb>{ local:cleandb() }</cleandb>