4

Posting product data via magento/api/rest/products returns a 404 but saves the data. Any ideas why this is occurring? If I do a get request I get a 200, this is only occuring on a post method.

So I looked in my logs, and I see an error after the post. File not found api/rest/products/27

Which is wrong is should be magento/api/rest/products/27

"POST /magento/api/rest/products/ HTTP/1.1" 404 1148 "

"GET /magento/api/rest/products/67 HTTP/1.1" 200 937 "

3 Answers 3

1

Possible duplicate of: REST API returns 404 [closed], unfortunately OP didn't accept answer so a close vote could not be initiated, answer below:

The reason for the 404 error message is likely a missing configuration in the apache2.con File (/etc/apache2/apache2.conf).

To enable rewrites it is necessary to add the option 'AllowOverride All'

 <Directory /var/www/html/magento/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
 </Directory>

Be careful with the directory path in the Tag 'Directory'. The path must match the location of your Magento installation on the file system. After changing the configuration restart the Apache server.

2
  • 2
    I tried this and it didn't work in resolving the issue.
    – Sean Keane
    Nov 10, 2014 at 14:12
  • 1
    Also its not a duplicate because he does not mention anything about the data actually saving. If I do a get request I get a 200 response.
    – Sean Keane
    Nov 10, 2014 at 16:11
1

This could be an old bug in the magento rest api. 2-3 years ago I tried to find out what exactly happens there.

As far as I had come, there were actually 2 requests internally dispatched. The first one with authentication which creates the new product, then a second one without authentication which returns an error. In my case I think it was a 405 response, but not 100% sure.

1
0

I faced the same problem and fixed like below

add below line to .htaccess in the magento root RewriteRule ^api/rest api.php?type=rest [QSA,L]

and apache2.conf with below code:

<Directory /var/www/html/magento/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    allow from all
    Require all granted
 </Directory>

This really fixed my issue.

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.