跳转到主要内容

RESTful API的API游乐场

项目描述

一个django应用,用于创建RESTful API的API探索器。

适用于任何RESTful API。例如,您可以使用此应用程序创建基于tastypie的API的API探索器。

演示: http://api-playground-demo.hipo.biz

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

说明

要运行此应用程序,请按照以下步骤操作

从pip安装

pip install django-api-playground

或从源安装

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

添加到已安装的应用程序

INSTALLED_APPS =(
    # ...

    'apiplayground',
)

安装完成。现在您可以定义API模式。

第一步,创建一个URL

# urls.py

from api.playgrounds import ExampleAPIPlayground

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

第二步,定义您的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"
                    },
                    {
                        "method": "POST",
                        "url": "/api/feedbacks/",
                        "description": "Creates new feedback item",
                        "parameters": [{
                            "name": "title",
                            "type": "string"
                        },
                        {
                            "name": "resource",
                            "type": "string"
                        },
                        {
                           "name": "description",
                           "type": "string"
                        }]
                    }
                ]
            },
        ]
    }

这就完成了。更详细的文档即将推出。

项目详情


下载文件

下载适合您的平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分布

django-api-playground-0.1.0.tar.gz (45.3 kB 查看哈希)

上传时间:

由以下支持