CMS Page REST API: How To Get Data of Magento 2 CMS Page Via API

Today, I am going to explain how you can load your Magento 2 website cms pages data on your other websites using CMS Page REST API.

By using default API to get Magento CMS Page content on the other website we can load all page data.

Magento 2 has an inbuilt rest API system. So we will use that default API, so then we do not need to create any files for the route URL and for the method.

<?xml version="1.0"?>
* Developer: Hemant Singh Magento Certified Developer
* Category: Wishusucess_CMSPage
* Website:
<routes xmlns:xsi=""
<!-- Cms Page -->
<route url="/V1/cmsPage/:pageId" method="GET">
<service class="Magento\Cms\Api\PageRepositoryInterface" method="getById"/>
<resource ref="Magento_Cms::page"/>

So at the end outcome of this article is to make you understand how you can get cms page content using REST API.


Step 1: Create Admin Access Token

Magento store verifies your authorization before giving you any response so if you will not authorize your request with an access token then the store will send you an error like you can't access the content because you are not an authorized user.

So, I have created an admin access token by using below admin REST API.

Method: POST

Content-Type: JSON

Payload: Admin Details (Admin User and Admin Password)


Admin Token Access in Magento 2

Now we have received an admin access token.

We will use that admin access token to authenticate our CMS API request.

So, in order to authenticate our request, we will add that admin token in the header content.


Step 2: CMS Page REST API Request

Now, I have sent a request to the Magento store by using the below Magento 2 CMS page API.

So our actual request with getting method looks like below url

Method: GET

Payload: None

Header: Authorization

Content-Type: application/JSON

Now with the above details send your CMS Page API request and your Magento store will send you a response with the content of that page.


Magento 2 CMS Page REST API

Here in the screenshot, you can see we have received all the details like page identifier, page title, page id, page content, etc.



It's very useful when we get access of our Magento 2 Page content and load on other website without any extra effort of coding or development of Magento CMS API.


Related Post:

CMS Block REST API: Get Magento 2 Block Content Using REST API

How To Call Magento 2 REST API For Customer Account Update


Recommended Post:

Magento Store: Best 36 Magento Websites Example in The World