When performing a GET operation in Odata and trying to filter the query using a value that contains special characters (such as "+" or "#"), no results are returned.
- SAP Cloud for Customer
Reproducing the Issue
- Log into the system.
- Perform an Odata query via URL. For example: myxxxxxx.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/ServiceRequestCollection?$filter=ID eq '123+456'
The query shows no results.
In Odata API, the special characters that are placed between single quotes are not encoded to the special character codes, so the API is not able to interpret it.
For queries that involve values with special characters, manual UTF8 encoding is required.
Following the example from the Reproducing the Issue section, the "+" symbol needs to be manually converted to the UTF8 code (which is "%2B"), and the correct URL would be the following:
myxxxxxx.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/ServiceRequestCollection?$filter=ID eq '123%2B456'
escape character, literal , KBA , LOD-CRM-INT-API , OData API (C4C Only) , How To