I am new here. I want to know how can I create my own simple APIOauth Error while extending Magento Rest APIwhich magento API using for create a new accountREST API create simple productMagento 2.2 Creating Configurable Product With APIHow to create new order with a Rest ApiHow to create API Endpoint in Magento2?“Unable to save Stock Item issue” when I try to create multi-able simple products via RESTful APIhow we can place order with REST API Magento 2?how can I get an image to be used in mobile app by rest apiHow to get Sku, name, and image in magento2 in phtml file

What language is Raven using for her attack in the new 52?

What is the difference between position, displacement, and distance traveled?

Building a scene and readability

How to politely refuse a startup's equity?

To find islands of 1 and 0 in matrix

What is this spacecraft tethered to another spacecraft in LEO (vintage)

How to avoid theft of potentially patentable IP when trying to obtain a Ph.D?

Request for a Latin phrase as motto "God is highest/supreme"

Is my investment strategy a form of fundamental indexing?

Are the named pipe created by `mknod` and the FIFO created by `mkfifo` equivalent?

Sci fi story: Clever pigs that help a galaxy lawman

Does academia have a lazy work culture?

How do I stop my characters falling in love?

Is there a wealth gap in Boston where the median net worth of white households is $247,500 while the median net worth for black families was $8?

Word for showing a small part of something briefly to hint to its existence or beauty without fully uncovering it

Am I allowed to use personal conversation as a source?

Correlation length anisotropy in the 2D Ising model

How to check what is edible on an alien world?

Why can't my huge trees be chopped down?

Why isn't there a serious attempt at creating a third mass-appeal party in the US?

Why do planes need a roll motion?

What is the most efficient way to write 'for' loops in Matlab?

How many oliphaunts died in all of the Lord of the Rings battles?

How did the SysRq key get onto modern keyboards if it's rarely used?



I am new here. I want to know how can I create my own simple API


Oauth Error while extending Magento Rest APIwhich magento API using for create a new accountREST API create simple productMagento 2.2 Creating Configurable Product With APIHow to create new order with a Rest ApiHow to create API Endpoint in Magento2?“Unable to save Stock Item issue” when I try to create multi-able simple products via RESTful APIhow we can place order with REST API Magento 2?how can I get an image to be used in mobile app by rest apiHow to get Sku, name, and image in magento2 in phtml file






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I am new here. I want to know how can I create my own simple API to fetch product image,name,is it available in stock and price of the product. Please help me with complete procedure.










share|improve this question
























  • following link will be helpful for you lorenzosfarra.com/2017/06/20/…

    – MSA
    Jul 18 at 7:29

















2















I am new here. I want to know how can I create my own simple API to fetch product image,name,is it available in stock and price of the product. Please help me with complete procedure.










share|improve this question
























  • following link will be helpful for you lorenzosfarra.com/2017/06/20/…

    – MSA
    Jul 18 at 7:29













2












2








2


0






I am new here. I want to know how can I create my own simple API to fetch product image,name,is it available in stock and price of the product. Please help me with complete procedure.










share|improve this question
















I am new here. I want to know how can I create my own simple API to fetch product image,name,is it available in stock and price of the product. Please help me with complete procedure.







magento2 api






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 18 at 10:01









Mohit Rane

1,00918 bronze badges




1,00918 bronze badges










asked Jul 18 at 7:24









ritik somritik som

112 bronze badges




112 bronze badges












  • following link will be helpful for you lorenzosfarra.com/2017/06/20/…

    – MSA
    Jul 18 at 7:29

















  • following link will be helpful for you lorenzosfarra.com/2017/06/20/…

    – MSA
    Jul 18 at 7:29
















following link will be helpful for you lorenzosfarra.com/2017/06/20/…

– MSA
Jul 18 at 7:29





following link will be helpful for you lorenzosfarra.com/2017/06/20/…

– MSA
Jul 18 at 7:29










1 Answer
1






active

oldest

votes


















0














