aboutsummaryrefslogtreecommitdiffstats
path: root/api-guide/requests/index.html
diff options
context:
space:
mode:
authorTom Christie2014-12-01 12:20:07 +0000
committerTom Christie2014-12-01 12:20:07 +0000
commited93e13a1c6f792e14176bdaa5e96d0fa2c63a2f (patch)
tree03e176c54384ac88d22a1fbc4ba32a6e320695f2 /api-guide/requests/index.html
parent9defb5ee9f0090f98fa579f1e74b7dfdd6138744 (diff)
downloaddjango-rest-framework-ed93e13a1c6f792e14176bdaa5e96d0fa2c63a2f.tar.bz2
Update documentation
Diffstat (limited to 'api-guide/requests/index.html')
-rw-r--r--api-guide/requests/index.html45
1 files changed, 31 insertions, 14 deletions
diff --git a/api-guide/requests/index.html b/api-guide/requests/index.html
index a074e516..11781510 100644
--- a/api-guide/requests/index.html
+++ b/api-guide/requests/index.html
@@ -165,6 +165,10 @@
</li>
<li >
+ <a href="../validators">Validators</a>
+ </li>
+
+ <li >
<a href="../authentication">Authentication</a>
</li>
@@ -264,6 +268,10 @@
</li>
<li >
+ <a href="../../topics/3.0-announcement">3.0 Announcement</a>
+ </li>
+
+ <li >
<a href="../../topics/kickstarter-announcement">Kickstarter Announcement</a>
</li>
@@ -350,15 +358,19 @@
<li>
- <a href="#data">.DATA</a>
+ <a href="#data">.data</a>
</li>
<li>
- <a href="#files">.FILES</a>
+ <a href="#query_params">.query_params</a>
</li>
<li>
- <a href="#query_params">.QUERY_PARAMS</a>
+ <a href="#data-and-files">.DATA and .FILES</a>
+ </li>
+
+ <li>
+ <a href="#query_params_1">.QUERY_PARAMS</a>
</li>
<li>
@@ -448,7 +460,10 @@
- <h1 id="requests">Requests</h1>
+ <hr />
+<p><strong>Note</strong>: This is the documentation for the <strong>version 3.0</strong> of REST framework. Documentation for <a href="http://tomchristie.github.io/rest-framework-2-docs/">version 2.4</a> is also available.</p>
+<hr />
+<h1 id="requests">Requests</h1>
<blockquote>
<p>If you're doing REST-based web service stuff ... you should ignore request.POST.</p>
<p>&mdash; Malcom Tredinnick, <a href="https://groups.google.com/d/topic/django-developers/dxI4qVzrBY4/discussion">Django developers group</a></p>
@@ -457,24 +472,26 @@
<hr />
<h1 id="request-parsing">Request parsing</h1>
<p>REST framework's Request objects provide flexible request parsing that allows you to treat requests with JSON data or other media types in the same way that you would normally deal with form data.</p>
-<h2 id="data">.DATA</h2>
-<p><code>request.DATA</code> returns the parsed content of the request body. This is similar to the standard <code>request.POST</code> attribute except that:</p>
+<h2 id="data">.data</h2>
+<p><code>request.data</code> returns the parsed content of the request body. This is similar to the standard <code>request.POST</code> and <code>request.FILES</code> attributes except that:</p>
<ul>
+<li>It includes all parsed content, including <em>file and non-file</em> inputs.</li>
<li>It supports parsing the content of HTTP methods other than <code>POST</code>, meaning that you can access the content of <code>PUT</code> and <code>PATCH</code> requests.</li>
<li>It supports REST framework's flexible request parsing, rather than just supporting form data. For example you can handle incoming JSON data in the same way that you handle incoming form data.</li>
</ul>
<p>For more details see the <a href="../parsers">parsers documentation</a>.</p>
-<h2 id="files">.FILES</h2>
-<p><code>request.FILES</code> returns any uploaded files that may be present in the content of the request body. This is the same as the standard <code>HttpRequest</code> behavior, except that the same flexible request parsing is used for <code>request.DATA</code>.</p>
-<p>For more details see the <a href="../parsers">parsers documentation</a>.</p>
-<h2 id="query_params">.QUERY_PARAMS</h2>
-<p><code>request.QUERY_PARAMS</code> is a more correctly named synonym for <code>request.GET</code>.</p>
-<p>For clarity inside your code, we recommend using <code>request.QUERY_PARAMS</code> instead of the usual <code>request.GET</code>, as <em>any</em> HTTP method type may include query parameters.</p>
+<h2 id="query_params">.query_params</h2>
+<p><code>request.query_params</code> is a more correctly named synonym for <code>request.GET</code>.</p>
+<p>For clarity inside your code, we recommend using <code>request.query_params</code> instead of the Django's standard <code>request.GET</code>. Doing so will help keep your codebase more correct and obvious - any HTTP method type may include query parameters, not just <code>GET</code> requests.</p>
+<h2 id="data-and-files">.DATA and .FILES</h2>
+<p>The old-style version 2.x <code>request.data</code> and <code>request.FILES</code> attributes are still available, but are now pending deprecation in favor of the unified <code>request.data</code> attribute.</p>
+<h2 id="query_params_1">.QUERY_PARAMS</h2>
+<p>The old-style version 2.x <code>request.QUERY_PARAMS</code> attribute is still available, but is now pending deprecation in favor of the more pythonic <code>request.query_params</code>.</p>
<h2 id="parsers">.parsers</h2>
<p>The <code>APIView</code> class or <code>@api_view</code> decorator will ensure that this property is automatically set to a list of <code>Parser</code> instances, based on the <code>parser_classes</code> set on the view or based on the <code>DEFAULT_PARSER_CLASSES</code> setting.</p>
<p>You won't typically need to access this property.</p>
<hr />
-<p><strong>Note:</strong> If a client sends malformed content, then accessing <code>request.DATA</code> or <code>request.FILES</code> may raise a <code>ParseError</code>. By default REST framework's <code>APIView</code> class or <code>@api_view</code> decorator will catch the error and return a <code>400 Bad Request</code> response.</p>
+<p><strong>Note:</strong> If a client sends malformed content, then accessing <code>request.data</code> may raise a <code>ParseError</code>. By default REST framework's <code>APIView</code> class or <code>@api_view</code> decorator will catch the error and return a <code>400 Bad Request</code> response.</p>
<p>If a client sends a request with a content-type that cannot be parsed then a <code>UnsupportedMediaType</code> exception will be raised, which by default will be caught and return a <code>415 Unsupported Media Type</code> response.</p>
<hr />
<h1 id="content-negotiation">Content negotiation</h1>
@@ -537,7 +554,7 @@
<!--/.wrapper -->
<footer class="span12">
- <p>Sponsored by <a href="http://dabapps.com/">DabApps</a>.</a>
+ <p>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</a>
</p>
</footer>