Hi,
I am trying to integrate Dynamics365 FO using oData rest endpoints in Java. I am not using any oData specific libraries and using simple HTTP client. For testing purposes, I am using Postman to fire the queries and get the response. My observation is that, I am not able to pass the apostrophe(') character in the oData query.
For example, I have a SecurityRole with SecurityRoleIdentifier as : ,:;\" ' ? | = + . ;; ??? $$ %% ^ &
I encode the above identifier using java.net.URLEncoder and I get the following output: %2C%3A%3B%5C%22+%27+%3F+%7C+%3D+%2B+.+%3B%3B+%3F%3F%3F+%24%24+%25%25+%5E+%26
When I execute: https://<BASE-URL>/data/SecurityRoles?$filter=SecurityRoleIdentifier eq '%2C%3A%3B%5C%22+%27+%3F+%7C+%3D+%2B+.+%3B%3B+%3F%3F%3F+%24%24+%25%25+%5E+%26' I am getting the following error: Syntax error at position 36 in 'SecurityRoleIdentifier eq ',:;\" ' ? | = + . ;; ??? $$ %% ^ &''.
I can see that the filter was correctly formed as expected. On the contrary, the following securityIdentifier GET was successful: !@#$%^&*()SPROLE-2 With SP Chars \\\\ \\\" ,/? <> {}
This identifier is only missing apostrophe and is successful What is the problem with the apostrophe? How it needs to be handled?
Also in this case:
,:;\" ? | = + . ;; ??? $$ %% ^ &
encoded to -- %2C%3A%3B%5C%22+%3F+%7C+%3D+%2B+.+%3B%3B+%3F%3F%3F+%24%24+%25%25+%5E+%26
I am getting empty result. What is the valid way to encode the values in filter string. I have taken the securityrole as an example but I am sure I will get same behavior for rest of dataentites. Please help!