Try our conversational search powered by Generative AI!

Service API: Error when getting entry code that includes forward slash

Fixed in

EPiServer.ServiceApi 5.4.2

(Or a related package)

Created

Oct 18, 2019

Updated

Jan 08, 2020

State

Closed, Fixed and tested


Description

Some Commerce Products have a forward slash in the SKU. Some customers use the product SKU as the product “Code” in the Episerver catalog. These customers cannot figure out how to access the product using the Service API if the product “Code”
includes a forward slash.
Examples:
You create a product with the Code “123”. You can retrieve the product via the Service API on the following endpoint:

GET: baseUrl/episerverapi/commerce/entries/123

However, if you change the product Code from 123 to 123/456, the following call does not work (404 error) due to the forward-slash in the URL (obviously breaking the routing):

GET: baseUrl/episerverapi/commerce/entries/123/456

One might assume that encoding the forward slash in the product Code to “%2F” would resolve the issue. For example:

GET: baseUrl/episerverapi/commerce/entries/123%2F456

But that does not work (again, a 404 not found error) is returned.