Automated REST APIs for existing database-driven systems
Project description
sandman
-----
**sandman** "makes things REST". Have an existing database you'd like to expose via
a REST API? Normally, you'd have to write a ton of boilerplate code for
the ORM you're using.
We're programmers. We don't write boilerplate.
Simple Setup
````````````
.. code:: python
from sandman import app, db
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///chinook'
from sandman.model import register, Model
class Artist(Model):
__tablename__ = 'Artist'
class Album(Model):
__tablename__ = 'Album'
class Playlist(Model):
__tablename__ = 'Playlist'
register((Artist, Album, Playlist))
app.run()
Let's start our new API server and make a request.
.. code:: bash
$ python runserver.py &
* Running on http://127.0.0.1:5000/
$ curl GET http://localhost:5000/artists
Here is the JSON returned:
.. code:: json
{
"ArtistId": 273,
"Name": "C. Monteverdi, Nigel Rogers - Chiaroscuro; London Baroque; London Cornett & Sackbu",
"links": [
{
"rel": "self",
"uri": "/artists/ArtistId"
}
]
},
{
"ArtistId": 274,
"Name": "Nash Ensemble",
"links": [
{
"rel": "self",
"uri": "/artists/ArtistId"
}
]
},
{
"ArtistId": 275,
"Name": "Philip Glass Ensemble",
"links": [
{
"rel": "self",
"uri": "/artists/ArtistId"
}
]
}
]
Batteries Included
``````````````````
With **sandman**, (almost) zero boilerplate code is required. Your existing database
structure and schema is introspected and your database tables magically get a
RESTful API. For each table, Sandman creates:
- proper endpoints
- support for a configurable set of HTTP verbs
- GET
- POST
- PATCH
- DELETE
- responses with appropriate ``rel`` links automatically
- essentially a HATEOAS-based service sitting in front of your database
*Warning: Sandman is still very much a work in progress.* It is not suitable for
use **anywhere.** Don't use it for anything important. It's also often changing
in backwards incompatible ways.
Links
`````
* `website <http://www.github.com/jeffknupp/sandman/>`_
* `documentation <http://pythonhosted.org/sandman/>`_
-----
**sandman** "makes things REST". Have an existing database you'd like to expose via
a REST API? Normally, you'd have to write a ton of boilerplate code for
the ORM you're using.
We're programmers. We don't write boilerplate.
Simple Setup
````````````
.. code:: python
from sandman import app, db
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///chinook'
from sandman.model import register, Model
class Artist(Model):
__tablename__ = 'Artist'
class Album(Model):
__tablename__ = 'Album'
class Playlist(Model):
__tablename__ = 'Playlist'
register((Artist, Album, Playlist))
app.run()
Let's start our new API server and make a request.
.. code:: bash
$ python runserver.py &
* Running on http://127.0.0.1:5000/
$ curl GET http://localhost:5000/artists
Here is the JSON returned:
.. code:: json
{
"ArtistId": 273,
"Name": "C. Monteverdi, Nigel Rogers - Chiaroscuro; London Baroque; London Cornett & Sackbu",
"links": [
{
"rel": "self",
"uri": "/artists/ArtistId"
}
]
},
{
"ArtistId": 274,
"Name": "Nash Ensemble",
"links": [
{
"rel": "self",
"uri": "/artists/ArtistId"
}
]
},
{
"ArtistId": 275,
"Name": "Philip Glass Ensemble",
"links": [
{
"rel": "self",
"uri": "/artists/ArtistId"
}
]
}
]
Batteries Included
``````````````````
With **sandman**, (almost) zero boilerplate code is required. Your existing database
structure and schema is introspected and your database tables magically get a
RESTful API. For each table, Sandman creates:
- proper endpoints
- support for a configurable set of HTTP verbs
- GET
- POST
- PATCH
- DELETE
- responses with appropriate ``rel`` links automatically
- essentially a HATEOAS-based service sitting in front of your database
*Warning: Sandman is still very much a work in progress.* It is not suitable for
use **anywhere.** Don't use it for anything important. It's also often changing
in backwards incompatible ways.
Links
`````
* `website <http://www.github.com/jeffknupp/sandman/>`_
* `documentation <http://pythonhosted.org/sandman/>`_
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sandman-0.2.2.tar.gz
(6.4 kB
view details)
File details
Details for the file sandman-0.2.2.tar.gz
.
File metadata
- Download URL: sandman-0.2.2.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9ce4632c57b6f217a16bcbc62107b3ddc8ab39384df9058a089e74e64947b8c |
|
MD5 | 7771ba82b5773ad4af4734440d63db53 |
|
BLAKE2b-256 | b2f78e650d8576e495b08ea5a00183aea913062042000c4cb5f45e084e68bec7 |