Welcome to py-jsonapi’s documentation!

Attention

This library is under active development. If you have any suggestions, please create an issue on GitHub.

About py-jsonapi

Indices and tables

Description

This library implements the http://jsonapi.org specification in Python 3. It is easy to use, extendible and comes with support for many web frameworks and database drivers, like flask, tornado, mongoengine and sqlalchemy.

Here is a simple API using flask and mongoengine:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python3

import mongoengine
import flask
import jsonapi, jsonapi.mongoengine, jsonapi.flask

class User(mongoengine.Document):
    name = mongoengine.StringField()
    email = mongoengine.EmailField()
    birthday = mongoengine.DateTimeField()

app = flask.Flask(__name__)

db = jsonapi.mongoengine.Database()
api = jsonapi.flask.FlaskAPI(uri="/api", db=db, flask_app=app)

user_schema = jsonapi.mongoengine.Schema(User)
api.add_type(user_schema)

if __name__ == "__main__":
    mongoengine.connect("py_jsonapi")
    app.run(debug=True)