Inside the REST API, it is impossible to access a resource that requires an SKU if the SKU contains a forward slash.
{ "message": "Requested product doesn't exist" }Thanks for reporting - internal issue number is MAGETWO-60899.
It appears that this is an issue with Apache rather than Magento. You might have noticed that the 404 response codes are Apache generated instead of the usual Magento 404 pages. This is because, by default, forward slashes cannot be encoded in URLs without getting rejected. Add the option "AllowEncodedSlashes On" in either your global or virtual host config (or maybe in the Magento .htaccess, though this could be a security risk for users who would never make requests with encoded forward slashes).
This worked for me. Good luck.
@mplccp, thank you for your report.
We've created internal ticket(s) MAGETWO-60899 to track progress on the issue.
@AirmanAJK can you share your .htaccess or apache config? I'm trying to set AllowEncodedSlashes On, but this results in a 500 server error.
For those who can't wait to fix it I suggest temporary solution here:
https://magento.stackexchange.com/questions/142056/how-to-get-magento2-product-with-rest-if-sku-has-slash/201892#201892
It seems to be resolved somehow or version 2.1.9 is not affected. I've been able to successfully create and update a product with slashes in the sku. Encode the slash using '%2f'
For the update I used the following example API call:
PUT: /rest/all/V1/products/article%2fwith%2fslash%2fin%2fsku
JSON: {
"product": {
"status": 1,
"type_id": "simple",
"name": "Test article is updated..."
}
}
Working on this.
Hi @mplccp
The issue has been fixed and delivered in 2.2-develop branch. Will be available with upcoming patch release.
Has their been progress on this as still getting this issue in 2.2.3
We are still experiencing this issue in 2.3.3.
@stephenbori @JaredAllen1
Are you using Apache? If yes - did you tried to to set following option in virtualhost?
AllowEncodedSlashes NoDecode
Ref: https://github.com/magento/magento2/issues/13343#issuecomment-362783825
Most helpful comment
Working on this.