Using Custom Methods in restCall()

I would like to take advantage of custom methods (as described here) However, Lagom or play uses : to denote a dynamic parameter.

My endpoint would ideally look like (I’ve denoted the dynamic parameter with {} instead):

PATCH /v1/status/{statusid}:updateStatusName

Right now, I’m just redefining it as:

PATCH /v1/status/{statusid}/statusName
since I can’t use a colon, which is fine.

But, I was wondering if there is a workaround.

Lagom does not currently support a literal colon in the URL path pattern. There is some discussion in this issue:

I suggested a workaround in the comments (encoding the colon as %3A on both the client and in the service descriptor). There are some caveats, though: if the client doesn’t encode it, and sends a literal : instead, Lagom doesn’t currently normalize this and it won’t work. I think it would be a good idea to add the normalization, and a pull request to do that would be greatly appreciated!

I didn’t test it, but if you’re using Lagom on both the client and server side, I’d expect it to work correctly.

1 Like