1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
|
.. _ref-tools:
=====
Tools
=====
Here are some tools that might help in interacting with the API that Tastypie
provides:
Browser
=======
JSONView
--------
* Firefox - https://addons.mozilla.org/en-US/firefox/addon/jsonview/
* Chrome - https://chrome.google.com/webstore/detail/chklaanhfefbnpoihckbnefhakgolnmc
A plugin (actually two different ones that closely mirror each other) that
nicely reformats JSON data in the browser.
Postman - Rest Client
---------------------
* Chrome - https://chrome.google.com/webstore/detail/fdmmgilgnpjigdojojpjoooidkmcomcm
A feature rich Chrome extension with JSON and XML support
Extensions
==========
Tastypie-msgpack
----------------
https://github.com/stephenmcd/tastypie-msgpack
Adds MsgPack_ support to Tastypie's serializer.
.. _MsgPack: http://msgpack.org/
Python
======
Slumber
-------
http://slumber.in/
Slumber is a small Python library that makes it easy to access & work with
APIs. It works for many others, but works especially well with Tastypie.
Hammock
-------
https://github.com/kadirpekel/hammock
Hammock is a fun module lets you deal with rest APIs by converting them into dead simple programmatic APIs.
It uses popular ``requests`` module in backyard to provide full-fledged rest experience.
Here is what it looks like::
>>> import hammock
>>> api = hammock.Hammock('http://localhost:8000')
>>> api.users('foo').posts('bar').comments.GET()
<Response [200]>
drest
-----
http://drest.rtfd.org/
drest is another small Python library. It focuses on extensibility & can also
work with many different API, with an emphasis on Tastypie.
httpie
------
https://github.com/jkbr/httpie
HTTPie is a command line HTTP client written in Python. Its goal is to make
command-line interaction with web services as human-friendly as possible and
allows much conciser statements compared with curl.
For example for POSTing a JSON object you simply call:
$ http localhost:8000/api/v1/entry/ title="Foo" body="Bar" user="/api/v1/user/1/"
Now compare this with curl:
$ curl --dump-header - -H "Content-Type: application/json" -X POST --data '{"title": "Foo", "body": "Bar", "user": "/api/v1/user/1/"}' http://localhost:8000/api/v1/entry/
json.tool
---------
Included with Python, this tool makes reformatting JSON easy. For example::
$ curl http://localhost:8000/api/v1/note/ | python -m json.tool
Will return nicely reformatted data like::
{
"meta": {
"total_count": 1
},
"objects": [
{
"content": "Hello world!",
"user": "/api/v1/user/1/"
}
]
}
django-permissionsx
-------------------
https://github.com/thinkingpotato/django-permissionsx
This package allows using one set of rules both for Django class-based views]
and Tastypie authorization. For example:
**articles/permissions.py**::
class StaffPermissions(Permissions):
permissions = P(profile__is_editor=True) | P(profile__is_administrator=True)
**articles/views.py**::
class ArticleDeleteView(PermissionsViewMixin, DeleteView):
model = Article
success_url = reverse_lazy('article_list')
permissions = StaffPermissions
**articles/api.py**::
class StaffOnlyAuthorization(TastypieAuthorization):
permissions_class = StaffPermissions
django-superbulk
----------------
https://github.com/thelonecabbage/django-superbulk
This app adds bulk operation support to any Django view-based app, allowing for
better transactional behavior.
Javascript
==========
backbone-tastypie
-----------------
https://github.com/PaulUithol/backbone-tastypie
A small layer that makes Backbone & Tastypie plan nicely together.
backbone-relational
-------------------
https://github.com/PaulUithol/Backbone-relational/
Allows Backbone to work with relational data, like the kind of data Tastypie
provides.
|