Magento API Support

2019-07-20 18:02发布

问题:

I wonder if Magento provide API for following.

  1. Product Search.
  2. Add to Wishlist.
  3. View wishlist.
  4. Add to cart.

If it does provides API for above, Can any one share useful resource for it.

Thanks

回答1:

Product Search - NO.
Add to Wishlist - NO.
View wishlist - NO.
Add to cart - YES. see shoppingCartProductAdd for V2 and shopping_cart_product.add for V1



回答2:

Product Search. Add to Wishlist. View wishlist. Add to cart.

  • Product Search -> YES. Provided By magento2.
  • Add to Wishlist ->Not sure.
  • View wishlist -> Not sure
  • Add to cart -> YES. Provided By magento2.

Product search Api in Magento 2:

http://localhost/magento/rest/V1/products?searchCriteria[filter_groups][0][filters][1][field]=name&searchCriteria[filter_groups][0][filters][1][value]=%25<Name_Of_Product>%25&searchCriteria[filter_groups][0][filters][1][condition_type]=like

Add To Cart Api In Magento 2:

http://localhost/magento/rest/V1/carts/mine/items/

Note : Add Items to a cart of a registered customer. Two things we have to send in request, first token & second is cartItems detail. e.g. Body to be load in POST request

{"cartItem": {"sku": "WS1M-Orange-Flav","qty": 1,"quote_id": "4"}}



回答3:

Yes, Magento API is extendable using custom API models in your extension. We are frequently using Magento API extends for both inbound/outbound calls. Magento supports multiple API backends - Rest, SOAP, XML-RPC (v1), v2 only REST and SOAP if I remember correctly.

Magento 1

http://devdocs.magento.com/guides/m1x/api/rest/introduction.html http://devdocs.magento.com/guides/m1x/api/rest/Resources/resources.html

Magento 2 http://devdocs.magento.com/guides/v2.0/get-started/bk-get-started-api.html



标签: api magento