0

Trough the rest API I'm trying to achieve that customers can save their cart/quote and have another new active one.

For that I'm trying to figure what PUT /V1/carts/mine does, as the docs states that it "Save quote".

But I cannot get it to work. It keeps returning "Invalid state change requested".. Every other /V1/carts/mine method works?

2 Answers 2

0

You are getting this exception message "Invalid state change requested" from \Magento\Quote\Model\QuoteRepository\Plugin\AccessChangeQuoteControl::beforeSave.

You have user permission issue for your access token. So you have to provide the access token which has permission to access that time end point. See details https://developer.adobe.com/commerce/webapi/get-started/authentication/

If you will use Integration token then you use any magento API end point https://devdocs.magento.com/guides/v2.3/get-started/authentication/gs-authentication-token.html#integration-tokens

1
  • I think there is something wrong with the logic and docs. The path /V1/carts/"mine", clearly gives the assumption, that you as logged in user, should be able to use all methods of that path. The PUT method only seams to be working with an admin token...
    – AP87
    Sep 25 at 6:28
0

Actually the custom REST API is throwing "Error message: Invalid state change requested" when customer does not pass the Authentication Token in headers. Magento 2 doesn't give access to Quote for users without authentication token.

Ref: https://magento.stackexchange.com/questions/217519/magento-2-error-message-invalid-state-change-requested#:~:text=Actually%20the%20custom%20REST%20API,for%20users%20without%20authentication%20token.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.