1

In a sharepoint 2013 search rest url, I have multiple columns to filter on, but some of the values have spaces, but it seems spaces are used to delimit the filters. How can I encode spaces? See this for an example

This gets 0 record

http://mysite/_api/search/query?querytext='contenttype:News Page Channel:Corporate'&rowlimit=1

While both of these get 1

http://mysite/_api/search/query?querytext='Channel:Corporate'&rowlimit=1

http://mysite/_api/search/query?querytext='contenttype:News Page'&rowlimit=1

There is a space in News Page btw.

How can I encode it?

Thanks

0

I think the problem is not with encoding. Have you tried

http://mysite/_api/search/query?querytext='contenttype:News Page'&querytext='Channel:Corporate'&rowlimit=1
  • It doesn't work for me, how can you even have two parameters with same key? – omega Aug 31 '16 at 17:35
  • this has a double querytext declaration – Danny '365CSI' Engelman Aug 31 '16 at 19:53
0

I don't think the problem is with encoding. The easiest way to find out the correct format for your REST API URL is to download the SharePoint Search Query Tool.

enter image description here

Once you put the site url (step 1) and the authentication (step 2), you can put query text to the query box (step 3)

The red box on the top will be the REST API URL. As you can see, my content type also has a space.

0

Since you have this tagged as javascript too, I assume that is where you get this value. You can try:

encodeURI (string)
decodeURI (string)

I havent used the REST services before so I cannot attest to whether the encoding is actually your issue.

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.