handling special characters in rest api

  • 15 January 2021
  • 4 replies

  • Anonymous
  • 0 replies

Hi everyone,


I believe this is my first time posting on here. I did not see anything related to this question so I am hoping I have not repeated anything or placed this in the wrong category.


We are having a Rest API issue. For the most part it is going well. We are using Epicor version 10.2.500.0 and Rest API v2.


One of the Part Nums includes the ‘/’ character. So when we try to call an endpoint such as: -


It errors

"HttpStatus": 400,
"ReasonPhrase": "REST API Exception",
"ErrorMessage": "OData path exception Bad Request - Error in query syntax. for the request https://OUR-TEST-PORTAL/api/v2/odata/ad-001/Erp.BO.PartSvc/PartPlants('ad-001','HALE','SSSHOTM/D')",
"ErrorType": "Epicor.RESTApi.ErrorHandling.ApiException"


In our programming code.. we have tried with PartNum ‘SSSHOTM/D’ as well as ‘SSSHOTM%2FD’  - we also tested this in the Epicor Rest Help Page - which appears to autocorrect it to ‘%2F’ as shown here:-




How do we go about solving this? It’s not that we just want to get information - we may need to create, alter, or delete content through the Rest API which require part nums with these characters. Obvously these will fail.


Just to be clear - the endpoint we are using is set up correct as we tested with other partnums without those unique characters and they are returning successfully.


Any help/advice is apprecated!! Thank you.

4 replies

Just providing an update.


We are still having problems with the above. We are also reviewing ways to work around this. One way is to call this endpoint, instead.



So it looks like url encoding (especially these two endpoints demonstrated below) do not work correctly. However, it seems to work fine for Parts.


This is the original url error as explained in main post



This one does not error but returns an empty array of content



This is a list of ‘special characters’ - FYI


I guess this is a bug in Epicor. If so - where would be the best place to report it?



Userlevel 3

Hi Martyn

You will need to submit a support ticket through the Epicor support portal (EpicCare) or via your Epicor partners support portal.


Hi Martyn

You will need to submit a support ticket through the Epicor support portal (EpicCare) or via your Epicor partners support portal.



Thank you -- I have created a ticket in EpicCare. I am happy to update/answer this topic when I have more info. Hopefully it will be useful for someone else in future.

Consider the following:

Instead of pulling the data directly, pull it via a BAQ.  In the BAQ, use a calculated value to substitute special characters with a custom string.  For example, Replace double and single quotes in part numbers which contain feet (‘) and inches (“) as “__DQuote__” and “SQuote__” respectfully.

E.g. Calculated value for a field name PartNum would be:
   replace(replace(PartNum, ‘’’’, ‘__SQuote__’), ‘”’, ‘__DQuote__’)

Note that to escape a single quote through, you must enter it twice (i.e. ‘’), then wrap the escaped single quote inside single quotes (i.e. ‘’’’).

The 50 character PartNum limit no longer applies because the string is outside of the DB storage string length.

On the receiving end, undo the replacement as needed using whatever tools logic is needed.  Note that this also brings the string back into its <=50 character limit (Epicor.Part.PartNum column limit is 50 characters).

This method allows any special character characters (subject to vary depending on platform) to be substituted; I’ve also on occasion used XML safe string values as the substitution string.

hope this helps.