How to Post Comments to a SharePoint Page Using the REST API
Question details
The user needs to programmatically post comments to a SharePoint Site Page utilizing 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.
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.
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.
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).
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`.
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"}`.
Send the POST request using a testing tool like Postman (with an appropriately registered SharePoint app) or Microsoft Power Automate.

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. Download WPS Office: Visit the official WPS website and download the free installation package.
- 2. Install and Launch: Follow the simple installation wizard and open the WPS Office suite.
- 3. Open Your Files: Seamlessly open, edit, and save your existing Office documents.

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.




