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 all catalogs

GET /catalogs

Returns all catalogs.

Templating function?

Yes

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

Return product

GET /product/<productId>

Return the requested product and:

  • The list of prices.

  • The list of custom fields.

  • The list of categories.

  • The tax rate.

    Templating function?

    Yes

Return product price

GET /product/<productId>/price

Return the price of the product regarding the current date and the requested quantity (body of the request).

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

Delete cart item

DELETE /cart/item/<itemId>

Update the cart by deleting the given cart item.

The cart id is taken from the cookie.

Templating function?

No

Return cross-sell list

GET /cart/cross-sell

Return the cart cross-sell list of products.

The cart id is taken from the cookie.

Templating function?

Yes


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

Create wishlist item

POST /wishlist

Update the wishlist by adding the wishlist item present in the body of the request.

The wishlist id is taken from the cookie.

Templating function?

No

Delete wishlist item

DELETE /wishlist/item/<itemId>

Update the wishlist by deleting the given wishlist item.

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

Get specific order

GET /order/<orderId>

Get the requested order. Only return the order if the user id match with the session user id.

Does not work for the anonymous users.
Templating function?

Yes

Cancel order

PUT /order/<orderId>/cancel

Change the status of the order into CANCELLED if the user id match with the session user id.

Does not work for the anonymous users.
Templating function?

No

Feedback

Incubators

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the Shop module docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules