5

We are in the process of creating a monitoring plugin which will make restful calls to MarkLogic to retrieve status information. One of the first things we need to know is which version of MarkLogic we are connnecting to so that we know whether to user v1 or v2 of the rest api.

Is there a way to retrieve that information first?

2 Answers2

3

There is version information in the host-status output. You would first need to list all the hosts with /manage/LATEST/hosts and select one to query, for example /manage/LATEST/hosts/localhost?view=status. Then look under status-properties and version.

mblakele
  • 7,782
  • 27
  • 45
2

There's no built-in endpoint in ML's REST API to directly query the value of xdmp:version; however, if you make a call to a v1 endpoint on a newer version of ML with v2 endpoints, it will throw a MANAGE-UNSUPPORTEDVERSION exception. So one approach may be to catch that exception in your plugin, and then retry using the v2 endpoint.

Alternatively, you could create a very simple endpoint to return the value of xdmp:version. If you wanted that to be part of ML's REST API system and URL scheme, you could write a resource service extension:

http://docs.marklogic.com/guide/rest-dev/extensions

wst
  • 11,681
  • 1
  • 24
  • 39