def post(self): data = request.get_json() subject = data.get('subject') content = data.get('content') tags = data.get('tags', []) user = g.user if subject and content: new_post = Post(author=user.key, subject=subject, content=content) # store it in DB new_post.put() new_post.add_tags(tags) new_post_key = new_post.key return ( {'key': new_post_key.integer_id()}, 201, {'Location': api.url_for(UserBlogPostAPI, username=user.username, post_id=new_post_key.integer_id())}, ) else: return None, 400 # Bad Request