Your save-configuration call has to wrap the config returned in your flwor 
expression.  Something like:

admin:save-configuration(
  admin:appserver-delete($config,admin:appserver-get-id($config, $groupid, 
"secure2_app")) )

From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of cyanline llc
Sent: Monday, May 11, 2015 11:40 AM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] bulk delete & xquery syntax

Hi,
  Getting started with XQuery so that I can bulk delete a bunch of applications 
and associated files, but stuck on xquery syntax error. And, I'm also 
wondering, can I make this call and delete more than 1 app server 
simultaneously? As well as the app-server's associated DB, modules, and forests?

  This is the code I'm trying to run, and I found it in the link below:

  xquery version "1.0-ml";

  import module namespace admin = 
"http://marklogic.com/xdmp/admin";<http://marklogic.com/xdmp/admin>
          at "/MarkLogic/admin.xqy";

  let $config := admin:get-configuration()
  let $groupid := admin:group-get-id($config, "Default")
  return
  admin:appserver-delete($config,admin:appserver-get-id($config, $groupid, 
"secure2_app"))
  admin:save-configuration($config)

  (: returns the new configuration element -- use admin:save-configuration
     to save the changes to the configuration or pass the configuration
     to other Admin API functions to make other changes.  :)

- https://docs.marklogic.com/7.0/admin:appserver-delete

  and, the error:
[1.0-ml] XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, 
unexpected QName_, expecting $end or SemiColon_
Stack Trace
At line 10 column 2:

In xdmp:eval(" xquery version &quot;1.0-ml&quot;;&#10;&#10; import module 
na...", (), <options 
xmlns="xdmp:eval"><isolation>different-transaction</isolation><ignore-amps>true</i...</options>)
8. return
9. admin:appserver-delete($config,admin:appserver-get-id($config, $groupid, 
"secure2_app"))
10. admin:save-configuration($config)
_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to