3

I am working on REST call. Everything works fine but my column contains special character &

So rest call like below works:

http://mydomain/_api/web/lists/GetByTitle('MyList')/Items?$filter=ColumnA eq 'DAD'

But below fails:

http://mydomain/_api/web/lists/GetByTitle('MyList')/Items?$filter=ColumnA eq 'D&D'

I dont want to change my column values now. Any solution?

| improve this question | | | | |
2

Use something like this:

"http://mydomain/_api/web/lists/GetByTitle('MyList')/Items?$filter=ColumnA eq " + encodeURIComponent("D&D")
| improve this answer | | | | |
0

Perhaps try putting the encoded value in directly. Have you tried something like this yet:

"http://mydomain/_api/web/lists/GetByTitle('MyList')/Items?$filter=ColumnA eq 'D%26D'"
| improve this answer | | | | |
0

encodeURIComponent should work. I have been using this method and it always works for me. You have to add D&D in quotes.

Try below URL. Just a little modification from @Gennady G's URL(i.e. quotes are added around the filter value) :

"http://mydomain/_api/web/lists/GetByTitle('MyList')/Items?$filter=Title eq '" + encodeURIComponent("D&D") + "'"

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.