Git Product home page Git Product logo

Comments (6)

ahinkle avatar ahinkle commented on August 23, 2024 1

Yeah, good point. I think for now I'll keep the current implementation and leave it up to the users to pass it how they would like in their own applications. Just feels a bit finicky and could break some applications.

from magento-laravel-api.

ahinkle avatar ahinkle commented on August 23, 2024

Interesting - haven't come across that before.

Are you able to access the API endpoint(s) by accessing the API directly? e.g. via curl: rest/default/V1/products/some-product-with-a/-slash

I came across this article but it's ages old: https://magento.stackexchange.com/questions/142056/how-to-get-magento2-product-with-rest-if-sku-has-slash

from magento-laravel-api.

jeroen-hso avatar jeroen-hso commented on August 23, 2024

I found the same issue on stackexchange.

This doesn't work:

     public function getProduct($sku) { // $sku = '1234/56'
         $result = $this->api('products')->show($sku); 
         if ($result->status() == 200) {
             return $result->json();
     }

And this works:

     public function getProduct($sku) { // $sku = '1234/56'
         $sku = urlencode($sku);
         $result = $this->api('products')->show($sku); 
         if ($result->status() == 200) {
             return $result->json();
     }

from magento-laravel-api.

ahinkle avatar ahinkle commented on August 23, 2024

@jeroen-hso ,

Are there any problems with URL encoding as the default on SKUs? I'm open to the idea if not :)

from magento-laravel-api.

jeroen-hso avatar jeroen-hso commented on August 23, 2024

@ahinkle sorry for the late reply. I don't think there are any problems when the URL for SKU is default encoded. But I'm not a expert on this.

from magento-laravel-api.

jeroen-hso avatar jeroen-hso commented on August 23, 2024

@ahinkle just found out one problem, when the SKU contains a space URL encoding changes the space to + (I don't understand why suppliers create SKU's with spaces)

https://stackoverflow.com/questions/5572718/php-convert-spaces-in-string-into-20 --> rawurlencode()

from magento-laravel-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.