When trying to access the serviceM8 API to search for customers I am using the following API request. The endpoint works but I am not sure how to handle special chars like ' or &.
API Documentation: https://developer.servicem8.com/docs/filtering
So if I call the following:
https://api.servicem8.com/api_1.0/company.json?%24filter=name%20eq%20"BENTON%"
Then I get following result (3 results including the ones with a special char.
[
{
"uuid": "60791e9a-8c5a-4e2a-aca5-f9625bef7d8b",
"edit_date": "2018-06-20 15:13:53",
"name": "BENTON'S TEST",
},
{
"uuid": "f722b374-e330-42f1-a09e-333b375af1ab",
"edit_date": "2018-07-05 09:46:30",
"name": "Benton's test",
},
{
"uuid": "df01f8ce-a1c9-438b-8954-297b113689ab",
"edit_date": "2018-07-05 17:02:43",
"name": "BENTONS TEST",
}
]
What I would like to try to filter for is for BENTON'S TEST so I try the following but that does not work.
https://api.servicem8.com/api_1.0/company.json?%24filter=name%20eq%20"BENTON'S%"
{
"uuid": "df01f8ce-a1c9-438b-8954-297b113689ab",
"edit_date": "2018-07-05 17:02:43",
"name": "BENTONS TEST",
}
My question is now, how can I filter in this API so that I can search for these special characters? like BENTON'S. If I use %27 to replace the ' sign that does not change the result as it seems the % sign in a filter is used as search parameter?
UPDATE
Reading this: https://community.dynamics.com/crm/b/mscrmshop/archive/2015/12/21/crm-odata-rest-queries-and-special-characters
I assume that the %27 is just not recognized and I should use two single quotes but that does not work either. If I search in the front end application, searching for ' does not work but when I use \' I can search for the correct names. But using that in my query string does not work.