Disclaimer: This is a user generated content submitted by a member of the WriteUpCafe Community. The views and writings here reflect that of the author and not of WriteUpCafe. If you have any complaints regarding this post kindly report it to us.

Gutenberg is a front-end or client-side application, so it runs on the developer’s browser. The block editor doesn’t have access to the server and database, which stores the WordPress pages and posts. So, to communicate with the server and send content updates, Gutenberg uses REST API and JSON.

Here’s how the communications between Gutenberg and REST API and JSON, work.

Client-Side Editing: When you use Gutenberg to create or edit content on your WordPress site, all the actions and changes you make are handled on the client side, within your web browser (like Google Chrome). This allows for a more dynamic and responsive user interface.

Communication with REST API: To fetch data, save changes, and perform various operations related to posts, pages, and other content types, Gutenberg communicates with the WordPress server via the REST API. It sends HTTP requests to specific REST API endpoints, which are URLs designed to provide access to WordPress data.

Data Transfer in JSON Format: The data transferred between Gutenberg and the server is formatted in JSON. JSON is a lightweight, human-readable data interchange format that is easy for both machines and humans to understand. Gutenberg sends content and metadata to the server in JSON format, and the website server responds with data in the same format.

Updating and Storing Changes: When you make changes to your content in Gutenberg, such as adding or editing blocks, those changes are serialized into JSON format and sent to the server via the REST API. The server processes the JSON data and updates the corresponding posts or pages in the database.

In a gist, JSON helps WordPress create a representation of content according to the schema defined by the WordPress REST API. After editing a post or page through the block editor, you click “Update” to save the changes. That prompts Gutenberg to send a request to the server for a response in JSON format.

This combination of technologies empowers users to create complex layouts, rich media content, and custom blocks with ease. All while maintaining a consistent and structured data format for efficient server-side processing.

Do you like Archit Prajapati's articles? Follow on social!


Welcome to WriteUpCafe Community

Join our community to engage with fellow bloggers and increase the visibility of your blog.
Join WriteUpCafe