I'm reading about using custom methods for APIs and would like to implement it in an API I'm working on. The endpoint in question is something like myapi/v1/myresource/{resourceId}:myCustomMethod
But this seems to be invalid:
[INFO] GCLOUD: java.lang.IllegalArgumentException: 'myapi/v1/myresource/{resourceId}:myCustomMethod' contains invalid parameter syntax: {resourceId}:myCustomMethod
[INFO] GCLOUD: at com.google.api.server.spi.dispatcher.PathTrie$Builder.add(PathTrie.java:196)
[INFO] GCLOUD: at com.google.api.server.spi.dispatcher.PathTrie$Builder.add(PathTrie.java:203)
[INFO] GCLOUD: at com.google.api.server.spi.dispatcher.PathTrie$Builder.add(PathTrie.java:193)
[INFO] GCLOUD: at com.google.api.server.spi.dispatcher.PathTrie$Builder.add(PathTrie.java:203)
[INFO] GCLOUD: at com.google.api.server.spi.dispatcher.PathTrie$Builder.add(PathTrie.java:203)
[INFO] GCLOUD: at com.google.api.server.spi.dispatcher.PathTrie$Builder.add(PathTrie.java:203)
[INFO] GCLOUD: at com.google.api.server.spi.dispatcher.PathTrie$Builder.add(PathTrie.java:177)
[INFO] GCLOUD: at com.google.api.server.spi.dispatcher.PathDispatcher$Builder.add(PathDispatcher.java:69)
[INFO] GCLOUD: at com.google.api.server.spi.EndpointsServlet.createDispatcher(EndpointsServlet.java:117)
[INFO] GCLOUD: at com.google.api.server.spi.EndpointsServlet.init(EndpointsServlet.java:58)
[INFO] GCLOUD: at com.google.inject.servlet.ServletDefinition.init(ServletDefinition.java:121)
[INFO] GCLOUD: at com.google.inject.servlet.ManagedServletPipeline.init(ManagedServletPipeline.java:82)
[INFO] GCLOUD: at com.google.inject.servlet.ManagedFilterPipeline.initPipeline(ManagedFilterPipeline.java:103)
[INFO] GCLOUD: at com.google.inject.servlet.GuiceFilter.init(GuiceFilter.java:220)
... etc
If I change the URI to myapi/v1/myresource/{resourceId}/something:myCustomMethod, the exception changes to:
[INFO] GCLOUD: java.lang.IllegalArgumentException: 'myapi/v1/myresource/{resourceId}/something:myCustomMethod' contains invalid path segment: results:propagationSummaries
[INFO] GCLOUD: at com.google.api.server.spi.dispatcher.PathTrie$Builder.add(PathTrie.java:201)
[INFO] GCLOUD: at com.google.api.server.spi.dispatcher.PathTrie$Builder.add(PathTrie.java:193)
[INFO] GCLOUD: at com.google.api.server.spi.dispatcher.PathTrie$Builder.add(PathTrie.java:203)
[INFO] GCLOUD: at com.google.api.server.spi.dispatcher.PathTrie$Builder.add(PathTrie.java:193)
[INFO] GCLOUD: at com.google.api.server.spi.dispatcher.PathTrie$Builder.add(PathTrie.java:203)
[INFO] GCLOUD: at com.google.api.server.spi.dispatcher.PathTrie$Builder.add(PathTrie.java:203)
[INFO] GCLOUD: at com.google.api.server.spi.dispatcher.PathTrie$Builder.add(PathTrie.java:203)
[INFO] GCLOUD: at com.google.api.server.spi.dispatcher.PathTrie$Builder.add(PathTrie.java:177)
[INFO] GCLOUD: at com.google.api.server.spi.dispatcher.PathDispatcher$Builder.add(PathDispatcher.java:69)
[INFO] GCLOUD: at com.google.api.server.spi.EndpointsServlet.createDispatcher(EndpointsServlet.java:117)
[INFO] GCLOUD: at com.google.api.server.spi.EndpointsServlet.init(EndpointsServlet.java:58)
What's the right way to use custom methods? Should I instead create the endpoint to be something like: myapi/v1/myresource/{resourceId}/myCustomMethod (with the / instead of :)?
I'm reading about using custom methods for APIs and would like to implement it in an API I'm working on. The endpoint in question is something like
myapi/v1/myresource/{resourceId}:myCustomMethod
But this seems to be invalid:
If I change the URI to
myapi/v1/myresource/{resourceId}/something:myCustomMethod
, the exception changes to:What's the right way to use custom methods? Should I instead create the endpoint to be something like:
myapi/v1/myresource/{resourceId}/myCustomMethod
(with the/
instead of:
)?