3

I have configured the rest api in my localhost magento. When I Hit this url, http://localhost/magento/api/rest/products

The error is:

Invalid webservice adapter specified.

1
  • Yes, Thanks. Can u tell me where can we find & change this piece of code?
    – Sundar
    Commented Jun 30, 2015 at 4:11

2 Answers 2

2

This errors comes from here: \Mage_Api_Model_Server::initialize

You are using the rest adapter, which is defined in app/code/core/Mage/Api/etc/api.xml

    <adapters>
        <soap>
            <model>api/server_adapter_soap</model>
            <handler>default</handler>
            <active>1</active>
            <required>
                <extensions>
                    <soap />
                </extensions>
            </required>
        </soap>
        <soap_v2>
            <model>api/server_v2_adapter_soap</model>
            <handler>soap_v2</handler>
            <active>1</active>
            <required>
                <extensions>
                    <soap />
                </extensions>
            </required>
        </soap_v2>
        <soap_wsi>
            <model>api/server_wsi_adapter_soap</model>
            <handler>soap_wsi</handler>
            <active>1</active>
            <required>
                <extensions>
                    <soap />
                </extensions>
            </required>
        </soap_wsi>
        <xmlrpc>
            <model>api/server_adapter_xmlrpc</model>
            <handler>default</handler>
            <active>1</active>
        </xmlrpc>
        <default>
            <use>soap</use>
        </default>
    </adapters>

It might help to uncomment the line in .htaccess

############################################
## uncomment next line to enable light API calls processing

#    RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]

############################################
## rewrite API2 calls to api.php (by now it is REST only)

    RewriteRule ^api/rest api.php?type=rest [QSA,L]
1
  • Its already un commented. However it is throwing the same error. Commented Nov 27, 2016 at 13:38
1

The following solution fixed the issue for me.

If you're sure you have the following line uncomented in .htaccess:

RewriteRule ^api/rest api.php?type=rest [QSA,L]

...and it still does not work, then please be sure you have turned off MultiViews option in apache. For example:

<VirtualHost *:80>
    ServerName magento.local
    DocumentRoot "c:/www/magento"
    <Directory  "c:/www/magento/">
        Options +Indexes +Includes +FollowSymLinks -MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

Pay attention to -MultiViews above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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