3

I am trying to extend the Magento's REST to have my own set of API.

I looked through the code and figured that there are _create(), _multiCreate(), update(), etc...

What's the difference between these methods in the V1.php file?

  • _create() and _multiCreate()
  • _update() and _multiUpdate()
  • _delete() and _multiDelete()

How can I know when I should use which of the 2 functions, the regular or the mutli one?

I couldn't find much documentation on the different methods used to create REST API in Magento.

  • Yeah, +1 for lacklustre Magento API docs! – Robbie Averill Jul 4 '16 at 8:48
0

Looking at code/core/Mage/Catalog/Model/Api2/Product/Website/Rest.php as an example, we can see _create and _multiCreate methods. The main difference between them is that _multiCreate is expecting an array of elements to create, much like passing this function a collection. In this example, we're setting the website that the product is related to, to a single website, or to multiple websites.

Looking at an example of update and multiUpdate within code/core/Mage/Catalog/Model/Product/Api/V2.php we can see that, again, multiUpdate is expecting an array of Product Ids (and Product Data). In this instance, you can see a subsequent call to the internal update function anyway within multiUpdate.

multiDelete doesn't appear to exist as a concrete implementation within the core code.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.