2017 © Pedro Peláez
 

contao-module contao-restful-webservices

RESTful Webservices for Contao OpenSource CMS

image

craffft/contao-restful-webservices

RESTful Webservices for Contao OpenSource CMS

  • Friday, February 20, 2015
  • by Craffft
  • Repository
  • 3 Watchers
  • 6 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 1 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

RESTful Webservices for Contao

The "RESTful Webservices" extension is a helper library for developers to realize RESTful webservices in your own extension, (*1)

License

This Contao extension is licensed under the terms of the LGPLv3. http://www.gnu.org/licenses/lgpl-3.0.html, (*2)

Dependencies

  • Haste https://github.com/codefog/contao-haste

https://contao.org/en/extension-list/view/restful-webservices.html, (*3)

Documentation

Define the webservice "categories", (*4)

// systems/modules/mymodule/config/config.php

$GLOBALS['RESTFUL_WEBSERVICES']['ROUTING']['categories'] = array
(
    // Define the webservice location (required definition)
    // Callable via http://localhost/mycontao/interface/categories/12/my_token
    'pattern' => '/categories/{id}/{token}',

    // Restrict methods (optional definition)
    // You can use GET, PUT, POST and DELETE
    'methods' => array('GET', 'POST'),

    // Set requirements for the pattern values (optional definition)
    'requirements' => array
    (
        'id' => '\d+',
    ),

    // Restrict access by tokens (optional definition)
    'tokens' => array
    (
        'my_token',
    ),

    // Restrict access by ip addresses (optional definition)
    'ips' => array
    (
        '127.0.0.1',
    ),

    // Restrict CORS access by ip addresses (optional definition)
    'cors' => array
    (
        '192.168.1.180',
    )
);

Declare the webservice class "WebserviceCategories", (*5)

// systems/modules/mymodule/webservices/WebserviceCategories.php

namespace MyAppNamespace;

use \Haste\Http\Response\JsonResponse;

class WebserviceCategories extends \RESTfulWebservices\RESTfulController
{
    public function get()
    {
        $arrData = array();

        // Add "Hello World!" to the json output
        $arrData['status'] = 'Hello World!';

        // Send response
        $objResponse = new JsonResponse();
        $objResponse->setContent($arrData, JSON_PRETTY_PRINT);
        $objResponse->send();
    }

    public function put()
    {
        // Code for PUT requests
    }

    public function post()
    {
        // Code for POST requests
    }

    public function delete()
    {
        // Code for DELETE requests
    }
}

The Versions

20/02 2015

dev-master

9999999-dev http://craffft.de

RESTful Webservices for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

rest data contao interface webservice

20/02 2015

2.1.0

2.1.0.0 http://craffft.de

RESTful Webservices for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

rest data contao interface webservice

20/03 2014

2.0.0

2.0.0.0 http://daniel-kiesel.de

RESTful Webservices for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

rest data contao interface webservice

20/03 2014

dev-develop

dev-develop http://daniel-kiesel.de

RESTful Webservices for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

rest data contao interface webservice

24/02 2014

1.0.1

1.0.1.0 http://daniel-kiesel.de

RESTful Webservices for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

rest data contao interface webservice

16/02 2014

1.0.0

1.0.0.0 http://daniel-kiesel.de

RESTful Webservices for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

rest data contao interface webservice