{"id":1595,"date":"2024-08-02T10:27:56","date_gmt":"2024-08-02T08:27:56","guid":{"rendered":"https:\/\/blog.sutilweb.eu\/?page_id=1595"},"modified":"2024-08-02T10:27:57","modified_gmt":"2024-08-02T08:27:57","slug":"08-api-rest-crud-con-fetch-2","status":"publish","type":"page","link":"https:\/\/sutilweb.eu\/index.php\/lenguajes\/javascript\/javascript-practico\/16-api-rest\/08-api-rest-crud-con-fetch-2\/","title":{"rendered":"08. API REST: CRUD con Fetch (2)"},"content":{"rendered":"\n<p>En este cap\u00edtulo abordamos la segunda parte del ejercicio que comenzamos en el cap\u00edtulo anterior, y ahora vamos a trabajar con las siguientes 3 peticiones, que son <strong><em>INSERT<\/em><\/strong>, <strong><em>UPDATE<\/em> <\/strong>y <strong><em>DELETE<\/em><\/strong>.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>La sintaxis del ejercicio quedar\u00eda como sigue.<\/p>\n\n\n\n<p>Sintaxis de <em>crud_fetch.html<\/em>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;!DOCTYPE html&gt;\n&lt;html lang=\"en\"&gt;\n&nbsp; &lt;head&gt;\n&nbsp; &nbsp; &lt;meta charset=\"UTF-8\" \/&gt;\n&nbsp; &nbsp; &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" \/&gt;\n&nbsp; &nbsp; &lt;title&gt;CRUD API REST Ajax&lt;\/title&gt;\n&nbsp; &lt;\/head&gt;\n\n&nbsp; &lt;body&gt;\n&nbsp; &nbsp; &lt;h1&gt;CRUD API REST FETCH&lt;\/h1&gt;\n&nbsp; &nbsp; &lt;section id=\"crud\"&gt;\n&nbsp; &nbsp; &nbsp; &lt;article&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &lt;h2 class=\"crud-title\"&gt;Agregar nombre&lt;\/h2&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &lt;form class=\"crud-form\"&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input type=\"hidden\" name=\"id\" \/&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input type=\"text\" name=\"nombre\" placeholder=\"Nombre\" required \/&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;br \/&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; type=\"text\"\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name=\"constelacion\"\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; placeholder=\"constelaci\u00f3n\"\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; required\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;br \/&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input type=\"submit\" value=\"Enviar\" \/&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &lt;\/form&gt;\n&nbsp; &nbsp; &nbsp; &lt;\/article&gt;\n&nbsp; &nbsp; &nbsp; &lt;article&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &lt;h2&gt;Ver nombres&lt;\/h2&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &lt;table class=\"crud-table\"&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;thead&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;th&gt;Nombre&lt;\/th&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;th&gt;Email&lt;\/th&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;th&gt;Acciones&lt;\/th&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;\/tr&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;\/thead&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tbody&gt;&lt;\/tbody&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &lt;\/table&gt;\n&nbsp; &nbsp; &nbsp; &lt;\/article&gt;\n&nbsp; &nbsp; &lt;\/section&gt;\n&nbsp; &nbsp; &lt;template id=\"crud-template\"&gt;\n&nbsp; &nbsp; &nbsp; &lt;tr&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &lt;td class=\"name\"&gt;&lt;\/td&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &lt;td class=\"constellation\"&gt;&lt;\/td&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &lt;td&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button class=\"edit\"&gt;Editar&lt;\/button&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button class=\"delete\"&gt;Eliminar&lt;\/button&gt;\n&nbsp; &nbsp; &nbsp; &nbsp; &lt;\/td&gt;\n&nbsp; &nbsp; &nbsp; &lt;\/tr&gt;\n&nbsp; &nbsp; &lt;\/template&gt;\n\n&nbsp; &nbsp; &lt;script&gt;\n&nbsp; &nbsp; &nbsp; const d = document,\n&nbsp; &nbsp; &nbsp; &nbsp; $table = d.querySelector(\".crud-table\"),\n&nbsp; &nbsp; &nbsp; &nbsp; $form = d.querySelector(\".crud-form\"),\n&nbsp; &nbsp; &nbsp; &nbsp; $title = d.querySelector(\".crud-title\"),\n&nbsp; &nbsp; &nbsp; &nbsp; $template = d.getElementById(\"crud-template\").content,\n&nbsp; &nbsp; &nbsp; &nbsp; $fragment = d.createDocumentFragment();\n\n&nbsp; &nbsp; &nbsp; const getAll = async () =&gt; {\n&nbsp; &nbsp; &nbsp; &nbsp; try {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let res = await fetch(\"http:\/\/localhost:5555\/santos\"),\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json = await res.json();\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!res.ok) throw { status: res.status, statusText: res.statusText };\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.log(json);\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json.forEach((el) =&gt; {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $template.querySelector(\".name\").textContent = el.nombre;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $template.querySelector(\".constellation\").textContent =\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; el.constelacion;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $template.querySelector(\".edit\").dataset.id = el.id;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $template.querySelector(\".edit\").dataset.name = el.nombre;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $template.querySelector(\".edit\").dataset.constellation =\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; el.constelacion;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $template.querySelector(\".delete\").dataset.id = el.id;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let $clone = d.importNode($template, true);\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $fragment.appendChild($clone);\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $table.querySelector(\"tbody\").appendChild($fragment);\n&nbsp; &nbsp; &nbsp; &nbsp; } catch (err) {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let message = err.statusText || \"Ocurri\u00f3 un error\";\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $table.insertAdjacentElement(\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"afterend\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `&lt;p&gt;&lt;b&gt;Error ${err.status}: ${message}&lt;\/b&gt;&lt;\/p&gt;`\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );\n&nbsp; &nbsp; &nbsp; &nbsp; }\n&nbsp; &nbsp; &nbsp; };\n\n&nbsp; &nbsp; &nbsp; d.addEventListener(\"DOMContentLoaded\", getAll);\n\n&nbsp; &nbsp; &nbsp; d.addEventListener(\"submit\", async (e) =&gt; {\n&nbsp; &nbsp; &nbsp; &nbsp; if (e.target === $form) {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.preventDefault();\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!e.target.id.value) {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ Create POST\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let options = {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; method: \"POST\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; headers: {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"Content-Type\": \"application\/json; charset=utf-8\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; body: JSON.stringify({\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nombre: e.target.nombre.value,\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; constelacion: e.target.constelacion.value,\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }),\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = await fetch(\"http:\/\/localhost:5555\/santos\", options),\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json = await res.json();\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!res.ok)\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw { status: res.status, statusText: res.statusText };\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; location.reload();\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (err) {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let message = err.statusText || \"Ocurri\u00f3 un error\";\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $form.insertAdjacentElement(\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"afterend\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `&lt;p&gt;&lt;b&gt;Error ${err.status}: ${message}&lt;\/b&gt;&lt;\/p&gt;`\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ Update PUT\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let options = {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; method: \"PUT\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; headers: {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"Content-Type\": \"application\/json; charset=utf-8\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; body: JSON.stringify({\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nombre: e.target.nombre.value,\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; constelacion: e.target.constelacion.value,\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }),\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = await fetch(\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `http:\/\/localhost:5555\/santos\/${e.target.id.value}`,\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; options\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ),\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json = await res.json();\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!res.ok)\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw { status: res.status, statusText: res.statusText };\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; location.reload();\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (err) {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let message = err.statusText || \"Ocurri\u00f3 un error\";\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $form.insertAdjacentElement(\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"afterend\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `&lt;p&gt;&lt;b&gt;Error ${err.status}: ${message}&lt;\/b&gt;&lt;\/p&gt;`\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }\n&nbsp; &nbsp; &nbsp; &nbsp; }\n&nbsp; &nbsp; &nbsp; });\n\n&nbsp; &nbsp; &nbsp; d.addEventListener(\"click\", async (e) =&gt; {\n&nbsp; &nbsp; &nbsp; &nbsp; if (e.target.matches(\".edit\")) {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $title.textContent = \"Editar nombre\";\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $form.nombre.value = e.target.dataset.name;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $form.constelacion.value = e.target.dataset.constellation;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $form.id.value = e.target.dataset.id;\n&nbsp; &nbsp; &nbsp; &nbsp; }\n\n&nbsp; &nbsp; &nbsp; &nbsp; if (e.target.matches(\".delete\")) {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let isDelete = confirm(\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `\u00bfEst\u00e1s seguro de eliminar el id ${e.target.dataset.id}?`\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );\n\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (isDelete) {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ Delete - DELETE\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let options = {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; method: \"DELETE\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; headers: {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"Content-Type\": \"application\/json; charset=utf-8\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = await fetch(\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `http:\/\/localhost:5555\/santos\/${e.target.dataset.id}`,\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; options\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ),\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json = await res.json();\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!res.ok)\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw { status: res.status, statusText: res.statusText };\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; location.reload();\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (err) {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let message = err.statusText || \"Ocurri\u00f3 un error\";\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert(`Error ${err.status}: ${message}`);\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }\n&nbsp; &nbsp; &nbsp; &nbsp; }\n&nbsp; &nbsp; &nbsp; });\n&nbsp; &nbsp; &lt;\/script&gt;\n&nbsp; &lt;\/body&gt;\n&lt;\/html&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>En este cap\u00edtulo abordamos la segunda parte del ejercicio que comenzamos en el cap\u00edtulo anterior, y ahora vamos a trabajar [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1577,"menu_order":7,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-1595","page","type-page","status-publish","hentry"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Sutil Web","author_link":"https:\/\/sutilweb.eu\/index.php\/author\/sutilweb\/"},"uagb_comment_info":0,"uagb_excerpt":"En este cap\u00edtulo abordamos la segunda parte del ejercicio que comenzamos en el cap\u00edtulo anterior, y ahora vamos a trabajar [&hellip;]","_links":{"self":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/1595","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/comments?post=1595"}],"version-history":[{"count":2,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/1595\/revisions"}],"predecessor-version":[{"id":1597,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/1595\/revisions\/1597"}],"up":[{"embeddable":true,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/1577"}],"wp:attachment":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/media?parent=1595"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}