문제

I have a product with a very weird SKU (which is valid in Magento 2.3.2): enter image description here

Although, REST API requires using SKU as a part of URL to get the stock item info. How is it possible to use that SKU as a part of URL? If I don't encode it, it is, obviously, invalid URL. If I encode it, I'm getting an error:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
</body></html>

도움이 되었습니까?

해결책

I tried this in Postman with the SKU -

5%^&*[]}{+=""_@.#~?/\/||?|?><|>:ДЄ

and encoded it to -

5%25%5E%26%2A%5B%5D%7D%7B%2B%3D%22%22_%40.%23~%3F%2F%5C%2F%7C%7C%3F%7C%3F%3E%3C%7C%3E%3A%D0%94%D0%84

and used this URL to do a GET -

/rest/all/V1/stockItems/5%25%5E%26%2A%5B%5D%7D%7B%2B%3D%22%22_%40.%23~%3F%2F%5C%2F%7C%7C%3F%7C%3F%3E%3C%7C%3E%3A%D0%94%D0%84

and got back a correct request.

enter image description here

I couldn't make out from the image the last two characters in your SKU, so used two random cyrillic script characters. Best bet would be to make sure you are encoding it correctly, or provide the exact characters you're trying to use.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top