Browse Source

the output is awesome

master
Julio Biason 9 years ago
parent
commit
a1f2db1f99
  1. 33
      django-rest.html

33
django-rest.html

@ -354,6 +354,11 @@ class UserSerializer(serializers.ModelSerializer):
<section>
<h2>JSON</h2>
<pre><code class="hljs">
curl -H 'Accept: application/json; indent=4' \
-u admin:admin123 http://127.0.0.1:8000/users/
</code></pre>
<pre><code class="hljs">
{
"count": 1,
@ -362,7 +367,7 @@ class UserSerializer(serializers.ModelSerializer):
"results": [
{
"url": "http://127.0.0.1:8000/users/1/",
"username": "jbiason",
"username": "admin",
"email": "",
"groups": []
}
@ -373,6 +378,11 @@ class UserSerializer(serializers.ModelSerializer):
<section>
<h2>YAML</h2>
<pre><code class="hljs">
curl -H 'Accept: application/yaml' \
-u admin:admin123 http://127.0.0.1:8000/users/
</code></pre>
<pre><code class="hljs">
count: 1
next: null
@ -381,16 +391,33 @@ results:
- email: ''
groups: []
url: http://127.0.0.1:8000/users/1/
username: jbiason
username: admin
</code></pre>
</section>
<section>
<h2>XML</h2>
<pre><code class="hljs">
curl -H 'Accept: application/xml' \
-u jbiason:slowdown http://127.0.0.1:8000/users/
</code></pre>
<pre><code class="hljs">
<?xml version="1.0" encoding="utf-8"?>
<root><count>1</count><next></next><previous></previous><results><list-item><url>http://127.0.0.1:8000/users/1/</url><username>jbiason</username><email></email><groups></groups></list-item></results></root>
<root>
<count>1</count>
<next></next>
<previous></previous>
<results>
<list-item>
<url>http://127.0.0.1:8000/users/1/</url>
<username>admin</username>
<email></email>
<groups></groups>
</list-item>
</results>
</root>
</code></pre>
</section>

Loading…
Cancel
Save