API expects queries to look like `foo?bar[baz]` instead of `foo?bar=baz`. Is this possible with @QueryParam?

95 Views Asked by At

Our team needs to consume a rest-ish API that expects path parameters in the form of

api/v1/foo?bar[baz]

instead of api/v1/foo?bar=baz or bar=[baz]

and

api/v1/foo?filter[baz][baz.id][id]=123

instead of .. I don't even know. They somehow map this to php arrays and the second example should return every Foo that has baz.id=123.

Now, if I use @QueryParam("bar") String bar, the result is foo?bar=[baz] (if bar.equals("[baz]") of course).

Is there any way I can influence how resty generates the query string? So far the only way to achieve this seems to be writing my own RestServiceClassCreator and replace the default one via deferred binding. Though even then I'm not sure if stuff like the second examples could be covered by this.

0

There are 0 best solutions below