Search code examples
c#magentomagento-soap-api

Getting Magento Version Using SOAP API V2 and C#


Background: I have built a tool that imports sales orders from Magento to a custom application. The function salesOrderList() worked fine on a customer's Magento Go store. Then it failed on another customer's store. The reason was the former store was version 1.6.x and the latter was 1.5.x. The function call returned two different data structures on the two versions (despite being the same API version, namely SOAP API V2), causing the problem. So I customized the tool to expect the 1.6.x data structure first and then fall back to 1.5.x if the former failed. Now, we have a new customer who seems to have Magento version 1.7. The data structure seems to have changed again in 1.7 for the same function (salesOrderList()).

Programmed Using: .NET (C#); Magento SOAP API V2

Question: Is there a function call to determine the Magento (1.5, 1.6, etc.) version of the store we are connecting to? I understand from another post that there is a MAGE::getVersion() call that they use in PHP, directly on the store (without SOAP API). Is there a .NET equivalent for this when using the SOAP API?

PS: I had posted the same question (a little less wordy though) as user1236916 because I had temporarily lost the login information for this account. My apologies for the repetition.

Thanks!


Solution

  • The Magento core API is known to be very limited in the calls it provides by default. There is no call that returns the Magento version out of the box.

    More infomation on the Magento core API can be found on the official Magento site.

    That being said the Magento API is designed to be extended and to do so is not overly difficult. You will need to create a Magento module that extends one of the core API resources (you will need to do this in PHP and have access to the Magento installation itself).

    See this post for more information on how to extend the V2 Magento API.

    In your extended API class simple create a function like so:

    public function getVersion()
    {
        // static method to return the Magento version within the app
        return Mage::getVersion();
    }