2

I am having issue while searching using query text in a specific site. When I use following get query, https://client.sharepoint.com/_api/search/query?querytext='vpn', I get results in the entire site of client.sharepoint.com I also get results when I search for term 'vpn' directly in site https://client.sharepoint.com/sites/SysDocs. Now I need to combine both. When I use https://client.sharepoint.com/_api/search/query?querytext='vpn+path:"https://client.sharepoint.com/sites/SysDocs"', it is not returning me results.

What should I change in the syntax for getting 'vpn' results in site https://client.sharepoint.com/sites/SysDocs ? Please advise !!

Thanks !!

6
  • 1
    can you try it as https://cl‌​ient.sharepoint.com/_api/search/query?querytext='(vpn)+AND+(path:https://client.sharepoint.com/sites/SysDocs)' and check ? Jan 7, 2018 at 17:09
  • Still getting same issue. No results returned.
    – user72980
    Jan 7, 2018 at 17:34
  • How about https://cl‌​ient.sharepoint.com/_api/search/query?querytext=‌​'vpn AND path:htt‌​ps://client.sharepoi‌​nt.com/sites/SysDocs‌​' ? It works at my end Jan 7, 2018 at 17:54
  • I am still getting no results. In SharePoint query search tool, my query becomes like this client.sharepoint.com/_api/search/…‌​ps:%2f%2fclient.sharepoi‌​nt.com%2fsites%2fSysDocs‌​' Not sure if I can pass you the screenshot but when I directly search vpn under the site on sharepoint, I get lot of results. So expecting this to return me results. I tried other search strings also but same result This is office365 sharepoint api calls.
    – user72980
    Jan 7, 2018 at 18:14
  • ok thats strange, i am using POSTMAN and its giving me correct results. Can you try hitting the query in the browser and check ? Jan 7, 2018 at 18:15

1 Answer 1

1

You should modify your endpoint url as below :

https://cl‌​ient.sharepoint.com/_api/search/query?
querytext=‌​'(vpn)+AND+(path:htt‌​ps://client.sharepoi‌​nt.com/sites/SysDocs‌​)'

or

https://cl‌​ient.sharepoint.com/_api/search/query?
querytext=‌​‌​'vpn AND path:htt‌​ps://client.sharepoi‌​nt.com/sites/SysDocs‌​'
1
  • Have posted it as answer. Please accept it by checking the checkbox below the button or as mentioned here :) Jan 8, 2018 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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