Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

REST-API: Invalid webservice adapter specified. 
 
Christian Kehres
Jr. Member
 
Total Posts:  1
Joined:  2008-07-24
 

hey guys,

i would use the new REST-API, but it doesn`t work…

\\\"http://example.de/api/rest/products\\\" returns \\\"Invalid webservice adapter specified.\\\”.

Guests have access to all (for testing)

Magento Version 1.7.0.0
PHP 5.3.10

What could i do?

## update ##
api.php

// query parameter "type" is set by .htaccess rewrite rule
$apiAlias Mage::app()->getRequest()->getParam('type');

but $apiAlias is empty

.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]

edited api.php

// query parameter "type" is set by .htaccess rewrite rule
$apiAlias Mage::app()->getRequest()->getParam('type');
$apiAlias 'rest'

now it`s working fine

 
Magento Community Magento Community
Magento Community
Magento Community
 
riker09
Jr. Member
 
Avatar
Total Posts:  23
Joined:  2009-07-02
Braunschweig, Germany
 

Also I had to add another header ("Accept") to the PHP-example provided:

$headers = array('Content-Type' => 'application/json''Accept' => '*/*');

Without this header I was getting the error:

exception ‘Mage_Api2_Exception’ with message ‘Server can not understand Accept HTTP header media type.’

Please note: I’m working on Ubuntu 12.04 with a vanilla Apache & PHP stack.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jit_bec_2000
Jr. Member
 
Total Posts:  8
Joined:  2012-05-18
 

That means that your Redirect is not properly done and the program is not able to understand what kind of web service your are looking for.

Just add type=rest next to the url like this /api/rest/products?type=rest

and that would work

Thanks,
Abhijit

 
Magento Community Magento Community
Magento Community
Magento Community
 
jit_bec_2000
Jr. Member
 
Total Posts:  8
Joined:  2012-05-18
 

also in the header dont add Contet-Type as application/json.

just add Accept, application/json. as header .

Make sure that your header looks like

Accept: application/json when submitting the request.

You can of course see that in header tab of net panel in firebug

Thanks,
Abhijit

 
Magento Community Magento Community
Magento Community
Magento Community
 
brand22
Jr. Member
 
Total Posts:  3
Joined:  2013-03-11
 

hey guys,

i would use the new REST-API, but it doesn`t work…

 
Magento Community Magento Community
Magento Community
Magento Community
 
mani26
Jr. Member
 
Total Posts:  1
Joined:  2013-03-04
 

I am unable to GET Magento’s REST API to return JSON. I am hitting the server with this url:

http://<mage-server.domain.com>/api/rest/products?type=rest and sending header “Accept: application/json”.  But I am getting a 406 response saying

“An appropriate representation of the requested resource /api/rest/products could not be found on this server.
Available variants:

api.php , type text/html’

Any ideas? If I do not pass the Accept header, I get a 200 OK XML response which is good.

Do I need to install any JSON modules under my apache?

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
riker09
Jr. Member
 
Avatar
Total Posts:  23
Joined:  2009-07-02
Braunschweig, Germany
 

One more thing: I noticed some weird behavior on my dev system (Ubuntu 12.04 with default php + apache stack). I was able to access php files without adding the .php suffix to the url. Turns out the Apache option “MultiViews” was causing the webserver to serve the api.php file before the RewriteRule in the .htaccess file ever had the chance to get processed.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jadav1982
Jr. Member
 
Total Posts:  7
Joined:  2013-06-21
 

I am also getting same issue with IIS 7. I have write below code for URL Rewrite

<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=\"Remove index.php Rule\” stopProcessing=\"true\">
<match url=\".*\" ignoreCase=\"false\" />
<conditions>
<add input=\"{URL}\" pattern=\"^/(media|skin|js)/\" ignoreCase=\"false\" negate=\"true\" />
<add input=\"{REQUEST_FILENAME}\" matchType=\"IsFile\" ignoreCase=\"false\" negate=\"true\" />
<add input=\"{REQUEST_FILENAME}\" matchType=\"IsDirectory\" ignoreCase=\"false\" negate=\"true\" />
</conditions>
<action type=\"Rewrite\" url=\"index.php\" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

What I should add rule for REST API call in my code?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top