How to pass collection_fields from api request to @query_method decorator? #89

Closed
catogonzalez opened this Issue Jan 26, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@catogonzalez

I am trying to implement my API so that the client can pass a '?fields=' url parameter in the api request and then I can instruct the query to build the response and return only the requested collection_fileds.

However, I don't know how to pass url parameters to the @query_method decorator; here's my code:

@Contact.query_method(query_fields=('limit', 'order', 'pageToken'),
                      collection_fields=('name', 'birthday'),
                      path='contacts',
                      name='contacts.list')
def contacts_list(self, query):
    return query

How can I pass the fields param from the request to the collection_fields= named param in the decorator?

@dhermes

This comment has been minimized.

Show comment
Hide comment
@dhermes

dhermes Jan 26, 2014

Member

Can you ask this on StackOverflow and post a link to the question?

Member

dhermes commented Jan 26, 2014

Can you ask this on StackOverflow and post a link to the question?

@dhermes dhermes closed this Jan 26, 2014

@dhermes

This comment has been minimized.

Show comment
Hide comment
@dhermes

dhermes Jan 27, 2014

Member

@catogonzalez Answered. Thanks for moving the questions. I meant to make a bug about this long ago since having fields would allow you to use projection queries and have faster response times and cheaper queries (since you would be using less data, etc.)

Member

dhermes commented Jan 27, 2014

@catogonzalez Answered. Thanks for moving the questions. I meant to make a bug about this long ago since having fields would allow you to use projection queries and have faster response times and cheaper queries (since you would be using less data, etc.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment