Is it possible to add custom data in magento 2 rest API?Getting full image url for products via REST APIMagento 2: REST API not returning data for orders using CRON?How to reduce the API response time using Magento-2Fetching all the cross sell product using rest apiMagento2: How to create custom API to get all product details of specific category?Create configurable product using rest api magento 2.2.6How to specific pass fields in custom rest api for get product InformationMagento 2 REST - SKU to items on cart totals API response is not available, How to get SKU in response APIMagento 2.3 - How to Get product-salable-quantity using REST API?Magento 2 : how to add additional information in rest API response?

How to play vs. 1.e4 e5 2.Nf3 Nc6 3.Bc4 d6?

Was Tyrion always a poor strategist?

How could the B-29 bomber back up under its own power?

What to call a small, open stone or cement reservoir that supplies fresh water from a spring or other natural source?

Are there historical examples of audiences drawn to a work that was "so bad it's good"?

Statue Park: Five

Do most Taxis give Receipts in London?

Eigenvalues of the Laplace-Beltrami operator on a compact Riemannnian manifold

What causes a person to remain in this world as a ghost?

Do 'destroy' effects count as damage?

Farthing / Riding

Requirement for splicing neutrals in a switch

Way of refund if scammed?

Circuit construction for execution of conditional statements using least significant bit

How do you cope with rejection?

Why does an injection from a set to a countable set imply that set is countable?

How to use Screen Sharing if I don't know the remote Mac's IP address

400–430 degrees Celsius heated bath

Separate the element after every 2nd ',' and push into next row in bash

How to become an Editorial board member?

Do seaplanes need to get clearance for takeoff?

Hotel booking: Why is Agoda much cheaper than booking.com?

Is my company merging branches wrong?

How could Dwarves prevent sand from filling up their settlements



Is it possible to add custom data in magento 2 rest API?


Getting full image url for products via REST APIMagento 2: REST API not returning data for orders using CRON?How to reduce the API response time using Magento-2Fetching all the cross sell product using rest apiMagento2: How to create custom API to get all product details of specific category?Create configurable product using rest api magento 2.2.6How to specific pass fields in custom rest api for get product InformationMagento 2 REST - SKU to items on cart totals API response is not available, How to get SKU in response APIMagento 2.3 - How to Get product-salable-quantity using REST API?Magento 2 : how to add additional information in rest API response?






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








2















I am using rest/all/V1/products/:SKU API for fetching product details.
Now issue I am facing is that i wanted to add one custom data in this API response.



I wanted to append "SellerID" custom data along with product details which I am getting from API.
I tried some solutions but not able to add it in the response.
Can any one help me to append seller id in product response ?










share|improve this question







New contributor



Magenewstudent is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    2















    I am using rest/all/V1/products/:SKU API for fetching product details.
    Now issue I am facing is that i wanted to add one custom data in this API response.



    I wanted to append "SellerID" custom data along with product details which I am getting from API.
    I tried some solutions but not able to add it in the response.
    Can any one help me to append seller id in product response ?










    share|improve this question







    New contributor



    Magenewstudent is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      2












      2








      2


      1






      I am using rest/all/V1/products/:SKU API for fetching product details.
      Now issue I am facing is that i wanted to add one custom data in this API response.



      I wanted to append "SellerID" custom data along with product details which I am getting from API.
      I tried some solutions but not able to add it in the response.
      Can any one help me to append seller id in product response ?










      share|improve this question







      New contributor



      Magenewstudent is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I am using rest/all/V1/products/:SKU API for fetching product details.
      Now issue I am facing is that i wanted to add one custom data in this API response.



      I wanted to append "SellerID" custom data along with product details which I am getting from API.
      I tried some solutions but not able to add it in the response.
      Can any one help me to append seller id in product response ?







      magento2 rest-api integration






      share|improve this question







      New contributor



      Magenewstudent is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share|improve this question







      New contributor



      Magenewstudent is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share|improve this question




      share|improve this question






      New contributor



      Magenewstudent is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      asked May 14 at 11:55









      MagenewstudentMagenewstudent

      111




      111




      New contributor



      Magenewstudent is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      New contributor




      Magenewstudent is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes


















          1














          For that purposes Magento proposed the ExtensionAttributes. Add your data to the product extension attributes in etc/extension_attributes.xml:



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
          <extension_attributes for="MagentoCatalogApiDataProductInterface">
          <attribute code="seller_id" type="string" />
          </extension_attributes>
          </config>


          write a plugin which add this value to the products data:



           /** @var MagentoCatalogApiDataProductExtensionInterface $extension */
          $extension = $item->getExtensionAttributes();
          if ($extension === null)
          $extension = $this->extensionFactory->create();

          $extension->setSellerId($item->getData('seller_id'));
          $item->setExtensionAttributes($extension);


          and you can see your data in the response in extension_attributes section of the product.






          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
            );



            );






            Magenewstudent is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f274540%2fis-it-possible-to-add-custom-data-in-magento-2-rest-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









            1














            For that purposes Magento proposed the ExtensionAttributes. Add your data to the product extension attributes in etc/extension_attributes.xml:



            <?xml version="1.0"?>
            <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
            <extension_attributes for="MagentoCatalogApiDataProductInterface">
            <attribute code="seller_id" type="string" />
            </extension_attributes>
            </config>


            write a plugin which add this value to the products data:



             /** @var MagentoCatalogApiDataProductExtensionInterface $extension */
            $extension = $item->getExtensionAttributes();
            if ($extension === null)
            $extension = $this->extensionFactory->create();

            $extension->setSellerId($item->getData('seller_id'));
            $item->setExtensionAttributes($extension);


            and you can see your data in the response in extension_attributes section of the product.






            share|improve this answer



























              1














              For that purposes Magento proposed the ExtensionAttributes. Add your data to the product extension attributes in etc/extension_attributes.xml:



              <?xml version="1.0"?>
              <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
              <extension_attributes for="MagentoCatalogApiDataProductInterface">
              <attribute code="seller_id" type="string" />
              </extension_attributes>
              </config>


              write a plugin which add this value to the products data:



               /** @var MagentoCatalogApiDataProductExtensionInterface $extension */
              $extension = $item->getExtensionAttributes();
              if ($extension === null)
              $extension = $this->extensionFactory->create();

              $extension->setSellerId($item->getData('seller_id'));
              $item->setExtensionAttributes($extension);


              and you can see your data in the response in extension_attributes section of the product.






              share|improve this answer

























                1












                1








                1







                For that purposes Magento proposed the ExtensionAttributes. Add your data to the product extension attributes in etc/extension_attributes.xml:



                <?xml version="1.0"?>
                <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
                <extension_attributes for="MagentoCatalogApiDataProductInterface">
                <attribute code="seller_id" type="string" />
                </extension_attributes>
                </config>


                write a plugin which add this value to the products data:



                 /** @var MagentoCatalogApiDataProductExtensionInterface $extension */
                $extension = $item->getExtensionAttributes();
                if ($extension === null)
                $extension = $this->extensionFactory->create();

                $extension->setSellerId($item->getData('seller_id'));
                $item->setExtensionAttributes($extension);


                and you can see your data in the response in extension_attributes section of the product.






                share|improve this answer













                For that purposes Magento proposed the ExtensionAttributes. Add your data to the product extension attributes in etc/extension_attributes.xml:



                <?xml version="1.0"?>
                <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
                <extension_attributes for="MagentoCatalogApiDataProductInterface">
                <attribute code="seller_id" type="string" />
                </extension_attributes>
                </config>


                write a plugin which add this value to the products data:



                 /** @var MagentoCatalogApiDataProductExtensionInterface $extension */
                $extension = $item->getExtensionAttributes();
                if ($extension === null)
                $extension = $this->extensionFactory->create();

                $extension->setSellerId($item->getData('seller_id'));
                $item->setExtensionAttributes($extension);


                and you can see your data in the response in extension_attributes section of the product.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered May 14 at 12:45









                Siarhey UchukhlebauSiarhey Uchukhlebau

                10.3k93058




                10.3k93058




















                    Magenewstudent is a new contributor. Be nice, and check out our Code of Conduct.









                    draft saved

                    draft discarded


















                    Magenewstudent is a new contributor. Be nice, and check out our Code of Conduct.












                    Magenewstudent is a new contributor. Be nice, and check out our Code of Conduct.











                    Magenewstudent is a new contributor. Be nice, and check out our Code of Conduct.














                    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%2f274540%2fis-it-possible-to-add-custom-data-in-magento-2-rest-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

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

                    Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

                    Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?