Deleting resourcesΒΆ

For the purposes of concreteness in this section, suppose we have executed the following code on the server:

from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.restless import APIManager

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db'
db = SQLAlchemy(app)

class Person(db.Model):
    id = db.Column(db.Integer, primary_key=True)

manager = APIManager(app, session=db.session)
manager.create_api(Person, method=['DELETE'])

To delete a resource, the request

DELETE /api/person/1 HTTP/1.1
Accept: application/vnd.api+json

yields a 204 No Content response.