Skip to main content

Define a REST API to access and manage Zope 2 content

Project description

infrae.rest provide a simple way to write REST APIs in Zope 2.

API

infrae.rest provides mainly a base class REST which behave a lot like a Grok view:

from infrae.rest import REST

class MyAction(REST):
    """My action REST API.
    """

    def POST(self, name, value):
        # Called by POST /content/++rest++myaction&name=foo?value=bar
        return 'Success'

    def GET(self):
        # Called by GET /content/++rest++myaction
        values = self.context.something()
        return self.json_response(values)

You just have to grok your package to make it available.

  • You can provide: POST, GET, HEAD, DELETE requests.

  • You can use the directives grok.name, grok.require and grok.context to configure your REST API. They work exactly like on a grok.View.

Changes

1.0 (2010/07/15)

  • Initial release

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

infrae.rest-1.0.tar.gz (5.6 kB view hashes)

Uploaded Source

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