SAP / spartacus

Spartacus is a lean, Angular-based JavaScript storefront for SAP Commerce Cloud that communicates exclusively through the Commerce REST API.
Apache License 2.0
738 stars 383 forks source link

use method "GET" to get a list of cms components (instead of POST) #1033

Closed WeizhengSap closed 5 years ago

WeizhengSap commented 5 years ago

Before, we use POST method, and put the list of cms component ids in request body. Smartedit team change the API, so in SPA, we also need to change the function.

For details, please check this: https://jira.hybris.com/browse/CMSX-8193

Changed in their M14 release

WeizhengSap commented 5 years ago

Using GET, component ids are appended into URL. If the URL length exceeds the limit, we have to use pagination to split the list of ids into several lists.

Xymmer commented 5 years ago

i've asked Tobias if we should build in a 2000-url limit into our function

bgambocjaviniar commented 5 years ago

PR GH-2430

hackergil commented 5 years ago

From @bgambocjaviniar:

NOT ABLE TO MERGE YET ---> Because it will break the develop branch

To be able to get a response, do the following:

Note our current environment do not have the new GET endpoint to get components by ids. These changes were released in wcms-module-19.05.0-M13

Xymmer commented 5 years ago

Now we have to do this for 1.0 launch as there is a problem with footer nav nodes HOWEVER can we set a flag to use one or the other, so 1811 still works? or we do a test if POST works and then fall back to GET? Check with Tobias on strategy.

Xymmer commented 5 years ago

this problem only affects when using smartedit.

but we still need to support both for a while.

talk to tobias about optimum solution.

options:

  1. at run time we detect that get doesn't work, and try post.
  2. there is a flag that tells our app to use post (default to get though).
bgambocjaviniar commented 5 years ago

UPDATE:

First of all, need to check what kind of error it will throw if one of them does not work and handle it to use the latter.

bgambocjaviniar commented 5 years ago

PR: GH-2430

bgambocjaviniar commented 5 years ago

For the QA:

RadhepS commented 5 years ago

There is an issue where when the GET request fails, the POST request for components is sent twice.

Originally posted by @RadhepS in https://github.com/SAP/cloud-commerce-spartacus-storefront/pull/2430#issuecomment-493567361

bgambocjaviniar commented 5 years ago

This will be fix in another ticket GH-2589 on Radhep's comment