cancel
Showing results for 
Search instead for 
Did you mean: 

new empty carts for each rest request

Former Member
0 Kudos

Hi

I am trying to get the cart by REST call. though I am providing oauth token and setting JSESSIONID as cookie but each time I am getting a new empty cart instead of the saved cart.

Any help in this regard is appreciated.

Former Member
0 Kudos

Infact when I am calling the cart for first time I am getting an empty cnd after adding one product to cart ,then if I call view cart then I am getting all cart details which was added before and saved.

So if I want to view cart which earlier saved how can I do that through web service?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

can you post your code, an empty cart is always created when we call getCart(). We should always check if hasCart() is returning false to call getCart() in hybris. But you are saying you call a RESTful webservice, need a bit more details on it

Former Member
0 Kudos

Thanks Sunil,

I am calling cartFacade.getSessionCart() which is out of box code,but for me hasCart() is reurning false always.

Former Member
0 Kudos

Should be this - final CartData cartData = getCheckoutFacade().getCheckoutCart();

Can you please check this getSessionService().getAttribute("cart");

If this returns false always, that means that the cart is not being created... try logging in as a registered user and add a product to the cnd log out and login again...

p_ponali
Discoverer
0 Kudos

For RESTful webservices hybris is using Spring OAUTH2 concept for authentication. You need to send Oauth token. JSESSIONID will not work. That too you need to have commercewebservices and commercewebservicescommons as dependent modules.