user1150331
user1150331

Reputation: 178

Apostrophe issue in url with OData

I am using oData protocol which add the filter criteria in the url

E.g. /api/restaurants/getall?$filter=substringof('macdonald',Name)

My problem when the value has apostrophe like (macdonald's) it will break the url

It works fine if I replace it with %26 like macdonald%26 but by adding s (macdonald%26s) the url will not work

any suggestions?

Upvotes: 1

Views: 2245

Answers (2)

IraW
IraW

Reputation: 53

I see this is an old post, but I'll point out that the arguments in the substringof expression are switched.

https://help.nintex.com/en-us/insight/OData/HE_CON_ODATAQueryCheatSheet.htm

This is aside from the apostrophe (single quote) problem.

Upvotes: 0

Vitek Karas MSFT
Vitek Karas MSFT

Reputation: 13320

When inside the quoted string a single quote can be escaped by doubling it. So in your case it would look like 'macdonald''s'.

Upvotes: 4

Related Questions