SharePoint Document Issues

How to Post Comments to a SharePoint Page Using the REST API

Huda QurayshiHuda Qurayshi Nov 2, 2026 870 views

Question details

The user needs to programmatically post comments to a SharePoint Site Page utilizing the REST API.

How to Post Comments to a SharePoint Page Using the REST API
Product
SharePoint
Device & OS
not provided
Scenario
Automating or extending SharePoint functionality by adding comments to specific site pages via API requests.
Observed behavior
Complete official documentation is difficult to find, leaving the user unsure of the exact endpoint URL, required headers, and metadata type needed for the JSON request body to successfully post the comment.
Before you start

Ensure you have the necessary permissions to edit the target SharePoint site and have generated a valid authentication token (such as a Bearer token) for your API requests.

Solution 1Recommended

Send a POST Request to the Site Pages Comments Endpoint

Construct a specific POST request using the Site Pages list title or GUID, and provide the correct metadata type and comment text in the payload.

To post a comment via the REST API, you must target the specific item ID within the 'Site Pages' list. The key to making the request successful is including the exact Microsoft SharePoint comment metadata type in your JSON request body.

1
Set up the API POST request

Configure your application or tool to point to the endpoint: `/_api/site/Lists/GetByTitle('Site Pages')/GetItemById({ItemID})/Comments` (replace `{ItemID}` with your actual page ID).

2
Configure request headers

Set up your request headers to match those used when creating a standard list item. This typically includes your Authorization header and `Accept: application/json;odata=verbose`.

3
Add the JSON payload

Include the following JSON in the body of your request, modifying the 'text' value as needed: `{"__metadata":{"type":"Microsoft.SharePoint.Comments.comment"},"text":"Your comment text here"}`.

4
Execute the request

Send the POST request using a testing tool like Postman (with an appropriately registered SharePoint app) or Microsoft Power Automate.

Send a POST Request to the Site Pages Comments Endpoint
Alternative Endpoint Configuration: You can also use the list's GUID in the URL instead of 'GetByTitle('Site Pages')' if that better fits your specific application architecture.
Free Microsoft Office alternative

Boost Your Productivity with WPS Office

While SharePoint and REST APIs handle complex web integrations, WPS Office provides a free, lightweight, and intuitive alternative for your everyday document processing needs. Enjoy seamless compatibility with Microsoft Office formats without the hefty resource requirements.

  1. 1. Download WPS Office: Visit the official WPS website and download the free installation package.
  2. 2. Install and Launch: Follow the simple installation wizard and open the WPS Office suite.
  3. 3. Open Your Files: Seamlessly open, edit, and save your existing Office documents.
Fully compatible with Microsoft Word, Excel, and PowerPoint file formats (.docx, .xlsx, .pptx).Lightweight architecture that opens documents instantly without hogging system resources.Free to download and use, featuring an intuitive tabbed interface for easy multitasking.Built-in PDF reader and editor for comprehensive document management beyond basic Office files.
microsoft office alternative - wps office

Frequently Asked Questions

Can I use Postman to test SharePoint REST API calls?

Yes, you can use Postman to test SharePoint REST API calls. However, you must ensure you have properly registered an app in SharePoint and granted it the necessary permissions to generate valid authentication tokens, otherwise the request will fail.

What metadata type is required to post a SharePoint comment via API?

The required metadata type in the JSON payload is 'Microsoft.SharePoint.Comments.comment'. Omitting this or using an incorrect type will result in a failed request.

Why am I getting access denied errors when posting comments?

Access denied errors usually occur due to missing or expired authentication tokens, or if the user account (or registered app) lacks 'Contribute' or 'Edit' permissions on the Site Pages list.