|
1 |
| -.. note:: |
2 |
| - |
3 |
| - This documentation is under construction, more to come soon |
4 |
| - |
5 |
| - |
6 |
| - |
7 | 1 | Api
|
8 | 2 | ===
|
9 | 3 |
|
10 |
| -expose your data through a json api |
11 |
| - |
12 | 4 | Features
|
13 |
| -~~~~~~~~ |
| 5 | +-------- |
14 | 6 |
|
15 |
| - - Insert here the different feature available for this plugin |
| 7 | + - Expose node from the datasource through a RESTful API. |
16 | 8 |
|
17 | 9 | Configuration
|
18 |
| -~~~~~~~~~~~~~ |
| 10 | +------------- |
| 11 | + |
| 12 | +You need to enable the plugin by adding this line into the IoC configuration file. |
| 13 | + |
| 14 | +.. code-block:: yaml |
| 15 | +
|
| 16 | + element.plugins.api: |
19 | 17 |
|
20 |
| - - Insert the yaml configuration for the DI |
| 18 | +Then, you must have a node api as defined in your datasource: |
21 | 19 |
|
22 | 20 | .. code-block:: yaml
|
23 | 21 |
|
24 |
| - element.plugins.cache: |
25 |
| - cache_control: |
26 |
| - - { "path": "^.*\\.(txt|jpg|png|gif|xls|doc|docx)$", "Cache-Control": ['public', 's-maxage=14212800']} |
27 |
| - - { "path": "^(blog|gallery).*", "Cache-Control": ['public', 's-maxage=3600']} |
28 |
| - - { "path": "^.*\\.rss", "Cache-Control": ['public', 's-maxage=3600']} |
29 |
| - - { "path": "^contact.*", "Cache-Control": ['private', 'must-revalidate']} |
30 |
| - - { "path": "^/$", "Cache-Control": ['public', 's-maxage=3600']} |
| 22 | + # api.yml |
| 23 | + title: API |
| 24 | + type: action.collection |
| 25 | + actions: |
| 26 | + element_api_node: |
| 27 | + path: /element/node/<path:path>.<_format> |
| 28 | + methods: ['GET', 'PUT', 'POST', 'DELETE'] |
| 29 | + defaults: |
| 30 | + _controller: element.api.view.node:execute |
| 31 | +
|
| 32 | + element_api_list_index: |
| 33 | + path: /element/node.<_format> |
| 34 | + methods: ['GET'] |
| 35 | + defaults: |
| 36 | + _controller: element.api.view.node.list:execute |
| 37 | + path: / |
| 38 | +
|
| 39 | + element_api_list: |
| 40 | + path: /element/path/<path:path>.<_format> |
| 41 | + methods: ['GET'] |
| 42 | + defaults: |
| 43 | + _controller: element.api.view.node.list:execute |
31 | 44 |
|
32 |
| -Events |
33 |
| -~~~~~~ |
| 45 | + element_api_handler_list: |
| 46 | + path: /element/handlers.<_format> |
| 47 | + methods: ['GET'] |
| 48 | + defaults: |
| 49 | + _controller: element.api.view.handler.list:execute |
| 50 | +
|
| 51 | + element_api_handler: |
| 52 | + path: /element/handler/<code>.<_format> |
| 53 | + methods: ['GET'] |
| 54 | + defaults: |
| 55 | + _controller: element.api.view.handler:execute |
| 56 | +
|
| 57 | +
|
| 58 | +.. note:: |
34 | 59 |
|
35 |
| - - List event or entry points for this plugin |
| 60 | + The API is not stable. |
36 | 61 |
|
37 |
| -Architecture |
38 |
| -~~~~~~~~~~~~ |
| 62 | +Usage |
| 63 | +----- |
39 | 64 |
|
40 |
| - - Provide information about how the feature is implemented |
| 65 | + - ``GET /api/element/handlers.json`` : return the list of handlers |
| 66 | + - ``GET /api/element/node.json``: return the different node available |
| 67 | + - ``GET /api/element/node/{ID}.json``: get a node |
| 68 | + - ``POST /api/element/node/{ID}.json``: update a node |
| 69 | + - ``PUT /api/element/node/{ID}.json``: create a node |
0 commit comments