In this article, we will learn about various useful SharePoint Pages REST API Endpoints, meaning we can use these REST API Endpoints references while we work on the pages from Power Automate flow or any programming languages.
SharePoint Online is a powerful platform that allows organizations to collaborate, share documents, and manage content seamlessly. One of the key features of SharePoint Online is its robust set of APIs, including the Representational State Transfer (REST) API. REST APIs enable developers to interact with SharePoint Online programmatically, allowing for the creation, retrieval, updating, and deletion of various resources. In this article, we’ll explore some useful REST API endpoints for SharePoint Online pages and their practical usage.
Useful SharePoint Pages Rest API Endpoints
Following are some key useful REST API endpoints for SharePoint Online pages:
SharePoint REST API publish page
We can use the below REST API endpoint to publish a page in SharePoint Online:
Method: POST
URI: See below:
_api/web/GetFileByServerRelativeUrl('/sites/your-site-internal-name/SitePages/your-page.aspx')/Publish()
Example:
SharePoint REST API promote to news page
We can use the below REST API endpoint to promote a page to news in SharePoint Online:
Method: POST
URI: See below:
_api/SitePages/Pages(itemid)/PromoteToNews
Example:
Get SharePoint organization news site
We can use the below REST API endpoint to get all news sites from your organisation (tenant) in SharePoint Online:
Method: GET
URI: See below:
_api/OrgNews/SitesReference
Example:
SharePoint REST API checkout page
We can use the below REST API endpoint to checkout a page in SharePoint Online:
Method: POST
URI: See below:
_api/SitePages/Pages(itemid)/CheckoutPage
Example:
SharePoint REST API checkout page – Method 2
We can use the below REST API endpoint to checkout a page in SharePoint Online:
Method: POST
URI: See below:
_api/web/getfilebyserverrelativeurl('/sites/your-site-internal-name/SitePages/your-page.aspx')/CheckOut()
Example:
SharePoint REST API check-in page
We can use the below REST API endpoint to check a page in SharePoint Online:
Method: POST
URI: See below:
_api/web/getfilebyserverrelativeurl('/sites/your-site-internal-name/SitePages/your-page.aspx')/CheckIn(comment='Check-in comment',checkintype=1)
Example:
Read Also: How to Check Multiple Documents in Power Automate Flow.
SharePoint REST API get page content
We can use the below REST API endpoint to get a page content in SharePoint Online:
Method: GET
URI: See below:
_api/web/lists/GetByTitle('Site Pages')/items?$select=Title,CanvasContent1,FileLeafRef&$filter=FileLeafRef eq 'your-page.aspx'
Example:
SharePoint REST API get image properties
We can use the below REST API endpoint to get an image properties in SharePoint Online from a page:
Method: GET
URI: See below:
_api/web/GetFileByServerRelativePath(decodedurl='/sites/your-site-internal-name/SiteAssets/SitePages/your-page/your-image-name.extn')/Properties
Example:
SharePoint REST API create page from template
We can use the below REST API endpoint to create a page in SharePoint Online from a template:
Method: POST
URI: See below:
_api/web/GetFileByServerRelativeURL('/sites/your-site-internal-name/SitePages/Templates/your-template-page.aspx')/copyTo('/sites/your-site-internal-name/SitePages/your-new-page-name.aspx')
Headers: See below:
{ "Accept": "application/json;odata=verbose", "Content-Type": "application/json;odata=verbose" }
Example:
SharePoint REST API save page as draft
We can use the below REST API endpoint to save a page as a draft in SharePoint Online:
Method: POST
URI: See below:
_api/SitePages/Pages(item-id)/SavePageAsDraft
Headers: See below:
{ "Accept": "application/json;odata=verbose", "Content-Type": "application/json;odata=verbose" }
Body: See below:
{ "__metadata": { "type": "SP.Publishing.SitePage" }, "Your page content goes here" }
Example:
Summary: SharePoint REST API Pages
Thus, in this article, we have learned the below REST APIs with respect to page operation in SharePoint Online using Power Automate flow:
- How to publish a page in SharePoint Online using the REST API in Power Flow.
- How to promote a page to a news page in SharePoint Online using the REST API in Power Flow.
- How to get all organisational news sites in SharePoint Online using the REST API in Power Flow.
- How to check out a page in SharePoint Online using the REST API in Power Flow.
- How to check-in a page in SharePoint Online using the REST API in Power Flow.
- How to get page content from SharePoint Online using the REST API in Power Flow.
- How to get the image properties from SharePoint Online using the REST API in Power Flow.
- How to create a page from a template in SharePoint Online using the REST API in Power Flow.
- How to save a page as a draft copy in SharePoint Online using the REST API in Power Flow.
See Also: Power Platform Articles
You may also visit the Power Platform article hub, where you will see a bunch of articles focusing on Power Platform, like Power Automate, Power Apps, etc. All the articles are written with real-time project scenarios and troubleshooting techniques.
Â
If you found this article helpful and enjoyed it, please consider sharing it with your friends and colleagues. Please don’t forget to subscribe to our site to receive our latest articles directly in your inbox. 🙂
Â