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