Magento 2 API – Get CMS Page Content

Hello Magento peeps!

In my last blog post on Magento 2 API, I provided complete tutorial to get all store ids, names, and codes through Magento 2 API. In case you missed it, you can read it at: Magento 2 API – Get All Store IDs, Names, and Codes.

So, let’s begin with Magento 2 API – Get CMS Page Content!

If you are developing a mobile shopping app on Magento 2, you may require to fetch the CMS pages and block to show it to the customers. Not to forget that Magento 2 is a robust eCommerce platform that provides plenty powerful APIs to harness the full potential of the platform. In this blog post, I will be showing you how to get CMS page content using Magento 2 APIs.

How to Get CMS Page & Block Content Using Magento 2 API?

In order to get CMS page and block content in Magento 2 through APIs, we need to perform a GET call to the respective path with the path KEY and variable ID. Let’s understand it in a more better way using examples.

Get CMS Page in Magento 2

We’ll be sending a GET request to store_url/cmsPage/:aboutCmsid with the required page id to get CMS page in Magento 2. Refer to the example provided below for more details.

Method: GET

URL: store_url/cmsPage/:aboutCmsid

Path Variables

  • VALUE: aboutCmsid
  • KEY: 5

Magento 2 API - Get CMS Page

Response:

The response returns the required page.

That’s it! This is how you can get cms page in Magento 2 through API.

Get CMS Block in Magento 2

In order to get the CMS block in Magento 2 through API, the client need to send a GET request to the store_url/cmsBlock/ and pass the variables in the parameters. Refer to the following example for more understanding.

Method: GET

URL: store_url/cmsBlock/:homeCmsid

Path Variables

  • KEY: homeCmsid
  • VALUE: 9

Magento 2 API - Get Block CMS

Response:

The request will return the required page details in the following format:

That’s it!

This is how you can get the CMS page and block in Magento 2 through APIs.

Conclusion

Magento 2 API is useful while developing another applications based on the platform. Magento 2 API CMS page & block content is useful to show the contents of the website on other applications. I hope this blog post will help you through the same.😊

In case you still have any queries or doubts regarding the solution provided, feel free to comment. I would be happy to help you.😇

Thanks for reading.🍀

◄ Magento 2 API – Get All StoresMagento 2 API – Get All Categories ►

5
(based on 5 Reviews)
Magento 2 API – Get CMS Page ContentAuthor Magento Badge

Jignesh Parmar

An expert in his field, Jignesh is the team leader at Meetanshi and a certified Magento developer. His passion for Magento has inspired others in the team too. Apart from work, he is a cricket lover.

Leave a Reply

Your email address will not be published.