I'm extending the REST API in MarkLogic and managing my development and deployment using gradle. By default, my endpoint looks like this (note v1):
http://localhost:8005/v1/resources/my_endpoint
If I change my endpoint implementation, how do I expose the new version as v2 and keep the original (v1) for backward compatibility so that I have
http://localhost:8005/v2/resources/my_endpoint
using gradle? I don't see any way to annotate version in my gradle config files. I've been searching MarkLogic's gradle wiki and haven't found an answer there.
                        
I was able to meet requirement using a declarative rewriter as @rjrudin suggested.
I started by copying
<MarkLogic install dir>\Modules\MarkLogic\rest-api\rewriter.xmltoapi-rewriter.xml, modifying the new file, and updating my rest api serverUrl Rewritervalue (via Admin console).Then I added the following declarations:
I create resource implementations using
ml-gradlewith names that look like this:v2.0_ping.sjs. So now I can use urls like this:that resolve to