Loading TOC...

HEAD /v1/alert/rules/{name}


Test for the existence of a rule with the given name.

URL Parameters
database? Perform this operation on the named content database instead of the default content database associated with the REST API instance. Using an alternative database requires the "eval-in" privilege; for details, see Security Requirements in the REST Application Developer's Guide.


If a rule with the given name was previously installed using PUT /v1/alert/rules/{name}, MarkLogic Server returns status 200. If no such rule exists, status 404 is returned.

If the Alerting API is not enabled, MarkLogic Server returns status 403.

Required Privileges

This operation requires the rest-writer role, or the following privilege:


Usage Notes

For more information, see Alerting in the REST Application Developer's Guide.


$ curl --anyauth --user user:password -X HEAD -i \

==> If the rule exists, MarkLogic Server responds with status code 200.
    If the rule does not exist, MarkLogic Server responds with status 404.
    A unsuccessful test returns output similar to the following:

HTTP/1.1 404 Not Found
Content-type: application/xml
Server: MarkLogic
Content-Length: 365
Connection: Keep-Alive
Keep-Alive: timeout=5

<rapi:error xmlns:rapi="http://marklogic.com/rest-api">
  <rapi:status>Not Found</rapi:status>
  <rapi:message>RESTAPI-NODOCUMENT: (err:FOER0000) Resource or document 
   does not exist:  category: alert-rules message: Rule named 'example' 
   not found

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.