flexrep:create-appserver( $cfg as element(configuration), $group as xs:unsignedLong, $name as xs:string, $port as xs:unsignedLong, $db as xs:unsignedLong ) as element(configuration)
This function creates a flexrep App Server programatically, without needing to know all of the specific settings.
xquery version "1.0-ml"; import module namespace flexrep = "http://marklogic.com/xdmp/flexible-replication" at "/MarkLogic/flexrep.xqy"; let $cfg := admin:get-configuration() return admin:save-configuration( flexrep:create-appserver( $cfg, xdmp:group("Default"), "FlexRep-foo", 9000, xdmp:database("foo")))