Please follow the steps to create your own simple API.



  1. First, create a basic module.


  2. Add webapi.xml file to define the API URL, service class and methods.app/code/Milandev/SimpleAPI/etc/webapi.xml.



    <?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 method="GET" url="/V1/milandev-simpleapi/product/:sku">
    <service class="MilanDevSimpleAPIApiProductManagementInterface" method="getProduct"/>
    <resources>
    <resource ref="anonymous"/>
    </resources>
    </route>
    </routes>



  3. Add API class.
    app/code/Milandev/SimpleAPI/Model/ProductManagement.php.



    <?php
    namespace MilanDevSimpleAPIModel;

    class ProductManagement implements MilanDevSimpleAPIApiProductManagementInterface

    /**
    * @inheritdoc
    */
    public function getProduct($sku)

    // add your logic
    return $sku;





  4. Add API interface.
    app/code/Milandev/SimpleAPI/Api/ProductManagementInterface.php.



    <?php
    namespace MilanDevSimpleAPIApi;

    interface ProductManagementInterface

    /**
    * GET for product api
    * @param string $sku
    * @return string
    */
    public function getProduct($sku);




  5. Add dependency class in the di.xml.app/code/Milandev/SimpleAPI/etc/di.xml.



    <?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="MilanDevSimpleAPIApiProductManagementInterface" type="MilanDevSimpleAPIModelProductManagement"/>
    </config>


  6. Test the API using rest-client by following the URL structure.
    http://exmaple.com/index.php/rest/V1/milandev-simpleapi/product/sku





