HTTP RESTful Element API Plugin for Craft CMS
This plugin provides a means for you to Tap into your Craft installation programatically via HTTP in a RESTful fashion.
Version: Pre-alpha (This plugin is not completed, and should not be used in any environment)
Like Laravel's Resource Controllers, routes are generated for a variety of RESTful actions. A controller dynamically handles these actions, and completes the Request. If you need to limit which actions are available for an Element, they can be defined in the configuration (See below).
Verb | Path | Action | Description |
---|---|---|---|
GET | /tap/{element} | index | Display a listing of the element |
POST | /tap/{element} | store | Store a newly created element |
GET | /tap/{element}/{id} | show | Display the specified element |
PUT,PATCH | /tap/{element}/{id} | update | Update the specified element |
DELETE | /tap/{element}/{id} | destroy | Remove the specified element |
Seeing as how this plugin opens up a lot of functionality, it's only fitting that you have control over certain things. Here's a list of parameters available for your customization:
Parameter | Type | Default | Description |
---|---|---|---|
prefix | string | tap | Specify a value to prefix Endpoints with |
elements | array | array(...) | Define available element types, and their actions |
Note: You'll need to create
craft/config/tap.php
, and define the above parameters there.
The 'elements' parameter array should follow the format in this example:
'elements' => array(
'user' => array('index', 'store', 'show', 'update'),
'entry' => array('index', 'show'),
'category' => array('index', 'show', 'update'),
)
By default, all built-in Element Types, and all their resource actions are made available.