The Packaging API is a REST-based API that allows you to export and import MarkLogic Server App Server and database configurations.
group-name/server-name
appserver=Default/App-Services
database=Documents
http:/localhost:8002/manage/v1/list/package?database=App-Services&appserver=Default/Manage (: Returns configuration information for the App-Services database and Manage App Server. :)
xquery version "1.0-ml"; let $package := xdmp:http-get("http://host1:8002/manage/v1/list/package?database=Documents", <options xmlns="xdmp:http"> <authentication method="digest"> <username>admin</username> <password>admin</password> </authentication> </options>)[2] return xdmp:http-post("http://host2:8002/manage/v1/package/compare/", <options xmlns="xdmp:http"> <authentication method="digest "> <username>admin</username> <password>admin</password> </authentication> <data>{xdmp:quote($package)}</data> <headers> <content-type>text/xml</content-type> </headers> </options>) (: Imports and compares a configuration of the Documents database on host1 to the Documents database on host2. :)
xquery version "1.0-ml"; let $package := xdmp:http-get("http://host1:8002/manage/v1/list/package?database=Documents", <options xmlns="xdmp:http"> <authentication method="digest"> <username>admin</username> <password>admin</password> </authentication> </options>)[2] return xdmp:http-post("http://host2:8002/manage/v1/package/install/", <options xmlns="xdmp:http"> <authentication method="digest "> <username>admin</username> <password>admin</password> </authentication> <data>{xdmp:quote($package)}</data> <headers> <content-type>text/xml</content-type> </headers> </options>) (: installs a configuration of the Documents database on host1 to the Documents database on host2. :)
/manage/v1/package/install
http:/localhost:8002/manage/v1/tickets/ticket/17972973415247483208/revert/ (: Reverts the configuration to that specified by the ticket. :)