Skip to content

Instantly share code, notes, and snippets.

@ivanweiler
Last active April 4, 2018 12:37
Show Gist options
  • Save ivanweiler/ce13fcbc973eb499e98ba06d650a0dd1 to your computer and use it in GitHub Desktop.
Save ivanweiler/ce13fcbc973eb499e98ba06d650a0dd1 to your computer and use it in GitHub Desktop.
Sylius API for React workshop

API reference

https://app.swaggerhub.com/apis/DeRain/sylius-shop_api/1.0.0#/

SyliusShopApiPlugin

Za sve koji testiraju na lokalnom Syliusu, da ovi APIji rade potrebno je u Sylius dodatno instalirati i konfiguirati SyliusShopApiPlugin:
https://github.com/Sylius/SyliusShopApiPlugin

Get products by taxon (category)

http://sylius.loc/shop-api/taxon-products-by-slug/books?channel=US_WEB
GET

&locale=en_US - optional
&page=2&limit=15

Same thing by taxon code:
http://sylius.loc/shop-api/taxon-products/books?channel=US_WEB&page=1
GET

Create new empty cart

http://sylius.loc/shop-api/carts/{cartId}
POST

{channel: 'US_WEB'}

Note: You need to generate unique cartId here yourself!! You decide what cartId will be, Sylius just remembers it. It should be something unique and imposible to guess, so don't use numeric ids or similar.

Returns: whole cart

Get existing cart

http://sylius.loc/shop-api/carts/{cartId}
GET

Returns: whole cart

Add to cart

http://sylius.loc/shop-api/carts/{cartId}/items
POST

{
  productCode: {productCode},
  quantity: 2,
}

Returns: whole cart, you have new cart item inside, it's id, etc.

Remove form cart

http://sylius.loc/shop-api/carts/{cartId}/items/{cartItemId}
DELETE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment