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.
The REST API unfortunately doesn't allow for what you want - see https://docs.marklogic.com/REST/PUT/v1/config/resources/[name] . You can specify a version as optional metadata on your extension, but that will not change the URL - it's still going to be "/v1/resources/my_endpoint".
You however can achieve this if you customize the default XML rewriter that MarkLogic uses for a REST API app server - see https://docs.marklogic.com/guide/app-dev/XMLrewriter .