REST API
Once all of this is in place, the front end app can be created to query for products, add to shopping cart, checkout, create wish lists… by using the REST api.
- API Path
-
/shop/v1
Product
Return specific catalog
- GET
/catalog/<catalogId>
Return the requested catalog and:
-
The list of currencies
-
The category tree
-
The list of shipping methods
- Templating function?
-
Yes
Return all catalog products
- GET
/catalog/<catalogId>/products
Return all the catalog products.
Query string:
-
limit: Limit the number of results
-
offset: Index to return the results from
-
sort: Field to use for sorting and the order (ie: sort=date:asc, sort=date:desc)
Does not return linked objects. |
Return category and tree
- GET
/category/<categoryId>
Return the requested category and its tree of categories.
- Templating function?
-
Yes
Return all category products
- GET
/category/<categoryId>/products
Return all the category products.
Query string:
-
limit: Limit the number of results
-
offset: Index to return the results from
-
sort: Field to use for sorting and the order (ie:
sort=date:asc
,sort=date:desc
)
Does not return linked objects. |
- Templating function?
-
Yes
Return shipping method
- GET
/shipping/methods/<methodId>
Return the requested shipping method and its list of rates.
- Templating function?
-
Yes
Cart
Create cart
- POST
/cart
If the user is anonymous (unable to fetch the user from the underlying http session), then it creates an anonymous cart.
Otherwise, it create a cart linked to the user id.
Returns a cookie storing the cart id.
- Templating function?
-
No
Retrieve cart
- GET
/cart
Return the cart.
The cart id is taken from the cookie.
- Templating function?
-
Yes
Delete cart
- DELETE
/cart
Delete the cart
The cart id is taken from the cookie.
- Templating function?
-
No
Update cart
- POST
/cart/item
Update the cart by adding the cart item present in the body of the request.
The cart id is taken from the cookie.
- Templating function?
-
No
Update cart item quantity
- PUT
/cart/item
Update the cart by updating the cart item quantity (only field which can be updated).
The cart id is taken from the cookie.
- Templating function?
-
No
Wishlist
Create wishlist
- POST
/wishlist
If the user is anonymous (unable to fetch the user from the underlying http
session), then it creates an anonymous wishlist.
Otherwise, it create a wishlist linked to the user id.
Return a cookie storing the wishlist id.
- Templating function?
-
No
Retrieve wishlist
- GET
/wishlist
Return the wishlist.
The wishlist id is taken from the cookie.
- Templating function?
-
Yes
Delete wishlist
- DELETE
/wishlist
Delete the wishlist.
The wishlist id is taken from the cookie.
- Templating function?
-
No
Order
Create order
- POST
/order
Get the current cart, the billing/shipping addresses, the shipping methods, and convert them into an order.
- Templating function?
-
No
Get orders
- GET
/orders
Get the list of orders whose the user id match with the session user id.
Does not work for the anonymous users. |
- Templating function?
-
Yes