CoreShop icon indicating copy to clipboard operation
CoreShop copied to clipboard

Frontend API Bundle

Open dpfaffenbauer opened this issue 5 years ago • 13 comments

Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? yes

In order for CoreShop to be used in PWA/SPA we need a proper Frontend API.

  • Define what API Endpoints we need.

dpfaffenbauer avatar Feb 23 '19 14:02 dpfaffenbauer

Products and Categories

Method Description Parameters
GET All Products page or skip and limit
GET Single Product by ID productId
GET All Categories hierarchic with subcategories maxDepth
GET Single Category with its subcategories categoryId maxDepth
GET All products of a single category categoryId, maxDepth, page or skip and limit

Cart

Method Description Parameters
POST Add Product to the cart productId quantity
PUT Update CartItem cartItemId productId quantity
DELETE Remove CartItem from Cart cartItemId
GET Get the Cart cartIdentifier(optional)
POST Add a discount/voucher code to the cart code
DELETE Remove a discount/voucher code from the cart code

Checkout

Method Description Parameters
GET All Checkout steps
PUT Persist a cart step stepIdentifier
POST Create a new address for the customer -
DELETE Remove an address of the customer addressId

davidhoeck avatar Feb 24 '19 09:02 davidhoeck

Cart

  • Add multiple items

Index

  • Get Index Data (Data Hub Thing?), related: #692

solverat avatar Oct 04 '19 08:10 solverat

https://github.com/coreshop/FrontendApiBundle

dpfaffenbauer avatar Oct 10 '19 09:10 dpfaffenbauer

Multiple ways of actually doing this:

  • Custom FrontendAPI Bundle with API Platform
  • Integration with DataHub

@davidhoeck you are working on something like this right?

dpfaffenbauer avatar Oct 05 '21 15:10 dpfaffenbauer

@dpfaffenbauer yes - but still under heavy development and we are trying to find the right architecture. problem is basically that datahub is not built for performance because schema cannot be cached and is initialized on every request

davidhoeck avatar Oct 05 '21 16:10 davidhoeck

Will you open source what you have?

dpfaffenbauer avatar Oct 06 '21 05:10 dpfaffenbauer

@davidhoeck can we fix the "not built for performance" upstream? I'd expect them to cache metadata in prod, same as any other integration.

dkarlovi avatar Dec 13 '21 08:12 dkarlovi

@dkarlovi nope they don't. the schema get's initialized every time. when you take a look at a data hub request with blackfire, you see that the graph (queries + mutations) is built basically every request. I tried to implement a cache layer, but there was a loss of the resolver information.

davidhoeck avatar Dec 13 '21 09:12 davidhoeck

@dpfaffenbauer yep, but we will migrate it to coreshop 3 before that.

davidhoeck avatar Dec 13 '21 09:12 davidhoeck

@davidhoeck that's unfortunate. I'll check it out in Blackfire, thanks for the hint! :beers:

dkarlovi avatar Dec 13 '21 09:12 dkarlovi

Note for the above list, "All products" (and basically any listing) should by default support search, filter and sort params.

dkarlovi avatar Dec 13 '21 09:12 dkarlovi

@dkarlovi well, product listing is handled by the native data hub listing. CoreShop Index is a little bit more complex to use and we did not have implement it yet.

davidhoeck avatar Dec 13 '21 09:12 davidhoeck

We actually have a very custom Elasticsearch based Index which uses the Coreshop interfaces, but implements the search & filter stuff on our own. Not sure this would work by default via the Datahub feature, I'd expect it to be more tightly linked to Pimcore's implementation and database (which here doesn't exist).

I didn't look into it, but wanted to note listings should expect to accept filters, search and sort related params, for completeness sake.

dkarlovi avatar Dec 13 '21 09:12 dkarlovi