share|improve this answer

























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f282480%2fi-am-new-here-i-want-to-know-how-can-i-create-my-own-simple-api%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Please follow the steps to create your own simple API.



    1. First, create a basic module.


    2. Add webapi.xml file to define the API URL, service class and methods.app/code/Milandev/SimpleAPI/etc/webapi.xml.



      <?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 method="GET" url="/V1/milandev-simpleapi/product/:sku">
      <service class="MilanDevSimpleAPIApiProductManagementInterface" method="getProduct"/>
      <resources>
      <resource ref="anonymous"/>
      </resources>
      </route>
      </routes>



    3. Add API class.
      app/code/Milandev/SimpleAPI/Model/ProductManagement.php.



      <?php
      namespace MilanDevSimpleAPIModel;

      class ProductManagement implements MilanDevSimpleAPIApiProductManagementInterface

      /**
      * @inheritdoc
      */
      public function getProduct($sku)

      // add your logic
      return $sku;





    4. Add API interface.
      app/code/Milandev/SimpleAPI/Api/ProductManagementInterface.php.



      <?php
      namespace MilanDevSimpleAPIApi;

      interface ProductManagementInterface

      /**
      * GET for product api
      * @param string $sku
      * @return string
      */
      public function getProduct($sku);




    5. Add dependency class in the di.xml.app/code/Milandev/SimpleAPI/etc/di.xml.



      <?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="MilanDevSimpleAPIApiProductManagementInterface" type="MilanDevSimpleAPIModelProductManagement"/>
      </config>


    6. Test the API using rest-client by following the URL structure.
      http://exmaple.com/index.php/rest/V1/milandev-simpleapi/product/sku





    share|improve this answer



























      0














      Please follow the steps to create your own simple API.



      1. First, create a basic module.


      2. Add webapi.xml file to define the API URL, service class and methods.app/code/Milandev/SimpleAPI/etc/webapi.xml.



        <?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 method="GET" url="/V1/milandev-simpleapi/product/:sku">
        <service class="MilanDevSimpleAPIApiProductManagementInterface" method="getProduct"/>
        <resources>
        <resource ref="anonymous"/>
        </resources>
        </route>
        </routes>



      3. Add API class.
        app/code/Milandev/SimpleAPI/Model/ProductManagement.php.



        <?php
        namespace MilanDevSimpleAPIModel;

        class ProductManagement implements MilanDevSimpleAPIApiProductManagementInterface

        /**
        * @inheritdoc
        */
        public function getProduct($sku)

        // add your logic
        return $sku;





      4. Add API interface.
        app/code/Milandev/SimpleAPI/Api/ProductManagementInterface.php.



        <?php
        namespace MilanDevSimpleAPIApi;

        interface ProductManagementInterface

        /**
        * GET for product api
        * @param string $sku
        * @return string
        */
        public function getProduct($sku);




      5. Add dependency class in the di.xml.app/code/Milandev/SimpleAPI/etc/di.xml.



        <?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="MilanDevSimpleAPIApiProductManagementInterface" type="MilanDevSimpleAPIModelProductManagement"/>
        </config>


      6. Test the API using rest-client by following the URL structure.
        http://exmaple.com/index.php/rest/V1/milandev-simpleapi/product/sku





      share|improve this answer

























        0












        0








        0







        Please follow the steps to create your own simple API.



        1. First, create a basic module.


        2. Add webapi.xml file to define the API URL, service class and methods.app/code/Milandev/SimpleAPI/etc/webapi.xml.



          <?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 method="GET" url="/V1/milandev-simpleapi/product/:sku">
          <service class="MilanDevSimpleAPIApiProductManagementInterface" method="getProduct"/>
          <resources>
          <resource ref="anonymous"/>
          </resources>
          </route>
          </routes>



        3. Add API class.
          app/code/Milandev/SimpleAPI/Model/ProductManagement.php.



          <?php
          namespace MilanDevSimpleAPIModel;

          class ProductManagement implements MilanDevSimpleAPIApiProductManagementInterface

          /**
          * @inheritdoc
          */
          public function getProduct($sku)

          // add your logic
          return $sku;





        4. Add API interface.
          app/code/Milandev/SimpleAPI/Api/ProductManagementInterface.php.



          <?php
          namespace MilanDevSimpleAPIApi;

          interface ProductManagementInterface

          /**
          * GET for product api
          * @param string $sku
          * @return string
          */
          public function getProduct($sku);




        5. Add dependency class in the di.xml.app/code/Milandev/SimpleAPI/etc/di.xml.



          <?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="MilanDevSimpleAPIApiProductManagementInterface" type="MilanDevSimpleAPIModelProductManagement"/>
          </config>


        6. Test the API using rest-client by following the URL structure.
          http://exmaple.com/index.php/rest/V1/milandev-simpleapi/product/sku





        share|improve this answer













        Please follow the steps to create your own simple API.



        1. First, create a basic module.


        2. Add webapi.xml file to define the API URL, service class and methods.app/code/Milandev/SimpleAPI/etc/webapi.xml.



          <?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 method="GET" url="/V1/milandev-simpleapi/product/:sku">
          <service class="MilanDevSimpleAPIApiProductManagementInterface" method="getProduct"/>
          <resources>
          <resource ref="anonymous"/>
          </resources>
          </route>
          </routes>



        3. Add API class.
          app/code/Milandev/SimpleAPI/Model/ProductManagement.php.



          <?php
          namespace MilanDevSimpleAPIModel;

          class ProductManagement implements MilanDevSimpleAPIApiProductManagementInterface

          /**
          * @inheritdoc
          */
          public function getProduct($sku)

          // add your logic
          return $sku;





        4. Add API interface.
          app/code/Milandev/SimpleAPI/Api/ProductManagementInterface.php.



          <?php
          namespace MilanDevSimpleAPIApi;

          interface ProductManagementInterface

          /**
          * GET for product api
          * @param string $sku
          * @return string
          */
          public function getProduct($sku);




        5. Add dependency class in the di.xml.app/code/Milandev/SimpleAPI/etc/di.xml.



          <?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="MilanDevSimpleAPIApiProductManagementInterface" type="MilanDevSimpleAPIModelProductManagement"/>
          </config>


        6. Test the API using rest-client by following the URL structure.
          http://exmaple.com/index.php/rest/V1/milandev-simpleapi/product/sku






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jul 20 at 21:09









        Milan ChandroMilan Chandro

        1806 bronze badges




        1806 bronze badges



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f282480%2fi-am-new-here-i-want-to-know-how-can-i-create-my-own-simple-api%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form