Skip to content

Instantly share code, notes, and snippets.

@ableasdale
Created November 23, 2017 09:45
Show Gist options
  • Save ableasdale/0650a8299dd07f6d3a85d0cb42c292cc to your computer and use it in GitHub Desktop.
Save ableasdale/0650a8299dd07f6d3a85d0cb42c292cc to your computer and use it in GitHub Desktop.
MarkLogic: Get all HTTP Servers for the Default Group
xquery version "1.0-ml";
(: Note this will only work with Application Servers within the default group - change "Default" on line 8 for other groups if you need to :)
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy";
declare namespace grp = "http://marklogic.com/xdmp/group";
declare variable $config as element(configuration) := admin:get-configuration();
declare variable $group-id as xs:unsignedLong := admin:group-get-id($config, "Default");
declare variable $admin-app-server := admin:appserver-get-id($config, $group-id, "Admin");
declare variable $allinfo := admin:appserver-copy($config, $admin-app-server, $group-id, "XXXXXXXXXXXXXXX", 65534);
for $i in $allinfo//grp:http-servers/*
where fn:not($i//grp:http-server-name eq "XXXXXXXXXXXXXXX")
order by $i//grp:http-server-name
return $i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment