Rest APIs for fetch the Basket

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
traiyani75
Advanced
Posts: 114
Joined: 08 Nov 2019, 11:56

Rest APIs for fetch the Basket

Post by traiyani75 » 30 Nov 2019, 07:23

Hello,

We have questions related to baskets operations.
First, Here we can add products to the basket without user login using the following API
URL: { basket_url }?id=abc123&related=product

Request : {"data":[{"attributes":{"product.id": 18,"quantity": 1}}]}
----
Now, we need to fetch this basket product again, We checked the documentation that we can use URL which coming on OPTIONS request (response.meta.resources['basket']). But how do we get data for the user who just added products in the basket? Do we need to pass any token or id with the URL?

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Rest APIs for fetch the Basket

Post by aimeos » 30 Nov 2019, 18:54

You get the basket content back if you add something to the basket and you can always fetch the basket using the basket endpoint listed in the OPTIONS response. The basket content is session based which means you usually need to pass the session cookie along with your request.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

traiyani75
Advanced
Posts: 114
Joined: 08 Nov 2019, 11:56

Re: Rest APIs for fetch the Basket

Post by traiyani75 » 02 Dec 2019, 05:28

Thanks for the answer.
This session will generate for login user if I am not wrong, but we are allowing a user to add products into the basket without login too. Then how do we handle sessions for those users?

And how to get session tokens in rest api calls. ?

traiyani75
Advanced
Posts: 114
Joined: 08 Nov 2019, 11:56

Re: Rest APIs for fetch the Basket

Post by traiyani75 » 02 Dec 2019, 05:46

And we are using this on the mobile side. How do we use the session ?

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Rest APIs for fetch the Basket

Post by aimeos » 03 Dec 2019, 08:55

As you are using Laravel as framework for Aimeos, you can use the standard Laravel means for session and authentication, e.g.
https://laravel.com/docs/6.x/api-authentication
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply