Search code examples
gradlemarklogicmarklogic-8

Marklogic Spring Boot - Installing a Rest Endpoint


I am currently using the Marklogic spring boot demo. So far I have been able to add indexes, facets, front-end logic etc just fine.

Right now, I am trying to layer in some semantic logic into a rest endpoint.

I wrote a simple query into the query console, and attempted to add it to the src/main/ext folder so that it would get deployed by the ml-gradle bootrun.

Right now. This file will get deployed to the test-modules database, and is visible once saved (I can see it in explorer under URI /ext/my-endpoint. I also tried adding a folder named rest-api but that just adds it to /ext/rest-api/my-endpoint

At the top of the endpoint I have it declared as `module namespace ext = "http://marklogic.com/rest-api/resource/my-endpoint";

However when I navigate to the URL it should be living at http://localhost:8090/LATEST/resources/my-endpoint?

It tells me it does not exist.

So I can see it in the modules database, but I can't use it on HTTP. the Query works in the query console (and is rather trivial, and-query of json-property-word-queries)

My question is:

How can I properly update the marklogic-spring-boot framework to properly deploy rest endpoints.


Solution

  • So I figured it out it seems.

    Manually creating the file isn't registering the distribution workflow properly.

    Instead I create the resource using ml-gradle

    gradle mlCreateResource -PresourceName=my_endpoint

    This will create a new folder called services, and create the endpoint for me, which can then have code over written.

    Still not sure what gradle is doing special, so I can know what the proper way to do this manually would be, but at least it works.