Fetching SKUs containing a “/” (forward slash character) from the /rest/v1/products/ REST API endpoint?

magento.stackexchange https://magento.stackexchange.com/questions/334816

Question

A lot of our SKUs have spaces and forward slashes in them (eg: "PRODUCT1-DARK BLUE" and "PRODUCT2-DARK/RED". I'm able to curl to the products with spaces via url encoding:

    # sample SKU: "PRODUCT1-DARK BLUE"
    # encoded: "PRODUCT1-DARK%20BLUE"
    > curl -X GET -H "Authorization: Bearer" "https://www.magentosite.com/index.php/rest/V1/products/PRODUCT1-Dark%20Blue"
    > returns data successfully

But unfortunately I can't seem to fetch any of our SKUs with the forward slash.  For example:

    # sample SKU: "PRODUCT2-DARK/RED"
    # encoded: "PRODUCT2-Dark%2FRed"
    > curl -X GET -H "Authorization: Bearer" "https://www.magentosite.com/index.php/rest/V1/products/PRODUCT2-Dark%2FRed"
    > returns "The requested URL was not found on this server." error

  I've tried encoding other variations ("PRODUCT2-DARK\/RED", "PRODUCT2-DARK//RED", and "PRODUCT2-DARK/RED") with no luck.  Any other ideas of something I can try?

Outside of changing our SKUs, is still there a way I can still try to GET/POST to our catalog product data containing forward slash characters in their SKU?  I know I can use products?&searchCriteria, however I need to POST and not just GET.

Thank you for any assistance!

Était-ce utile?

La solution

There was a similar question some years ago, here is the answer , I think it will help you.

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top