Skip to content

Instantly share code, notes, and snippets.

@ableasdale
Created August 23, 2017 13:37
Show Gist options
  • Save ableasdale/84336fe0a26f39cd75ef1d92afe872af to your computer and use it in GitHub Desktop.
Save ableasdale/84336fe0a26f39cd75ef1d92afe872af to your computer and use it in GitHub Desktop.
MarkLogic - ReST and XQuery: perform a database backup
xquery version "1.0-ml";
declare variable $payload-status := '{"operation": "backup-database", "forest": ["Documents"], "backup-dir": "/tmp" }';
xdmp:http-post("http://localhost:8002/manage/v2/databases/Documents?format=json",
<options xmlns="xdmp:http">
<authentication method="digest">
<username>admin</username>
<password>admin</password>
</authentication>
<data>{$payload-status}</data>
<headers>
<content-type>application/json</content-type>
<accept>application/json</accept>
</headers>
</options>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment