Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Django-API-Playground

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 apiplayground
Octocat-spinner-32 conf
Octocat-spinner-32 docs
Octocat-spinner-32 example
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 MANIFEST.in
Octocat-spinner-32 README.rst
Octocat-spinner-32 setup.py
README.rst

Django API Playground

A django app that creates api explorer for RESTful APIs.

Works with any RESTful API. For example, you can create api explorer for your tastypie based API with this app.

Demo: http://api-playground-demo.hipo.biz

https://github.com/hipo/Django-API-Playground/raw/master/docs/images/api-playground-2.png

Instructions

To get this application up and running, please follow the steps below:

Install from pip:

pip install django-api-playground

Or from source:

pip install git+git://github.com/Hipo/Django-API-Playground.git

Add to installed apps:

INSTALLED_APPS =(
    # ...

    'apiplayground',
)

Create database tables:

./manage.py syncdb

Installation is completed. You can define the API schema now.

First step, Create an url:

# urls.py

from api.playgrounds import ExampleAPIPlayground

urlpatterns = patterns('',
    (r'api-explorer/', include(ExampleAPIPlayground().urls)),
)

Second step, Define a subclass for your API:

# api/playgrounds.py

from apiplayground import APIPlayground

class ExampleAPIPlayground(APIPlayground):

    schema = {
        "title": "API Playground",
        "base_url": "http://localhost/api/",
        "resources": [
            {
                "name": "/feedbacks",
                "description": "This resource allows you to manage feedbacks.",
                "endpoints": [
                    {
                        "method": "GET",
                        "url": "/api/feedbacks/{feedback-id}",
                        "description": "Returns a specific feedback item",
                        "parameters": [{
                            "name": "order_by",
                            "type": "select",
                            "choices": [["", "None"], ["id", "id"], ["-id", "-id"]],
                            "default": "id"
                        }]
                    },
                    {
                        "method": "POST",
                        "url": "/api/feedbacks/",
                        "description": "Creates new feedback item",
                        "parameters": [{
                            "name": "title",
                            "type": "string"
                        },
                        {
                            "name": "resource",
                            "type": "string"
                        },
                        {
                           "name": "description",
                           "type": "string"
                        }]
                    }
                ]
            },
        ]
    }

That's all. More detailed documentation will be coming soon.

Special Thanks

  • Berker Peksag (for such a beautiful project name suggestion)
Something went wrong with that request. Please try again.