How to add product using REST api.
Getting below error –
Invalid auth/bad request (got a 500, expected HTTP/1.1 20X or a redirect)
Service temporary unavailable
I tried,
$oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'application/json', 'Accept' => 'application/json'));
For above error Solution
In admin,
System -> Permissions -> Users -> Rest Role -> Select Admin.
Best Answer
Step to Add Product Using REST Api
Step-1: Admin Configuration
Resource Access: Set :All Role Users: Select and admin user to whom you wish to provide Admin REST role
Set: Resource Access as "All"
Click on 'Add New' button, it will create a new Oauth consumer, note down the Consumer Key and Consumer secret.
Step-2 : script for create new product via REST API
create test_api.php file at your host example: location: http://yourdomain/test_api.php you have to post below fields in json encode format
see code sample at URL: http://devdocs.magento.com/guides/m1x/api/rest/introduction.html#root