Last active
July 4, 2016 11:28
-
-
Save topless/b7a4e3d8d9b4b9aa7de67915022b61ee to your computer and use it in GitHub Desktop.
gae-init rest api arguments as query params.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Parsing request arguments and passing them to our db query with validation ;) | |
@api_v1.resource('/foo/', endpoint='api.foo.list') | |
class FooListAPI(restful.Resource): | |
def get(self): | |
args = parser.parse({ | |
'name': wf.Str(missing=None), | |
'limit': wf.Int(missing=config.DEFAULT_DB_LIMIT), | |
'order': wf.Str(missing='-created') | |
}) | |
foo_dbs, cursor = model.Foo.get_dbs(**args) | |
return helpers.make_response(foo_dbs, model.Foo.FIELDS, cursor) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment