Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0"?>
- <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
- <route url="/V1/hello/name/:name" method="GET">
- <service class="InchooHelloApiHelloInterface" method="name"/>
- <resources>
- <resource ref="anonymous"/>
- </resources>
- </route>
- <route url="/V1/hello/test/:test" method="POST">
- <service class="InchooHelloApiTestInterface" method="test"/>
- <resources>
- <resource ref="anonymous"/>
- </resources>
- </route>
- </routes>
- <?php
- namespace InchooHelloApi;
- interface TestInterface
- {
- /**
- * Returns greeting message to user
- *
- * @api
- * @param id $name Users id.
- * @return id Greeting message with users id.
- */
- public function test($id);
- }
- <?php
- namespace InchooHelloModel;
- use InchooHelloApiTestInterface;
- class Test implements TestInterface
- {
- /**
- * Returns greeting message to user
- *
- * @api
- * @param string $name Users name.
- * @return string Greeting message with users name.
- */
- public function test($id) {
- return "Hello How are you your id is:," .$id;
- }
- }
- <?xml version="1.0"?>
- <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
- <preference for="InchooHelloApiHelloInterface" type="InchooHelloModelHello" />
- <preference for="InchooHelloApiTestInterface" type="InchooHelloModelTest" />
- </config>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement