I am new to Magento and I am having an issue with the use of the rest API.

I see some blogs/tutorials on the Internet where they create modules to use the web API. Also in magento2 API doc, they tell to create the webapi.xml file but it is not cleared/told that the file should be in a module or where exactly.

My question is do we need a module to use the Rest API? I didn't find out also the webapi.xml doc.

Btw I need the API to create new products in the store. I am using API of a website which gives me the images and name of products.

  • 2
    if you want to create your own api then you have to create webapi.xml but if you want to use magento's default then you can check this official doc. devdocs.magento.com/swagger – Rakesh Varma Nov 2 '18 at 10:53
  • for creating a webapi.xml you need to create a new module right? – Phoenix404 Nov 2 '18 at 10:54
  • 2
    yes in Vendor\Module\etc\webapi.xml and define your api and endpoint and class and method – Rakesh Varma Nov 2 '18 at 10:55
  • ok thanks, the first comment has answered my question. Could you tell me please also If I want to create new product and want to use the Magento's default api devdocs.magento.com/swagger then which route or URL or whatever should I choose among? – Phoenix404 Nov 2 '18 at 10:56
  • 2
    catalogProductRepositoryV1 and chose post method – Rakesh Varma Nov 2 '18 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.