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 NONCE Used - caused by redirection after the product is added
 
danielsampson
Jr. Member
 
Total Posts:  2
Joined:  2012-10-18
 

I am finally getting to the bottom of my NONCE used message. The Apache logs have been very helpful.

After the product is added the API appears to redirect to the original URL e.g ‘http://yourhost/api/rest’ with the ID of the added product appended to it ‘http://yourhost/api/rest/14’. This is why I am receiving the NONCE used and explains how the product is being added despite this error.

Any input would be appreciated!

 
Magento Community Magento Community
Magento Community
Magento Community
 
FloSys
Jr. Member
 
Total Posts:  7
Joined:  2012-09-25
 

hi

can you create a new product in a new empty shop with rest api? And than the redirection ?

best regards
flo

 
Magento Community Magento Community
Magento Community
Magento Community
 
davoau
Jr. Member
 
Total Posts:  1
Joined:  2012-11-12
 

Did you manage to get anywhere with this? I am using Java Signpost as the Oauth signing mechanism and Magento 1.7.0.2.

I have the same issue, the product is created, however It returns the nonce_used error.

I can’t see any redirects in the apache logs.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mrademacher
Jr. Member
 
Total Posts:  1
Joined:  2011-10-10
 

Did anyone solve this problem?  I’m using a fresh instal of 1.7.0.2 and pretty much copied and pasted code from magento’s example to add a product and I’m getting the same error NONCE USED because it appears to be attempting to add the product in twice.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ericno7
Jr. Member
 
Total Posts:  2
Joined:  2010-11-05
 

Did anyone get any further with this. Ive tried using a php rest client & firefox restclient add on and get the same result so its seems to be a bug within Magento.

If you catch the exception in the PHP script you can still process multiple requested , i.e. add multiple product no problem but its incredibly slow and obviously the error is causing most of this delay.

Would be useful to get this function working correctly.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lesiu141
Jr. Member
 
Total Posts:  1
Joined:  2013-06-20
 

I’m joining the team.
Does anyone resolve this issue?
Lukasz

 
Magento Community Magento Community
Magento Community
Magento Community
 
drew.gillson
Jr. Member
 
Total Posts:  15
Joined:  2009-07-30
 

For those of you looking for a solution, my research might help you: http://www.drewgillson.com/blog/update-magento-product-curl-rest-api/

 
Magento Community Magento Community
Magento Community
Magento Community
 
soren_1
Jr. Member
 
Total Posts:  1
Joined:  2010-07-14
 

I created an issue report here: http://www.magentocommerce.com/bug-tracking/issue?issue=16036
Redirects are not allowed in an Oauth request.

In the meanwhile I added the following in the beginning of api.php:

if($_SERVER['REQUEST_METHOD'== 'GET'{
    
die();
}

of course the Oauth request must then be a POST request.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sierrahotel
Jr. Member
 
Total Posts:  3
Joined:  2011-04-24
 

In Mage_Api2_Model_Server, add :

const HTTP_ACCEPTED 202;

In Mage_Api2_Model_Resource, line 227 approx, locate

$this->getResponse()->setHeader('Location'$newItemLocation);

and insert just after this:

$this->getResponse()->setHttpResponseCode(Mage_Api2_Model_Server::HTTP_ACCEPTED);

Ref: Wikipedia “HTTP Location”:

The HTTP Location header field is returned in responses from an HTTP server under two circumstances:

1. To ask a web browser to load a different web page. In this circumstance, the Location header should be sent with an HTTP status code of 3xx.
2. To provide information about the location of a newly created resource. In this circumstance, the Location header should be sent with an HTTP status code of 201 or 202.

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