Reputation: 150
I have an API presented as follow. If the API is called with only one value in params (which is a repeated field), everything work as intended. But if params holds multiple values, then I get error : No endpoint found for path.
1 INPUT = endpoints.ResourceContainer(
2 params = messages.IntegerField(1, repeated = True, variant = messages.Variant.INT32))
3
4 @endpoints.method(INPUT,
5 response_type.CustomResponse,
6 path = 'foo/{params}',
7 http_method = 'POST',
8 name = 'foo')
9 def foo(self, request):
10 #foo body is irrelevent
11 return response
How can I fix this. Something like : path = 'foo/{params[]}', ?
Thank you for your help
Upvotes: 2
Views: 228
Reputation: 6005
If 'params' is expected as part of the query string and not the path, you can just omit it from the path eg:
path = 'foo'
or
path = 'myApi/foo'
The example given in the docs uses a ResourceContainer for a single non-repeated path argument. Given the nature of repeated properties it doesn't look like you can use them as path arguments, only query string arguments. A repeated field in a query string would look like this (easily to deal with):
POST http://app.appspot.com/_ah/api/myApi/v1/foo?param=bar¶m=baz ...
But a repeated field in a path argument would look like this (not so much):
POST http://app.appspot.com/_ah/api/myApi/v1/foo/bar/baz....
Upvotes: 1