Questions tagged [flask-restless]

Flask-Restless provides simple generation of ReSTful APIs for database models defined using SQLAlchemy (or Flask-SQLAlchemy)

Flask-Restless provides simple generation of ReSTful APIs for database models defined using SQLAlchemy (or Flask-SQLAlchemy). The generated APIs send and receive messages in JSON format.

116 questions
1
vote
1 answer

How do I refer to a foreign key table twice?

I get the following error: u'detail': u"One or more mappers failed to initialize - can't proceed with initialization of other mappers. Original exception was: Could not determine join condition between parent/child tables on relationship…
user706838
  • 5,132
  • 14
  • 54
  • 78
1
vote
1 answer

Getting Method Not Allowed error when trying to build a RESTless API

I am learning Flask and I have found various snippets which show how to define models with SQLAlchemy, REST API with Flask-restless and forms with Flask-wtf (I'm not very familiar with REST API). More precisely I took inspiration…
Mathieu Dubois
  • 1,054
  • 3
  • 14
  • 22
1
vote
2 answers

Customizing GET method using Flask Restless

I am developing a REST API using Flask Restless. The following code is a sample to illustrate my problem: class User(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.Unicode) password =…
clemtoy
  • 1,681
  • 2
  • 18
  • 30
1
vote
1 answer

unable to trigger flask restless postprocessor

I'm using Flask-Restless 0.17.0 and having trouble getting a preprocessor or postprocessor function to fire. For reference, I have an SQLAlchemy model that look like: class Transaction(Base): id = Column(Integer, primary_key=True) name =…
dino
  • 3,093
  • 4
  • 31
  • 50
1
vote
3 answers

Simplest authentication with flask-restless

I am using Flask-Restless to make a super simple REST API. I would like to add authentication, but just for put/post/delete calls, while I want to leave get calls public. So far, I put in my views.py file this: manager =…
Michele
  • 553
  • 1
  • 5
  • 16
1
vote
2 answers

flask restless unable to construct query

I have two Flask-SQLAlchemy models and the respectives Flask-Restless API endpoints as following: class Person(db.Model): person_id = db.Column(db.Integer, primary_key=True) document = db.Column(db.String(), unique=True) name =…
Manuel Lopera
  • 2,268
  • 1
  • 16
  • 16
1
vote
1 answer

GAE app.yaml routing with Flask-Restless

I am developing an app with AngularJS frontend + GAE backend (Python and Flask). I am having troubles to setting app.yaml for routing my API endpoints created with Flask-Restless extention. My app.yaml file looks like this: application:…
Manuel Lopera
  • 2,268
  • 1
  • 16
  • 16
1
vote
2 answers

Flask-restless endpoints with user resolution and filtration

How would correctly should look API that returns only objects belonging to the user who asks for them? api/version/items/ or api/version/user//items/ In the first case, the server queried the database with a user id,…
Meph-
  • 657
  • 1
  • 8
  • 20
1
vote
1 answer

How to use the keyword arguments in Flask-RESTless

Me and a buddy have been reading through the docs for Flask-RESTless and it says: The arguments to the preprocessor and postprocessor functions will be provided as keyword arguments, so you should always add **kw as the final argument when defining…
jwanglof
  • 548
  • 1
  • 5
  • 20
1
vote
1 answer

how to add a child instance to the "many" end of one-to-many

I have two models in my flask / restless app: Blueprint and Workload The Blueprint should have a collection of Workloads. Here are the models: class Blueprint(db.Model): id = db.Column(db.Integer, primary_key=True) name =…
Eugene Goldberg
  • 14,286
  • 20
  • 94
  • 167
1
vote
1 answer

Is it possible to extend Flask-restless to add new routes?

I am currently developing a REST API using Flask, Flask-sqlalchemy and flask-restless. I have a User model and a Category model. A user can have many categories and a category belongs to only one user (one-to-many relationship). The relationship is…
user2483431
  • 783
  • 2
  • 7
  • 11
1
vote
1 answer

Flask Restless AttributeError: 'NoneType' object has no attribute '_sa_instance_state'

I am currently using Flask, Flask-SQLAlchemy & Flask-Restless to provide REST routes for a small private AngularJS application. Thus far, I have been able to make/use routes effectively that did not include any relationships. However, I have a…
1
vote
1 answer

Flask-restless create model with unicode field

I've get UnicodeEncodeError, when I try to create model instance with unicode field using curl Here's my code, I've put it in one file for simplicity: import flask import flask.ext.sqlalchemy import flask.ext.restless from flask import…
Nikolai Golub
  • 3,327
  • 4
  • 31
  • 61
1
vote
1 answer

Bad request for POST with relationship using flask-restless

I'm using flask-restless and getting a Bad Request (400) error on my first POST (from Postman). If I keep on making the same request, it keeps on erroring. But if I remove the field that flask-restless complains about, run the POST again, get a…
Evan Hammer
  • 450
  • 4
  • 13
1
vote
1 answer

search_params empty in a PATCH_MANY preprocessor in flask-restless

I have the following HTTP request issued via PUT: http://example.com/api/student?q=%7B%22filters%22:%5B%7B%22name%22:%22id%22,%22op%22:%22%3D%3D%22,%22val%22:1%7D%5D,%22disjunction%22:true%7D In which the query string decodes…
sssilver
  • 2,549
  • 3
  • 24
  • 34