{"id":26476,"date":"2022-12-05T13:04:25","date_gmt":"2022-12-05T21:04:25","guid":{"rendered":"https:\/\/coderpad.io\/?p=26476"},"modified":"2023-06-05T13:48:22","modified_gmt":"2023-06-05T20:48:22","slug":"an-introduction-to-stored-procedures-in-mysql","status":"publish","type":"post","link":"https:\/\/coderpad.io\/blog\/development\/an-introduction-to-stored-procedures-in-mysql\/","title":{"rendered":"An Introduction To Stored Procedures In MySQL"},"content":{"rendered":"\n<p>Many relational database management systems today can use stored procedures to execute tasks on the database.<\/p>\n\n\n\n<p>Stored procedures can be extremely useful in improving the efficiency of your database, saving you time, money, and lots of work-related headaches.<\/p>\n\n\n\n<p>So let\u2019s dive into exactly how they can help you.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is a stored procedure?<\/h2>\n\n\n\n<p>A stored procedure is a precompiled set of one or more SQL statements stored in a relational database management system that can be reused and shared by multiple programs for the purpose of executing tasks on the database.&nbsp;<\/p>\n\n\n\n<p>A stored procedure is usually assigned a name, e.g. <code>get_all_films<\/code>, and it can accept input and output parameters. They share some similarities with functions in procedural programming languages.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Advantages of stored procedures<\/h2>\n\n\n\n<p>Stored procedures have some great benefits. When used properly, they help you build powerful database applications and can also offer better performance, higher productivity, ease of use and increased scalability.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Performance<\/h3>\n\n\n\n<p>By grouping one or more SQL statements, you can execute the statements in a single call, eliminating network bottlenecks and roundtrips.&nbsp;<\/p>\n\n\n\n<p>Also, by moving procedures from the client to the server you are able to free the client\u2019s resources and take advantage of the server\u2019s computing resources where they will execute even faster. Additionally, stored procedures are compiled once, cached and stored in an executable form which makes them very quick and efficient whenever they are called, and as a result, lowers memory requirements.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Productivity and ease of use<\/h3>\n\n\n\n<p>Stored procedures boost productivity by helping you avoid redundant coding &#8211; you can group related tasks in a single place and call them whenever you want. They also extend the functionality of the RDBMS (Relational Database Management System), for example, by calling functions from your SQL statements.&nbsp;<\/p>\n\n\n\n<p>Furthermore, stored procedures can also be shared between multiple programs, letting you share business logic across applications.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Security<\/h3>\n\n\n\n<p>Stored procedures are secure. You can allow users to manipulate data through a stored procedure with predefined privileges.&nbsp;<\/p>\n\n\n\n<p>For example, you can allow users to access a stored procedure that updates a table but deny access to the table itself.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Managing stored procedures in MySQL<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\">Creating a stored procedure<\/h4>\n\n\n\n<p>To create a procedure, you can either make use of the MySQL command-line client or MySQL workbench. When creating procedures you wrap a series of SQL queries in the <code>CREATE PROCEDURE<\/code> statement. The syntax is as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql shcb-wrap-lines\">DELIMITER \/\/\n\n<span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">PROCEDURE<\/span> procedure_name(&#91;procedure_parameter&#91;,...]])\n<span class=\"hljs-keyword\">BEGIN<\/span>\nstatements;\n<span class=\"hljs-keyword\">END<\/span> \/\/\n\nDELIMITER ;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>When writing stored procedures, the general rule of thumb is to:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Assign a name for the procedure <em>(procedure_name)<\/em><\/li>\n\n\n\n<li>Specify a comma-separated list of parameters for the procedure, if any.<\/li>\n\n\n\n<li>Write your statements that will be executed by the procedure between the <code>BEGIN<\/code> and <code>END<\/code> block.<\/li>\n<\/ol>\n\n\n\n<p>Because the MySQL statements are usually terminated with the semi-colon <code>;<\/code>, we need to introduce a different delimiter <code>\/\/<\/code> using the <code>DELIMITER<\/code> statement. This will allow you to write the queries you want to execute in a familiar syntax.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Calling\/executing a stored procedure<\/h4>\n\n\n\n<p>The syntax for executing&nbsp; a stored procedure is simple. You use the <code>CALL<\/code> statement followed by the name of the stored procedure you want to execute:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql shcb-wrap-lines\"><span class=\"hljs-keyword\">CALL<\/span> procedure_name()<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h4 class=\"wp-block-heading\">Listing all created stored procedures<\/h4>\n\n\n\n<p>You can list all the procedures you have created for a particular database by running the following command:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql shcb-wrap-lines\"><span class=\"hljs-keyword\">SHOW<\/span> <span class=\"hljs-keyword\">PROCEDURE<\/span> <span class=\"hljs-keyword\">STATUS<\/span> <span class=\"hljs-keyword\">WHERE<\/span> db = database_name;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h4 class=\"wp-block-heading\">Deleting a stored procedure<\/h4>\n\n\n\n<p>To delete a stored procedure, you can call the <code>DROP PROCEDURE<\/code> statement followed by the name of the stored procedure you wish to delete:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql shcb-wrap-lines\"><span class=\"hljs-keyword\">DROP<\/span> <span class=\"hljs-keyword\">PROCEDURE<\/span> procedure_name;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h4 class=\"wp-block-heading\">Altering\/modifying an existing stored procedure<\/h4>\n\n\n\n<p>Currently, there is no statement available to change the parameters or SQL statements in the body of a stored procedure. Because of this reason, we can not alter the content of a stored procedure via the MySQL command-line (except for comments).&nbsp;<\/p>\n\n\n\n<p>However, you can do that via the MySQL Workbench GUI using the following steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>In the Navigator pane, right click the name of the stored procedure you want to modify, and select or click <strong>Alter Stored Procedure\u2026<\/strong><\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/d2h1bfu6zrdxog.cloudfront.net\/wp-content\/uploads\/2022\/12\/img_638d35835d988.png\" alt=\"An image showing stored procedures in the MySQL Workbench GUI Navigation pane.\" title=\"MySQL Workbench Altering Stored Procedure Step\"\/><figcaption class=\"wp-element-caption\"><em>Altering stored procedures in the MySQL Workbench GUI step 1.<\/em><\/figcaption><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li>In the window that opens, make your changes and click <strong>Apply<\/strong>:<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/d2h1bfu6zrdxog.cloudfront.net\/wp-content\/uploads\/2022\/12\/img_638d3585d3e81.png\" alt=\"An image showing the stored procedure edit window in MySQL Workbench\" title=\"Altering a Stored Procedure in the MySQL Workbench GUI step 2\"\/><figcaption class=\"wp-element-caption\"><em>Altering a Stored Procedure in the MySQL Workbench GUI step 2<\/em><\/figcaption><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Putting it together<\/h4>\n\n\n\n<p>Let us create a stored procedure using what we learned above. Our first stored procedure example is fairly simple, it fetches the list of films in our database when called.<\/p>\n\n\n\n<p>Before we can create a procedure though, we need to tell MySQL to use the database we would like to create the procedure in. In this guide, I will be using the famous <a href=\"https:\/\/dev.mysql.com\/doc\/sakila\/en\/sakila-installation.html\" target=\"_blank\" rel=\"noopener\"><code>sakila<\/code> database<\/a>, available in the MySQL documentation website.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql shcb-wrap-lines\"><span class=\"hljs-keyword\">USE<\/span> sakila;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The following lines will create a stored procedure named <code>get_all_films<\/code> in the <code>sakila<\/code> database:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql shcb-wrap-lines\">DELIMITER \/\/\n\n<span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">PROCEDURE<\/span> get_all_films()<span class=\"hljs-keyword\">BEGIN<\/span>\n<span class=\"hljs-keyword\">SELECT<\/span> * <span class=\"hljs-keyword\">FROM<\/span> film;\n<span class=\"hljs-keyword\">END<\/span> \/\/\n\nDELIMITER ;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The following line will then execute the stored procedure and return all the films in the database:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql shcb-wrap-lines\"><span class=\"hljs-keyword\">CALL<\/span> get_all_films();<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>By defining our film fetching logic in a stored procedure, we can execute the same logic or tasks repeatedly by simply calling <code>get_all_films()<\/code>. It gets even better when we need to do more complex tasks in a single call as you will see in the next example.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using parameters in stored procedures<\/h2>\n\n\n\n<p>MySQL stored procedures support three types of parameters:<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1.&nbsp; The <code>IN<\/code> parameter<\/h4>\n\n\n\n<p>This parameter works just like function parameters found in many programming languages like JavaScript, Python, etc. <code>IN<\/code> parameters are the default method to pass values that will be used by the statements in a stored procedure. The value of an <code>IN<\/code> parameter can be passed as values in the statements you write in a stored procedure.<\/p>\n\n\n\n<p>The value of an <code>IN<\/code> parameter is always protected, this means that when you modify the value of the parameter anywhere in the body of the stored procedure, the original value remains unchanged.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2. The <code>OUT<\/code> parameter<\/h4>\n\n\n\n<p>The <code>OUT<\/code> parameter is used by the calling program, most times the result of the statements you run in the stored procedure can be stored as a value in the <code>OUT<\/code> parameter and can then be retrieved later. The <code>OUT<\/code> parameter\u2019s original value can also be modified inside the stored procedure.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">3. The <code>INOUT<\/code> parameter<\/h4>\n\n\n\n<p>The <code>INOUT<\/code> parameter combines the functionality of the <code>IN<\/code> and <code>OUT<\/code> parameter types. This means that it can be used for passing arguments into the stored procedure and its value can also be retrieved by the calling program.<\/p>\n\n\n\n<p>The stored procedure we ran above lacked parameters, so let us create another one that has them so that we can add a bit more enhanced functionality. Let&#8217;s say we want to find all films that are in stock in our database; we can add some parameters that can be used in dynamically filtering the data for this particular attribute. This is what the stored procedure would look like:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql shcb-wrap-lines\">DELIMITER \/\/\n\n<span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">PROCEDURE<\/span> <span class=\"hljs-string\">`film_in_stock`<\/span>(<span class=\"hljs-keyword\">IN<\/span> p_film_id <span class=\"hljs-built_in\">INT<\/span>, <span class=\"hljs-keyword\">IN<\/span> p_store_id <span class=\"hljs-built_in\">INT<\/span>, <span class=\"hljs-keyword\">OUT<\/span> p_film_count <span class=\"hljs-built_in\">INT<\/span>)\n<span class=\"hljs-keyword\">BEGIN<\/span>\n    <span class=\"hljs-keyword\">SELECT<\/span> inventory_id\n    <span class=\"hljs-keyword\">FROM<\/span> inventory\n    <span class=\"hljs-keyword\">WHERE<\/span> film_id = p_film_id\n    <span class=\"hljs-keyword\">AND<\/span> store_id = p_store_id\n    <span class=\"hljs-keyword\">AND<\/span> inventory_in_stock(inventory_id);\n\n    <span class=\"hljs-keyword\">SELECT<\/span> <span class=\"hljs-keyword\">COUNT<\/span>(*)\n    <span class=\"hljs-keyword\">FROM<\/span> inventory\n    <span class=\"hljs-keyword\">WHERE<\/span> film_id = p_film_id\n    <span class=\"hljs-keyword\">AND<\/span> store_id = p_store_id\n    <span class=\"hljs-keyword\">AND<\/span> inventory_in_stock(inventory_id)\n    <span class=\"hljs-keyword\">INTO<\/span> p_film_count;\n<span class=\"hljs-keyword\">END<\/span> \/\/\n\nDELIMITER ;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In the example above, we introduced three parameters using two of the parameter types &#8211; <code>IN<\/code> and <code>OUT<\/code>:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>p_film_id<\/code> defines the variable for the film\u2019s id<\/li>\n\n\n\n<li><code>p_store_id<\/code> defines the variable for the store\u2019s id<\/li>\n\n\n\n<li><code>p_film_count<\/code> will hold the total number of films that were found in the inventory using the filters passed.<\/li>\n<\/ol>\n\n\n\n<p>We would call the procedure by passing the required arguments as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql shcb-wrap-lines\">mysql&gt; <span class=\"hljs-keyword\">CALL<\/span> film_in_stock(<span class=\"hljs-number\">1<\/span>, <span class=\"hljs-number\">1<\/span>, @p_film_count);\n+<span class=\"hljs-comment\">--------------+<\/span>\n| inventory_id |\n+<span class=\"hljs-comment\">--------------+<\/span>\n|            1 |\n|            2 |\n|            3 |\n|            4 |\n+<span class=\"hljs-comment\">--------------+<\/span>\n4 rows in <span class=\"hljs-keyword\">set<\/span> (<span class=\"hljs-number\">0.01<\/span> sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>When we called the procedure, we asked MySQL to run our stored procedure to find all the films in the inventory table, where the film id is 1 and the store id is 1. We also passed a third argument, which is a variable name that will hold the total count value of the results.<\/p>\n\n\n\n<p>We can retrieve the results by running a <code>SELECT<\/code> statement followed by the variable name as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql shcb-wrap-lines\">mysql&gt; <span class=\"hljs-keyword\">SELECT<\/span> @p_film_count;\n+<span class=\"hljs-comment\">---------------+<\/span>\n| @p_film_count |\n+<span class=\"hljs-comment\">---------------+<\/span>\n|             4 |\n+<span class=\"hljs-comment\">---------------+<\/span>\n1 row in <span class=\"hljs-keyword\">set<\/span> (<span class=\"hljs-number\">0.00<\/span> sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Note that the variable name we passed as our third argument doesn\u2019t have to be the exact spelling as the parameter we defined when creating the stored procedure. We could as well just use <code>@p_count<\/code> if we wanted to.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>From the points and examples above, we can see how very powerful and useful stored procedures can be when used in MySQL. I use them often to avoid repeating tasks that I would love to execute more than once.&nbsp;<\/p>\n\n\n\n<p>Apart from saving you time, they also help you move some logic you would normally write in your application to the database, thus enabling you to focus more on the business logic of your application.&nbsp;<\/p>\n\n\n\n<p>In our next tutorial, we\u2019d visit some more advanced concepts of using stored procedures in MySQL. Till then, feel free to check out some of our other resources covering performance tuning in MySQL in the links below.<\/p>\n\n\n\n<p><a href=\"https:\/\/coderpad.io\/blog\/development\/how-to-use-indexes-to-increase-mysql-database-performance\/\">How to Use Indexes to Increase MySQL Database Performance<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/coderpad.io\/blog\/development\/optimize-mysql-database-schema\/\">How to Optimize MySQL Database Schema for Improved Performance<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/coderpad.io\/blog\/development\/optimize-query-performance-mysql\/\">How to Optimize Query Performance in MySQL Databases<\/a><\/p>\n\n\n\n<p><em>I\u2019m Elvis Duru. I create helpful content for web developers with a focus on React, Node.js, SQL\/NoSQL Databases, and more! Let\u2019s connect on<\/em><a href=\"https:\/\/twitter.com\/ElvisDuru\" target=\"_blank\" rel=\"noopener\"><em> Twitter<\/em><\/a><em>.<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">References<\/h2>\n\n\n\n<p><a href=\"https:\/\/docs.oracle.com\/cd\/F49540_01\/DOC\/java.815\/a64686\/01_intr3.htm\" target=\"_blank\" rel=\"noopener\">Advantages of Stored Procedures &#8211; Oracle8i Java Stored Procedures Developer\u2019s Guide<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Stored procedures can be extremely useful in improving the efficiency of your database, saving you time, money, and lots of work-related headaches. Many database management systems today can use stored procedures to execute tasks on the database. Learn what a stored procedure is, the pros and how you can use them in your database operations.<\/p>\n","protected":false},"author":1,"featured_media":26485,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[],"persona":[29],"blog-programming-language":[66],"keyword-cluster":[],"class_list":["post-26476","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development"],"acf":[],"_links":{"self":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/posts\/26476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/comments?post=26476"}],"version-history":[{"count":60,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/posts\/26476\/revisions"}],"predecessor-version":[{"id":26572,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/posts\/26476\/revisions\/26572"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/media\/26485"}],"wp:attachment":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/media?parent=26476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/categories?post=26476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/tags?post=26476"},{"taxonomy":"persona","embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/persona?post=26476"},{"taxonomy":"blog-programming-language","embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/blog-programming-language?post=26476"},{"taxonomy":"keyword-cluster","embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/keyword-cluster?post=26476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}