have you tried to enable magento rewrites in admin? to remove /index.php/
have you configured rest api in magento admin?
do you have correct client settings to check this?
Hi Daniel,
I’m having the same problem with Windows 7 and xampp Apache 2.2.21
Did you solve the problem?
I have the same configuration and data in Linux and is working fine. Maybe it’s an apache (windows) problem?
Hi, I have find the ‘problem’ !
It was hard to see but I think that maybe this is the same situation.
In apache included with xampp the configuration to virtualhosts inside the <Directory> tag include the option ‘MultiViews’ (!)
http://httpd.apache.org/docs/2.2/content-negotiation.html#multiviews
With this option the server try to match any name without extension to a file in the directory.
For example, if I put the url:
http://www.example.com/test
it will look for a file inside the folder with that name, and an extension knowed.
For example, test.php
This option precede the Rewrite conditions, so I had activated the rewrite log, and find that the url that was trying to match with the rewrite rule had ‘.php’ in the path.
I try with : http://www.example.com/api/rest
And in the log it was saying:
“strip per-dir prefix: C:/xampp/htdocs/api.php/rest -> api.php/rest” (look that is adding the .php extension because there is a api.php file in the folder)
“applying pattern ‘^api/rest’ to uri ‘api.php/rest’ “ So.. the rule don’t match!
Then, the solution to me was add the -MultiViews option in Directory configuration: “Options Indexes FollowSymLinks -MultiViews”
I put explicit -Multiviews because don’t know if it is defined in other place. With this, the api/rest redirection is working fine!
If you don’t want to deactivate the Multiviews option (why?) I think that you could moddify the rule (or add a new one) to match in this case. Something like :
RewriteRule ^api(\.php)?/rest api.php?type=rest [QSA,L]
This is wroking fine too.
Have diagnosed and found that the value of “type” not being passed on the api.php is consistent with what has been found above as well as others in the posts below.
I say almost as I am unable to get the Rewrite log written for debugging purposes. Have ensured that mod_rewrite is loaded. And this is how the /etc/apache2/conf.d/rewrite looks -
This seems indeed to be a bug at least in 1.7.0.2 version. I’m really looking forward to see this officially reported.
So far the “workaround” is to use the XML delivered version.
I’ve seen this problem on ubuntu-12.04.2 (x32); on ubuntu-12.10-server-amd64, there are even more issues: the api cannot even be enabled.
It seems that mod_rewrite is disabled. It can be enabled via the next command in Linux:
sudo a2enmod rewrite
In Windows you should open the configurable file Apache(httpd.conf) and find the line:
LoadModule rewrite_module modules/mod_rewrite.so
Then you should uncomment it. After these actions you should reload Apache.
You can get more information here:
http://www.magentocommerce.com/boards/viewreply/427178/
It seems that mod_rewrite is disabled. It can be enabled via the next command in Linux:
sudo a2enmod rewrite
In Windows you should open the configurable file Apache(httpd.conf) and find the line:
LoadModule rewrite_module modules/mod_rewrite.so
Then you should uncomment it. After these actions you should reload Apache.
You can get more information here:
http://www.magentocommerce.com/boards/viewreply/427178/
Sorry, this is not the case, at least in my situation
I heavily rely on rewrites for SEO…
This seems indeed to be a bug at least in 1.7.0.2 version. I’m really looking forward to see this officially reported.
So far the “workaround” is to use the XML delivered version.
I’ve seen this problem on ubuntu-12.04.2 (x32); on ubuntu-12.10-server-amd64, there are even more issues: the api cannot even be enabled.
If someone still has problems with this, I had the same problem and found out that the Accept header must include */*;q=0.8 in addition to application/json for it to work. Otherwise magento gets a fit and gives 406.
So header:
Accept: application/json,*/*;q=0.8
I suppose quality parameter can be anything < 1.
That’s why you get xml when not specifying Accept header since standard header includes application/xml