Rest APIs for fetch the Basket
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!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Advanced
- Posts: 114
- Joined: 08 Nov 2019, 11:56
Rest APIs for fetch the Basket
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?
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?
Re: Rest APIs for fetch the Basket
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, give us a star
If you like Aimeos, give us a star
-
- Advanced
- Posts: 114
- Joined: 08 Nov 2019, 11:56
Re: Rest APIs for fetch the Basket
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. ?
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. ?
-
- Advanced
- Posts: 114
- Joined: 08 Nov 2019, 11:56
Re: Rest APIs for fetch the Basket
And we are using this on the mobile side. How do we use the session ?
Re: Rest APIs for fetch the Basket
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
https://laravel.com/docs/6.x/api-authentication
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star