Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. <?xml version="1.0"?>
  2. <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
  3. <route url="/V1/hello/name/:name" method="GET">
  4. <service class="InchooHelloApiHelloInterface" method="name"/>
  5. <resources>
  6. <resource ref="anonymous"/>
  7. </resources>
  8. </route>
  9. <route url="/V1/hello/test/:test" method="POST">
  10. <service class="InchooHelloApiTestInterface" method="test"/>
  11. <resources>
  12. <resource ref="anonymous"/>
  13. </resources>
  14. </route>
  15. </routes>
  16.  
  17. <?php
  18. namespace InchooHelloApi;
  19.  
  20. interface TestInterface
  21. {
  22. /**
  23. * Returns greeting message to user
  24. *
  25. * @api
  26. * @param id $name Users id.
  27. * @return id Greeting message with users id.
  28. */
  29. public function test($id);
  30. }
  31.  
  32. <?php
  33. namespace InchooHelloModel;
  34. use InchooHelloApiTestInterface;
  35.  
  36. class Test implements TestInterface
  37. {
  38. /**
  39. * Returns greeting message to user
  40. *
  41. * @api
  42. * @param string $name Users name.
  43. * @return string Greeting message with users name.
  44. */
  45. public function test($id) {
  46. return "Hello How are you your id is:," .$id;
  47. }
  48. }
  49.  
  50. <?xml version="1.0"?>
  51. <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
  52. <preference for="InchooHelloApiHelloInterface" type="InchooHelloModelHello" />
  53. <preference for="InchooHelloApiTestInterface" type="InchooHelloModelTest" />
  54. </config>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement