{"id":1591,"date":"2024-08-02T07:39:16","date_gmt":"2024-08-02T05:39:16","guid":{"rendered":"https:\/\/blog.sutilweb.eu\/?page_id=1591"},"modified":"2024-08-02T07:39:16","modified_gmt":"2024-08-02T05:39:16","slug":"006-api-rest-crud-con-ajax-2","status":"publish","type":"page","link":"https:\/\/sutilweb.eu\/index.php\/lenguajes\/javascript\/javascript-practico\/16-api-rest\/006-api-rest-crud-con-ajax-2\/","title":{"rendered":"006. API REST: CRUD con AJAX (2)"},"content":{"rendered":"\n<p>En el cap\u00edtulo anterior dej\u00e1bamos a la mitad el <strong>CRUD<\/strong> sobre el que estamos trabajando, y tan s\u00f3lo le\u00edamos los datos de nuestro archivo <strong>JSON<\/strong>. En este cap\u00edtulo vamos a finalizar el ejercicio. Mostr\u00e1bamos como logramos hacer una funci\u00f3n denominada <strong><em>ajax()<\/em><\/strong> que contemplara todos los pasos que hay que necesitar activar para que una petici\u00f3n <strong><em>XMLHttpRequest<\/em> <\/strong>funcione, y comprob\u00e1bamos como funcionaba con la <strong>solicitud GET<\/strong>, que es la lectura de ese <strong>CRUD<\/strong>.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>En este cap\u00edtulo veremos el resto de operaciones, es decir, el <strong><em>CREATE<\/em><\/strong>, el <strong><em>UPDATE<\/em> <\/strong>y el <strong><em>DELETE<\/em><\/strong>, y como toda la sintaxis se va a simplificar gracias a la funci\u00f3n <strong><em>ajax()<\/em><\/strong> creada en el cap\u00edtulo anterior.<\/p>\n\n\n\n<p>La creaci\u00f3n y la edici\u00f3n a nivel de <strong>eventos<\/strong> tendr\u00e1 que ejecutarse a la hora de procesar el formulario del cap\u00edtulo anterior, el cual ten\u00edamos guardado en la variable <strong><em>form<\/em><\/strong>.<\/p>\n\n\n\n<p>Veamos la nueva sintaxis.<\/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 Ajax&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;Constelaci\u00f3n&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 ajax = (options) =&gt; {\n&nbsp; &nbsp; &nbsp; &nbsp; \/\/ Usamos destructuraci\u00f3n\n&nbsp; &nbsp; &nbsp; &nbsp; let { url, method, success, error, data } = options;\n&nbsp; &nbsp; &nbsp; &nbsp; const xhr = new XMLHttpRequest();\n&nbsp; &nbsp; &nbsp; &nbsp; xhr.addEventListener(\"readystatechange\", (e) =&gt; {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (xhr.readyState !== 4) return;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (xhr.status &gt;= 200 &amp;&amp; xhr.status &lt; 300) {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let json = JSON.parse(xhr.responseText);\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; success(json);\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let message = xhr.statusText || \"Ocurri\u00f3 un error\";\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error(`Error ${xhr.status}: ${message}`);\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }\n&nbsp; &nbsp; &nbsp; &nbsp; });\n&nbsp; &nbsp; &nbsp; &nbsp; xhr.open(method || \"GET\", url);\n&nbsp; &nbsp; &nbsp; &nbsp; xhr.setRequestHeader(\"Content-Type\", \"application\/json; charset=utf-8\");\n&nbsp; &nbsp; &nbsp; &nbsp; xhr.send(JSON.stringify(data));\n&nbsp; &nbsp; &nbsp; };\n\n&nbsp; &nbsp; &nbsp; const getAll = () =&gt; {\n&nbsp; &nbsp; &nbsp; &nbsp; ajax({\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; url: \"http:\/\/localhost:5555\/santos\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; success: (res) =&gt; {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.log(res);\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res.forEach((el) =&gt; {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $template.querySelector(\".name\").textContent = el.nombre;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $template.querySelector(\".constellation\").textContent =\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; el.constelacion;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $template.querySelector(\".edit\").dataset.id = el.id;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $template.querySelector(\".edit\").dataset.name = el.nombre;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $template.querySelector(\".edit\").dataset.constellation =\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; el.constelacion;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $template.querySelector(\".delete\").dataset.id = el.id;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let $clone = d.importNode($template, true);\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $fragment.appendChild($clone);\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $table.querySelector(\"tbody\").appendChild($fragment);\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error: (err) =&gt; {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.log(err);\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $table.insertAdjacentHTML(\"afterend\", `&lt;p&gt;&lt;b&gt;${err}&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\", (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; ajax({\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; url: \"http:\/\/localhost:5555\/santos\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; method: \"POST\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; success: (res) =&gt; {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; location.reload();\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error: () =&gt; {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $form.insertAdjacentElement(\"afterend\", `&lt;p&gt;&lt;b&gt;${err}&lt;\/b&gt;&lt;\/p&gt;`);\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data: {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nombre: e.target.nombre.value,\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; constelacion: e.target.constelacion.value,\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; ajax({\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; url: `http:\/\/localhost:5555\/santos\/${e.target.id.value}`,\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; method: \"PUT\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; success: (res) =&gt; {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; location.reload();\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error: () =&gt; {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $form.insertAdjacentElement(\"afterend\", `&lt;p&gt;&lt;b&gt;${err}&lt;\/b&gt;&lt;\/p&gt;`);\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data: {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nombre: e.target.nombre.value,\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; constelacion: e.target.constelacion.value,\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\", (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; ajax({\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; url: `http:\/\/localhost:5555\/santos\/${e.target.dataset.id}`,\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; method: \"DELETE\",\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; success: (res) =&gt; location.reload(),\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error: () =&gt; alert(err),\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 el cap\u00edtulo anterior dej\u00e1bamos a la mitad el CRUD sobre el que estamos trabajando, y tan s\u00f3lo le\u00edamos los [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1577,"menu_order":5,"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-1591","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 el cap\u00edtulo anterior dej\u00e1bamos a la mitad el CRUD sobre el que estamos trabajando, y tan s\u00f3lo le\u00edamos los [&hellip;]","_links":{"self":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/1591","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=1591"}],"version-history":[{"count":1,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/1591\/revisions"}],"predecessor-version":[{"id":1592,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/1591\/revisions\/1592"}],"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=1591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}