Skip to main content

Quickly expose your models to a JSON or XML API, authenticated via HTTP or OAuth.

Project description

Quickly expose your models to a JSON or XML API, authenticated via HTTP or OAuth.

About Bambu API

This package allows you to easily expose Django models to RESTful endpoints which can send data in XML or JSON format.

Installation

Install the package via Pip:

pip install bambu-api

Add it to your INSTALLED_APPS list:

INSTALLED_APPS = (
    ...
    'bambu.api'
)

Add bambu.api.urls to your URLconf:

urlpatterns = patterns('',
    ...
    url(r'^', include('bambu.api.urls')),
)

The prefix should be kept blank, as the package exposes two main URL stems: /api/, wherein the RESTful endpoints live, and /docs/ where auto-generated documentation for each endpoint is found.

Basic usage

You define API endpoints like Django admins, and register them in a similar way.

Teka the Django ‘polls’ app as an example. Within the polls directory, you’d create a file called api.py. A simple API endpoint would be defined like this:

from bambu import api
from myproject.polls.models import Question

class QuestionAPI(api.ModelAPI):
    pass

api.site.register(Question, QuestionAPI)

This registers the QuestionAPI endpoint for the Question model. The endpoint is then accessible at /api/polls/question.json.

Full documentation

Full documentation can be found at ReadTheDocs.

Questions or suggestions?

Find me on Twitter (@iamsteadman) or visit my blog.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bambu-api-0.5.2.tar.gz (34.3 kB view details)

Uploaded Source

File details

Details for the file bambu-api-0.5.2.tar.gz.

File metadata

  • Download URL: bambu-api-0.5.2.tar.gz
  • Upload date:
  • Size: 34.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bambu-api-0.5.2.tar.gz
Algorithm Hash digest
SHA256 8e38b63ca0a6413511305015db1ac0eb827c4b717043aa10eb3ddc149a4b9a45
MD5 a6f045e6cb127c949f7276530f86ed98
BLAKE2b-256 8c1d523eb61d53d2d3c78e31c881bcb02e732f1656857d3bacfcbbb8ee1f8b33

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page