Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

API Star tools to create CRUD resources.

Project description

Version: 0.1.0
Status: Production/Stable
Author: José Antonio Perdiguero López

API Star tools to create CRUD resources.


The resources are classes with a default implementation for methods:

  • create: Create a new element for this resource.
  • retrieve: Retrieve an element of this resource.
  • update: Update (partially or fully) an element of this resource.
  • delete: Delete an element of this resource.
  • list: List resource collection.
  • replace: Replace resource collection with a new one.
  • drop: Drop resource collection.

The routes for these methods are:

Method Verb URL
create POST /
retrieve GET /{element_id}/
update PUT /{element_id}/
delete DELETE /{element_id}/
list GET /
replace PUT /
drop DELETE /

Quick start

Install API star CRUD:

pip install apistar-crud

Create a model for your resource:

# Example using SQL Alchemy

class PuppyModel(Base):
    __tablename__ = "Puppy"

    id = Column(Integer, primary_key=True)
    name = Column(String)

Create a type for your resource:

class PuppyType(typesystem.Object):
    properties = {
        'id': typesystem.Integer,
        'name': typesystem.String

Now create your resource:

from apistar_crud.sqlalchemy import Resource

class PuppyResource(metaclass=Resource):
    model = PuppyModel
    type = PuppyType
    methods = ('create', 'retrieve', 'update', 'delete', 'list', 'replace', 'drop')

The resource generates his own routes, so you can add it to your main

from apistar import Include

routes = [
    Include('/puppy/', PuppyResource.routes, namespace='puppy'),

Project details

Download files

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

Files for apistar-crud, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size apistar_crud-0.1.0-py3-none-any.whl (16.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size apistar-crud-0.1.0.tar.gz (17.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page