Installation¶
Stable release¶
To install aiohttp JSON API, run this command in your terminal:
$ pip install aiohttp_json_api
This is the preferred method to install aiohttp JSON API, as it will always install the most recent stable release.
If you don’t have pip installed, this Python installation guide can guide you through the process.
From sources¶
The sources for aiohttp JSON API can be downloaded from the Github repo.
You can either clone the public repository:
$ git clone git://github.com/vovanbo/aiohttp_json_api
Or download the tarball:
$ curl -OL https://github.com/vovanbo/aiohttp_json_api/tarball/master
Once you have a copy of the source, you can install it with:
$ python setup.py install
Default setup of resources, routes and handlers¶
Resource name | Method | Route | Handler |
---|---|---|---|
jsonapi.collection | GET | /{type} |
get_collection() |
jsonapi.collection | POST | /{type} |
post_resource() |
jsonapi.resource | GET | /{type}/{id} |
get_resource() |
jsonapi.resource | PATCH | /{type}/{id} |
patch_resource() |
jsonapi.resource | DELETE | /{type}/{id} |
delete_resource() |
jsonapi.relationships | GET | /{type}/{id}/relationships/{relation} |
get_relationship() |
jsonapi.relationships | POST | /{type}/{id}/relationships/{relation} |
post_relationship() |
jsonapi.relationships | PATCH | /{type}/{id}/relationships/{relation} |
patch_relationship() |
jsonapi.relationships | DELETE | /{type}/{id}/relationships/{relation} |
delete_relationship() |
jsonapi.related | GET | /{type}/{id}/{relation} |
get_related() |