I am making a Post call to the SharePoint Search API. I would like that call to only search two locations, a document library and the Site Pages library. I have tried all sorts of different syntax to try and get this to work, but every time I get a 400 error code in my console and the call fails.

The code I am currently using looks like the following:

public searchByTerm(searchTerm) : Promise<ISearchResult[]>
    let refinementFilters: string = "(or(Path:'" + this.siteUrl + "/documents/*',Path:'" + this.siteUrl + "/sitepages/*'))";

    const requestData =  {
        '__metadata' : {'type' : 'Microsoft.Office.Server.Search.REST.SearchRequest'},
        'Querytext' : `${searchTerm} site:"${this.siteUrl}"`,
        'SelectProperties' : {
        'results' : [
                'Title','ModifiedOWSDATE','AuthorOWSUSER','Path','RefinableString07','RefinableString09', 'FileName', 
    'RowLimit' : '20',
    'Refiners': 'Path',
    'RefinementFilters': {refinementFilters}
    let promise: Promise<ISearchResult[]> = new Promise<ISearchResult[]>((resolve, reject) => {
        .then ((result) =>{

    return promise;

If I run it without the Refiners and Refinement Filters parameters it runs fine, returning content correctly, but of course from locations other than those I want to search.

Can anyone advise how I should construct my Refinement Filters to achieve what I'm trying to achieve

Many thanks

  • Anyone able to help? – Gerry Jun 30 at 18:19

Your Answer

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

Browse other questions tagged or ask your own question.