This bundle provide REST API interface for Chameleon Shop. All Business-Features (not yet) be possible.
Actually Completed Features:
- Login
- Basic Product List with sorting, offset and limit
- Install the Bundle via Composer
composer.sh require kzorluoglu/rest-api-bundle:dev-master
- Add the Bundle in app/AppKernel.php
new \kzorluoglu\RestApiBundle\kzorluogluRestApiBundle(),
- Add the AnnotationReader::addGlobalIgnoredNamespace("OA") in app/autoload.php
$loader = require __DIR__.'/../vendor/autoload.php';
// OA (open AI) Annotations adding Doctorine Ingored Namespaces List
\Doctrine\Common\Annotations\AnnotationReader::addGlobalIgnoredNamespace("OA");
- Add the API Route in app/config/routing.yml
api:
resource: "@kzorluogluRestApiBundle/Resources/config/routing.yml"
type: yaml
prefix: /api
All URIs are relative to https://demo.chameleon-system.de/
Class | Method | HTTP request | Description |
---|---|---|---|
DefaultApi | kzorluogluRestApiBundleControllerLoginControllerLogin | POST /api/login | Login as user |
DefaultApi | kzorluogluRestApiBundleControllerProductProductControllerIndex | POST /api/product | Product List |
cd /vendor/kzorluoglu/rest-api-bundle
composer install
and Run Tests
./vendor/bin/phpunit -c phpunit.xml
./vendor/bin/openapi -o api.yml /your/root/path/vendor/kzorluoglu/rest-api-bundle/Controller
Example:
./vendor/bin/openapi -o api.yml /usr/local/apache2/htdocs/customer/vendor/kzorluoglu/rest-api-bundle/Controller
- Check if api.yml exists
../customer
..../app
..../web
..../api.yml
- For Preview; copy the contents of the api.yml file and paste it on https://editor.swagger.io
- copy the contents of the api.yml file
- paste it on https://editor.swagger.io
- Copy the contents of the api.yml file and paste it on https://editor.swagger.io
- Click Generate Client
- Choose one of the Client Software Language
- extract the generated zip file
- copy the "## Documentation for API Endpoints" Section from readme.md in your readme.md
- copy the docs folder from zip to this bundle
- Download https://github.com/swagger-api/swagger-ui - folder of interest is "dist"
- Copy your api YAML into the dist folder
- Open index.html and change the value of URL inside the tag at the bottom of the file to ./swagger.json (or whatever your swagger json is called)
- Host online! (or start a local server to view output).