Google Cloud Endpoints: How to parse array-style GET query string?

228 views Asked by At

I am building a Google Cloud Endpoints API which receives the following query string via GET:

?count=10&page=1&sorting[title_column]=desc

Unfortunately when creating a resource container there is no dictionary data type in the Message.messages class. I cannot access either the key or value of the 'sorting' dictionary in the GET query string. This resource container does not work:

REQUEST_RESOURCE_CONTAINER = endpoints.ResourceContainer(
    message_types.VoidMessage,
    count=messages.IntegerField(2),
    page=messages.IntegerField(3),
    sorting=messages.StringField(4)
)

Are there any suggestions? I can't change the way the client program accesses this API and I really wanted to implement this using Google Cloud Endpoints.

0

There are 0 answers