Skip to main content
added 658 characters in body
Source Link
BennKingy
  • 446
  • 1
  • 8
  • 32

I have a term store which has some terms "Defender", "Forward", etc. I then have a document library which uses those terms as meta data on the documents.

I want to use the sharepoint search api to retrieve any documents that have used the "Defender" meta data, like in the images below.

I have a function to grab the documents:

  public getDocuments() {
    axios 
    .get("https://bpk.sharepoint.com/_api/SEARCH DOCUMENTS VIA TERMS FROM THE TERM STORE",
            { params:{},
              headers: { 'accept': 'application/json;odata=verbose' }
            })
    .then(response => {
      this.setState({
        documents: response.data.d.results
      });
    })
    .catch(error => {
      console.log(error);
    });
  }

Can anybody please point me in the right direction for what the search api end point should be? <3

enter image description here

enter image description here

EDIT - This is how I achieved this!:

  public getDocuments() {

    axios
      .get("https://bpk.sharepoint.com/_api/search/query?querytext='owstaxIdPOsitionsx0020COlour:defender'&trimduplicates=true&rowsperpage=100&rowlimit=1000",
        { params:{},
          headers: { 'accept': 'application/json;odata=verbose' }
        })
      .then(response => {
        this.setState({
          documents: response.data.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.results
        });
      })
      .catch(error => {
        console.log(error);
      });

  }

I have a term store which has some terms "Defender", "Forward", etc. I then have a document library which uses those terms as meta data on the documents.

I want to use the sharepoint search api to retrieve any documents that have used the "Defender" meta data, like in the images below.

I have a function to grab the documents:

  public getDocuments() {
    axios 
    .get("https://bpk.sharepoint.com/_api/SEARCH DOCUMENTS VIA TERMS FROM THE TERM STORE",
            { params:{},
              headers: { 'accept': 'application/json;odata=verbose' }
            })
    .then(response => {
      this.setState({
        documents: response.data.d.results
      });
    })
    .catch(error => {
      console.log(error);
    });
  }

Can anybody please point me in the right direction for what the search api end point should be? <3

enter image description here

enter image description here

I have a term store which has some terms "Defender", "Forward", etc. I then have a document library which uses those terms as meta data on the documents.

I want to use the sharepoint search api to retrieve any documents that have used the "Defender" meta data, like in the images below.

I have a function to grab the documents:

  public getDocuments() {
    axios 
    .get("https://bpk.sharepoint.com/_api/SEARCH DOCUMENTS VIA TERMS FROM THE TERM STORE",
            { params:{},
              headers: { 'accept': 'application/json;odata=verbose' }
            })
    .then(response => {
      this.setState({
        documents: response.data.d.results
      });
    })
    .catch(error => {
      console.log(error);
    });
  }

Can anybody please point me in the right direction for what the search api end point should be? <3

enter image description here

enter image description here

EDIT - This is how I achieved this!:

  public getDocuments() {

    axios
      .get("https://bpk.sharepoint.com/_api/search/query?querytext='owstaxIdPOsitionsx0020COlour:defender'&trimduplicates=true&rowsperpage=100&rowlimit=1000",
        { params:{},
          headers: { 'accept': 'application/json;odata=verbose' }
        })
      .then(response => {
        this.setState({
          documents: response.data.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.results
        });
      })
      .catch(error => {
        console.log(error);
      });

  }
Source Link
BennKingy
  • 446
  • 1
  • 8
  • 32

Sharepoint search api to query documents by term store/set?

I have a term store which has some terms "Defender", "Forward", etc. I then have a document library which uses those terms as meta data on the documents.

I want to use the sharepoint search api to retrieve any documents that have used the "Defender" meta data, like in the images below.

I have a function to grab the documents:

  public getDocuments() {
    axios 
    .get("https://bpk.sharepoint.com/_api/SEARCH DOCUMENTS VIA TERMS FROM THE TERM STORE",
            { params:{},
              headers: { 'accept': 'application/json;odata=verbose' }
            })
    .then(response => {
      this.setState({
        documents: response.data.d.results
      });
    })
    .catch(error => {
      console.log(error);
    });
  }

Can anybody please point me in the right direction for what the search api end point should be? <3

enter image description here

enter image description here