mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-03-03 19:00:17 +03:00
For now just point the examples at rest.ep.io
Would be nice to keep the custom subdomain, but too much of a PITA right now.
This commit is contained in:
parent
833bcbf69d
commit
d87113ff60
|
@ -3,7 +3,7 @@
|
||||||
Blog Posts API
|
Blog Posts API
|
||||||
==============
|
==============
|
||||||
|
|
||||||
* http://api.django-rest-framework.org/blog-post/
|
* http://rest.ep.io/blog-post/
|
||||||
|
|
||||||
The models
|
The models
|
||||||
----------
|
----------
|
||||||
|
|
|
@ -7,11 +7,11 @@ Getting Started - Model Views
|
||||||
|
|
||||||
A live sandbox instance of this API is available:
|
A live sandbox instance of this API is available:
|
||||||
|
|
||||||
http://api.django-rest-framework.org/model-resource-example/
|
http://rest.ep.io/model-resource-example/
|
||||||
|
|
||||||
You can browse the API using a web browser, or from the command line::
|
You can browse the API using a web browser, or from the command line::
|
||||||
|
|
||||||
curl -X GET http://api.django-rest-framework.org/resource-example/ -H 'Accept: text/plain'
|
curl -X GET http://rest.ep.io/resource-example/ -H 'Accept: text/plain'
|
||||||
|
|
||||||
Often you'll want parts of your API to directly map to existing django models. Django REST framework handles this nicely for you in a couple of ways:
|
Often you'll want parts of your API to directly map to existing django models. Django REST framework handles this nicely for you in a couple of ways:
|
||||||
|
|
||||||
|
@ -43,16 +43,16 @@ And we're done. We've now got a fully browseable API, which supports multiple i
|
||||||
|
|
||||||
We can visit the API in our browser:
|
We can visit the API in our browser:
|
||||||
|
|
||||||
* http://api.django-rest-framework.org/model-resource-example/
|
* http://rest.ep.io/model-resource-example/
|
||||||
|
|
||||||
Or access it from the command line using curl:
|
Or access it from the command line using curl:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# Demonstrates API's input validation using form input
|
# Demonstrates API's input validation using form input
|
||||||
bash: curl -X POST --data 'foo=true' http://api.django-rest-framework.org/model-resource-example/
|
bash: curl -X POST --data 'foo=true' http://rest.ep.io/model-resource-example/
|
||||||
{"detail": {"bar": ["This field is required."], "baz": ["This field is required."]}}
|
{"detail": {"bar": ["This field is required."], "baz": ["This field is required."]}}
|
||||||
|
|
||||||
# Demonstrates API's input validation using JSON input
|
# Demonstrates API's input validation using JSON input
|
||||||
bash: curl -X POST -H 'Content-Type: application/json' --data-binary '{"foo":true}' http://api.django-rest-framework.org/model-resource-example/
|
bash: curl -X POST -H 'Content-Type: application/json' --data-binary '{"foo":true}' http://rest.ep.io/model-resource-example/
|
||||||
{"detail": {"bar": ["This field is required."], "baz": ["This field is required."]}}
|
{"detail": {"bar": ["This field is required."], "baz": ["This field is required."]}}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
Object Store API
|
Object Store API
|
||||||
================
|
================
|
||||||
|
|
||||||
* http://api.django-rest-framework.org/object-store/
|
* http://rest.ep.io/object-store/
|
||||||
|
|
||||||
This example shows an object store API that can be used to store arbitrary serializable content.
|
This example shows an object store API that can be used to store arbitrary serializable content.
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,11 @@ We're going to provide a simple wrapper around the awesome `pygments <http://pyg
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
A live sandbox instance of this API is available at http://api.django-rest-framework.org/pygments/
|
A live sandbox instance of this API is available at http://rest.ep.io/pygments/
|
||||||
|
|
||||||
You can browse the API using a web browser, or from the command line::
|
You can browse the API using a web browser, or from the command line::
|
||||||
|
|
||||||
curl -X GET http://api.django-rest-framework.org/pygments/ -H 'Accept: text/plain'
|
curl -X GET http://rest.ep.io/pygments/ -H 'Accept: text/plain'
|
||||||
|
|
||||||
|
|
||||||
URL configuration
|
URL configuration
|
||||||
|
@ -79,13 +79,13 @@ For example if we make a POST request using form input:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
bash: curl -X POST --data 'code=print "hello, world!"' --data 'style=foobar' -H 'X-Requested-With: XMLHttpRequest' http://api.django-rest-framework.org/pygments/
|
bash: curl -X POST --data 'code=print "hello, world!"' --data 'style=foobar' -H 'X-Requested-With: XMLHttpRequest' http://rest.ep.io/pygments/
|
||||||
{"detail": {"style": ["Select a valid choice. foobar is not one of the available choices."], "lexer": ["This field is required."]}}
|
{"detail": {"style": ["Select a valid choice. foobar is not one of the available choices."], "lexer": ["This field is required."]}}
|
||||||
|
|
||||||
Or if we make the same request using JSON:
|
Or if we make the same request using JSON:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
bash: curl -X POST --data-binary '{"code":"print \"hello, world!\"", "style":"foobar"}' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' http://api.django-rest-framework.org/pygments/
|
bash: curl -X POST --data-binary '{"code":"print \"hello, world!\"", "style":"foobar"}' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' http://rest.ep.io/pygments/
|
||||||
{"detail": {"style": ["Select a valid choice. foobar is not one of the available choices."], "lexer": ["This field is required."]}}
|
{"detail": {"style": ["Select a valid choice. foobar is not one of the available choices."], "lexer": ["This field is required."]}}
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,11 @@ Getting Started - Views
|
||||||
|
|
||||||
A live sandbox instance of this API is available:
|
A live sandbox instance of this API is available:
|
||||||
|
|
||||||
http://api.django-rest-framework.org/resource-example/
|
http://rest.ep.io/resource-example/
|
||||||
|
|
||||||
You can browse the API using a web browser, or from the command line::
|
You can browse the API using a web browser, or from the command line::
|
||||||
|
|
||||||
curl -X GET http://api.django-rest-framework.org/resource-example/ -H 'Accept: text/plain'
|
curl -X GET http://rest.ep.io/resource-example/ -H 'Accept: text/plain'
|
||||||
|
|
||||||
We're going to start off with a simple example, that demonstrates a few things:
|
We're going to start off with a simple example, that demonstrates a few things:
|
||||||
|
|
||||||
|
@ -43,16 +43,16 @@ Now we'll write our views. The first is a read only view that links to three in
|
||||||
|
|
||||||
That's us done. Our API now provides both programmatic access using JSON and XML, as well a nice browseable HTML view, so we can now access it both from the browser:
|
That's us done. Our API now provides both programmatic access using JSON and XML, as well a nice browseable HTML view, so we can now access it both from the browser:
|
||||||
|
|
||||||
* http://api.django-rest-framework.org/resource-example/
|
* http://rest.ep.io/resource-example/
|
||||||
|
|
||||||
And from the command line:
|
And from the command line:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# Demonstrates API's input validation using form input
|
# Demonstrates API's input validation using form input
|
||||||
bash: curl -X POST --data 'foo=true' http://api.django-rest-framework.org/resource-example/1/
|
bash: curl -X POST --data 'foo=true' http://rest.ep.io/resource-example/1/
|
||||||
{"detail": {"bar": ["This field is required."], "baz": ["This field is required."]}}
|
{"detail": {"bar": ["This field is required."], "baz": ["This field is required."]}}
|
||||||
|
|
||||||
# Demonstrates API's input validation using JSON input
|
# Demonstrates API's input validation using JSON input
|
||||||
bash: curl -X POST -H 'Content-Type: application/json' --data-binary '{"foo":true}' http://api.django-rest-framework.org/resource-example/1/
|
bash: curl -X POST -H 'Content-Type: application/json' --data-binary '{"foo":true}' http://rest.ep.io/resource-example/1/
|
||||||
{"detail": {"bar": ["This field is required."], "baz": ["This field is required."]}}
|
{"detail": {"bar": ["This field is required."], "baz": ["This field is required."]}}
|
||||||
|
|
|
@ -9,11 +9,11 @@ a browseable Web API, and much of the other goodness that Django REST framework
|
||||||
|
|
||||||
A live sandbox instance of this API is available for testing:
|
A live sandbox instance of this API is available for testing:
|
||||||
|
|
||||||
* http://api.django-rest-framework.org/mixin/
|
* http://rest.ep.io/mixin/
|
||||||
|
|
||||||
You can browse the API using a web browser, or from the command line::
|
You can browse the API using a web browser, or from the command line::
|
||||||
|
|
||||||
curl -X GET http://api.django-rest-framework.org/mixin/
|
curl -X GET http://rest.ep.io/mixin/
|
||||||
|
|
||||||
|
|
||||||
URL configuration
|
URL configuration
|
||||||
|
|
|
@ -27,4 +27,4 @@ There are a few things that can be helpful to remember when using CURL with djan
|
||||||
|
|
||||||
#. You can use basic authentication to send the username and password::
|
#. You can use basic authentication to send the username and password::
|
||||||
|
|
||||||
curl -X GET -H 'Accept: application/json' -u <user>:<password> http://example.com/my-api/
|
curl -X GET -H 'Accept: application/json' -u <user>:<password> http://example.com/my-api/
|
||||||
|
|
|
@ -11,11 +11,11 @@ Introduction
|
||||||
|
|
||||||
Django REST framework is a lightweight REST framework for Django, that aims to make it easy to build well-connected, self-describing RESTful Web APIs.
|
Django REST framework is a lightweight REST framework for Django, that aims to make it easy to build well-connected, self-describing RESTful Web APIs.
|
||||||
|
|
||||||
**Browse example APIs created with Django REST framework:** `The Sandbox <http://api.django-rest-framework.org/>`_
|
**Browse example APIs created with Django REST framework:** `The Sandbox <http://rest.ep.io/>`_
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
|
||||||
* Automatically provides an awesome Django admin style `browse-able self-documenting API <http://api.django-rest-framework.org>`_.
|
* Automatically provides an awesome Django admin style `browse-able self-documenting API <http://rest.ep.io>`_.
|
||||||
* Clean, simple, views for Resources, using Django's new `class based views <http://docs.djangoproject.com/en/dev/topics/class-based-views/>`_.
|
* Clean, simple, views for Resources, using Django's new `class based views <http://docs.djangoproject.com/en/dev/topics/class-based-views/>`_.
|
||||||
* Support for ModelResources with out-of-the-box default implementations and input validation.
|
* Support for ModelResources with out-of-the-box default implementations and input validation.
|
||||||
* Pluggable :mod:`.parsers`, :mod:`renderers`, :mod:`authentication` and :mod:`permissions` - Easy to customise.
|
* Pluggable :mod:`.parsers`, :mod:`renderers`, :mod:`authentication` and :mod:`permissions` - Easy to customise.
|
||||||
|
@ -101,7 +101,7 @@ There are a few real world web API examples included with Django REST framework.
|
||||||
|
|
||||||
All the examples are freely available for testing in the sandbox:
|
All the examples are freely available for testing in the sandbox:
|
||||||
|
|
||||||
http://api.django-rest-framework.org
|
http://rest.ep.io
|
||||||
|
|
||||||
(The :ref:`sandbox` resource is also documented.)
|
(The :ref:`sandbox` resource is also documented.)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user