1

Is there any rest API available to get the recent updates or news related to a site in SharePoint Online?

How To Read The SharePoint News Using Rest API In SPFx

I have found above post but it does not work for me as hitting the API's only gives error or irrelevant XML data.

So, I wanted to know if there is any way to get the news of SharePoint site using rest API ?

Updated:

API

_api/search/query?querytext='IsDocument:True AND FileExtension:aspx AND PromotedState:2

Error:

enter image description here

2
  • Can you please post the api url you are using and also please update post with the error you are seeing for better understanding. Oct 22, 2019 at 16:28
  • You need to make sure that you are setting the header to use odata v3, more info here; c-sharpcorner.com/article/… Aug 3, 2021 at 0:51

1 Answer 1

1

It looks like you are missing the ending single quote. Update the API call to:

_api/search/query?querytext='IsDocument:True AND FileExtension:aspx AND PromotedState:2'

Furthermore, you'll need to encode this to use it. Change your spaces to %20 and your single quotes to %27 like this:

_api/search/query?querytext=%27IsDocument:True%20AND%20FileExtension:aspx%20AND%20PromotedState:2%27

Your Answer

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

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