{"id":201,"date":"2023-02-08T21:37:49","date_gmt":"2023-02-08T20:37:49","guid":{"rendered":"https:\/\/olce.local\/?page_id=201"},"modified":"2025-01-29T21:23:20","modified_gmt":"2025-01-29T20:23:20","slug":"api","status":"publish","type":"page","link":"https:\/\/landing.vuce.gob.pe\/olce-wp\/consumo-de-datos-y-api\/api\/","title":{"rendered":"API"},"content":{"rendered":"\n<div class=\"wp-block-columns justify-center olce-flow olce-flow-prose is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\"><h1 class=\"wp-block-heading text-2xl\" style=\"font-style:normal;font-weight:900\" id=\"api\">API<\/h1>\n\n\n<p class=\"wp-block-paragraph\">Usa la API de OLCE de Per\u00fa. Te proporcionaremos <strong>todos los datos usados en el portal<\/strong>. <\/p>\n\n\n\n<p class=\"mb-fluid-l wp-block-paragraph\">Sigue los pasos descritos a continuaci\u00f3n para conseguir tu clave de registro.<\/p>\n\n\n<div class=\"custom-block block-informacion bg-neutral-50 flex gap-4 py-4 px-3 infobanner items-center\">\r\n    <figure class=\"w-auto\"><img decoding=\"async\" src=\"https:\/\/landing.vuce.gob.pe\/olce-wp\/wp-content\/uploads\/2023\/02\/book.svg\" alt=\"icono\"><\/figure>\r\n    <div class=\"w-auto mt-0\">\n\n<p class=\"wp-block-paragraph\">\u00bfNecesitas m\u00e1s informaci\u00f3n? Accede a la&nbsp;<a href=\"https:\/\/landing-test.vuce.gob.pe\/vuce-olce-ui\/api\" target=\"_blank\" rel=\"noreferrer noopener\">Documentaci\u00f3n completa<\/a>&nbsp;de la API<\/p>\n\n<\/div>\r\n<\/div>\n\n\n<div class=\"wp-block-group api-story is-layout-constrained wp-block-group-is-layout-constrained\"><h2 class=\"wp-block-heading text-xl\" style=\"font-style:normal;font-weight:700\" id=\"registrate-para-obtener-tu-clave\">Reg\u00edstrate para obtener tu clave<\/h2>\n\n\n<p class=\"mb-fluid-l wp-block-paragraph\">Introduce a continuaci\u00f3n tu email para enviarte la clave.<\/p>\n\n\n<div class=\"custom-block block-informacion bg-neutral-50 flex gap-4 py-4 px-3 infobanner items-center\">\r\n    <figure class=\"w-auto\"><img decoding=\"async\" src=\"https:\/\/landing.vuce.gob.pe\/olce-wp\/wp-content\/uploads\/2023\/10\/Vector-1.svg\" alt=\"icono\"><\/figure>\r\n    <div class=\"w-auto mt-0\">\n\n<p class=\"wp-block-paragraph\">Si <strong>has olvidado o perdido tu clave<\/strong> cumplimenta nuevamente este mismo formulario<\/p>\n\n<\/div>\r\n<\/div>\n\n<script src=\"https:\/\/www.google.com\/recaptcha\/api.js\" async defer><\/script>\n\n<div id=\"form-container\">\n  <div class=\"flex flex-col gap-3 input-container mt-0 olce-filters\">\n    <div class=\"w-full jet-select\">\n      <label class=\"jet-filter-label\">Tipo de persona<\/label>\n      <select\n        name=\"tipo-persona\"\n        id=\"tipo-persona\"\n        class=\"jet-select__control depth-0 !mt-0\"\n        required\n      >\n        <option value=\"\" selected disabled>Seleccionar&#8230;<\/option>\n        <option value=\"Persona Natural\">Persona Natural<\/option>\n        <option value=\"Empresa u organizaci\u00f3n\">Empresa u organizaci\u00f3n<\/option>\n      <\/select>\n    <\/div>\n\n    <div id=\"sPersona\" class=\"flex flex-col md:flex-row gap-3 !mt-0\">\n      <div class=\"border-slate-300 border-2 text-base pt-4 w-full md:w-1\/2\">\n        <label for=\"nombre\" class=\"jet-filter-label\">Nombre<\/label>\n        <input\n          type=\"text\"\n          name=\"nombre\"\n          id=\"nombre\"\n          class=\"w-full !mt-0 !border-none\"\n          required\n        \/>\n      <\/div>\n      <div\n        class=\"border-slate-300 border-2 text-base pt-4 !mt-0 w-full md:w-1\/2\"\n      >\n        <label for=\"apellido\" class=\"jet-filter-label\">Apellido<\/label>\n        <input\n          type=\"text\"\n          name=\"apellido\"\n          id=\"apellido\"\n          class=\"w-full !mt-0 !border-none\"\n          required\n        \/>\n      <\/div>\n    <\/div>\n    <div\n      id=\"sEmpresa\"\n      class=\"border-slate-300 border-2 text-base pt-4 !mt-0 w-full\"\n    >\n      <label for=\"empresa\" class=\"jet-filter-label\"\n        >Empresa u Organizaci\u00f3n<\/label\n      >\n      <input\n        type=\"text\"\n        name=\"empresa\"\n        id=\"empresa\"\n        class=\"w-full !mt-0 !border-none\"\n      \/>\n    <\/div>\n    <div class=\"flex flex-col md:flex-row gap-3 !mt-0\">\n      <div\n        class=\"border-slate-300 border-2 text-base pt-4 !mt-0 w-full jet-select\"\n      >\n        <label class=\"jet-filter-label\">Tipo de documento<\/label>\n        <select\n          name=\"tipo-documento\"\n          id=\"tipo-documento\"\n          class=\"jet-select__control depth-0 !mt-0\"\n          required\n        >\n          <option value=\"\" selected disabled>Seleccionar&#8230;<\/option>\n          <option value=\"C. PTP\">C. PTP<\/option>\n          <option value=\"CARNET DE EXTRANJERIA\">CARNET DE EXTRANJERIA<\/option>\n          <option value=\"CARNET DE FUERZAS ARMADAS\">\n            CARNET DE FUERZAS ARMADAS\n          <\/option>\n          <option value=\"CARNET DE FUERZAS POLICIALES\">\n            CARNET DE FUERZAS POLICIALES\n          <\/option>\n          <option value=\"CED. DIPLOMATICA DE IDENTIDAD\">\n            CED. DIPLOMATICA DE IDENTIDAD\n          <\/option>\n          <option value=\"DNI\">DNI<\/option>\n          <option value=\"DOC. NACIONAL DE IDENTIDAD\">\n            DOC. NACIONAL DE IDENTIDAD\n          <\/option>\n          <option value=\"DOC.PROVISIONAL DE IDENTIDAD\">\n            DOC.PROVISIONAL DE IDENTIDAD\n          <\/option>\n          <option value=\"DT.S\/RUC\">DT.S\/RUC<\/option>\n          <option value=\"EXTRANET\">EXTRANET<\/option>\n          <option value=\"LIBRETA TRIBUTARIA\">LIBRETA TRIBUTARIA<\/option>\n          <option value=\"PASAPORTE\">PASAPORTE<\/option>\n          <option value=\"RUC\">RUC<\/option>\n        <\/select>\n      <\/div>\n      <div class=\"border-slate-300 border-2 text-base pt-4 !mt-0 w-full\">\n        <label for=\"n_documento\" class=\"jet-filter-label\">N\u00ba Documento<\/label>\n        <input\n          type=\"text\"\n          name=\"n_documento\"\n          id=\"n_documento\"\n          class=\"w-full !mt-0 !border-none\"\n          required\n          maxlength=\"32\"\n        \/>\n        <span\n          class=\"error error-not-valid-tip !hidden\"\n          aria-hidden=\"true\"\n          id=\"n_documento-error\"\n        ><\/span>\n      <\/div>\n    <\/div>\n    <div class=\"flex flex-col md:flex-row gap-3 !mt-0\">\n      <!--             <input type=\"email\" id=\"email-input\" class=\"w-full md:w-1\/2 !mt-0\" placeholder=\"Introduce tu correo...\" style=\"background: url(https:\/\/landing.vuce.gob.pe\/olce-wp\/wp-content\/themes\/wp-theme\/assets\/icons\/grayenvelope.svg) no-repeat scroll 7px 50%; padding-left: 30px\">-->\n      <div\n        class=\"border-slate-300 border-2 text-base pt-4 w-full md:w-1\/2 !mt-0\"\n      >\n        <label for=\"email-input\" class=\"jet-filter-label\">Email<\/label>\n        <input\n          type=\"email\"\n          id=\"email-input\"\n          class=\"!mt-0 w-full !border-none\"\n          required\n        \/>\n      <\/div>\n      <div\n        class=\"border-slate-300 border-2 text-base pt-4 w-full md:w-1\/2 !mt-0\"\n      >\n        <label for=\"email-input-r\" class=\"jet-filter-label\">Repita email<\/label>\n        <input\n          type=\"email\"\n          id=\"email-input-r\"\n          class=\"!mt-0 w-full !border-none\"\n          required\n        \/>\n      <\/div>\n    <\/div>\n    <div class=\"border-slate-300 border-2 text-base pt-4 !mt-0 w-full\">\n      <label for=\"motivo_uso\" class=\"jet-filter-label\">Motivo de uso<\/label>\n      <textarea\n        name=\"Motivo de uso\"\n        id=\"motivo_uso\"\n        cols=\"30\"\n        rows=\"10\"\n        placeholder=\"\"\n        class=\"!mt-0 w-full !border-none\"\n        required\n      ><\/textarea>\n    <\/div>\n    <!--         <div class=\"checkbox-container !mt-3\">\n            <input type=\"checkbox\" id=\"robot-check\" required>\n            <label for=\"robot-check\">No soy un robot<\/label>\n        <\/div> -->\n    <div\n      class=\"g-recaptcha\"\n      data-sitekey=\"6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI\"\n      data-callback=\"onRecaptchaSuccess\"\n      data-expired-callback=\"onRecaptchaResponseExpiry\"\n      data-error-callback=\"onRecaptchaError\"\n    ><\/div>\n    <button\n      id=\"submit-button\"\n      class=\"min-w-fit mt-0 olce-button-icon olce-button-primary w-min flex items-center justify-center gap-2 w-64\"\n      disabled\n    >\n      <span class=\"submit-text\">Solicitar clave<\/span>\n      <div class=\"lds-ring hidden\">\n        <div><\/div>\n        <div><\/div>\n        <div><\/div>\n        <div><\/div>\n      <\/div>\n    <\/button>\n  <\/div>\n  <span class=\"error !mt-3\" id=\"email-error\"><\/span>\n<\/div>\n\n<div id=\"success-message\" class=\"api-success\" style=\"display: none\">\n  <p>El env\u00edo se ha realizado correctamente<\/p>\n<\/div>\n<div id=\"error-message\" class=\"api-error\" style=\"display: none\">\n  <p>El env\u00edo no se ha realizado correctamente<\/p>\n<\/div>\n\n<script>\n     \/\/ Obtiene referencias a elementos del DOM\n     const emailInput = document.getElementById(\"email-input\");\n     const emailInputR = document.getElementById(\"email-input-r\");\n     const emailError = document.getElementById(\"email-error\");\n     const robotCheck = document.getElementById(\"robot-check\");\n     const submitButton = document.getElementById(\"submit-button\");\n     const formContainer = document.getElementById(\"form-container\");\n     const tipoPersonaSelect = document.getElementById(\"tipo-persona\");\n     const nombreInput = document.getElementById(\"nombre\");\n     const apellidoInput = document.getElementById(\"apellido\");\n     const empresaInput = document.getElementById(\"empresa\");\n     const tipoDocumento = document.getElementById(\"tipo-documento\");\n     const nDocumento = document.getElementById(\"n_documento\");\n     const motivoUso = document.getElementById(\"motivo_uso\");\n\n     \/\/ Variables y eventos relacionados con ReCaptcha\n     let reCaptcha = false;\n\n     function onRecaptchaSuccess() {\n         reCaptcha = true;\n         validateForm();\n     }\n\n     function onRecaptchaResponseExpiry() {\n         submitButton.disabled = true;\n         reCaptcha = false;\n     }\n\n     function onRecaptchaError() {\n         submitButton.disabled = true;\n         reCaptcha = false;\n     }\n\n\n     \/\/ Funci\u00f3n para validar el formato del email\n     function isValidEmail(email) {\n         \/\/ Aqu\u00ed puedes implementar tu l\u00f3gica de validaci\u00f3n de correo electr\u00f3nico\n         \/\/ Por ejemplo, puedes utilizar una expresi\u00f3n regular para verificar el formato.\n         const emailRegex = \/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$\/;\n         return emailRegex.test(email);\n     }\n\n     \/\/ Validaci\u00f3n de email al escribir\n     emailInput.addEventListener(\"input\", validateEmail);\n\n     \/\/ Evento de cambio en el tipo de persona\n     tipoPersonaSelect.addEventListener(\"change\", handleTipoPersonaChange);\n\n     \/\/ A\u00f1adir evento al bot\u00f3n de enviar\n     submitButton.addEventListener(\"click\", handleSubmit);\n\n     \/\/ A\u00f1adir eventos de focus para la validaci\u00f3n en tiempo real\n     addFocusEvents();\n\n     \/\/ Funci\u00f3n para manejar cambios en el tipo de persona\n     function handleTipoPersonaChange() {\n         const valorSeleccionado = tipoPersonaSelect.value;\n         toggleFormFields(valorSeleccionado);\n     }\n\n  \/\/ A\u00f1adir evento al cambio de tipo de documento\n  tipoDocumento.addEventListener(\"change\", handleTipoDocumentoChange);\n\n  \/\/ Funci\u00f3n para manejar cambios en el tipo de documento\n  function handleTipoDocumentoChange() {\n     \tconst selectedOption = tipoDocumento.value;\n     \tif (selectedOption === 'DNI') {\n          nDocumento.maxLength = 8;\n  \t\t        nDocumento.value = \"\"; \/\/ Vac\u00eda el campo nDocumento si no se selecciona \"DNI\"\n\n      } else {\n          nDocumento.removeAttribute('maxlength');\n  \t\t        nDocumento.value = \"\"; \/\/ Vac\u00eda el campo nDocumento si no se selecciona \"DNI\"\n      }\n  }\n\n     \/\/ Funci\u00f3n para mostrar u ocultar campos seg\u00fan el tipo de persona seleccionado\n     function toggleFormFields(tipoPersona) {\n         if (tipoPersona === 'Persona Natural') {\n             showPersonaFields();\n             hideEmpresaFields();\n         } else if (tipoPersona === 'Empresa u organizaci\u00f3n') {\n             showEmpresaFields();\n             hidePersonaFields();\n         }\n     }\n\n     \/\/ Funciones para mostrar y ocultar campos de persona y empresa\n     function showPersonaFields() {\n         jQuery('#sEmpresa').hide();\n         jQuery('#sPersona').show();\n         empresaInput.removeAttribute('required');\n         nombreInput.setAttribute('required', 'true');\n         apellidoInput.setAttribute('required', 'true');\n     }\n\n     function hidePersonaFields() {\n         jQuery('#sPersona').hide();\n         nombreInput.removeAttribute('required');\n         apellidoInput.removeAttribute('required');\n     }\n\n     function showEmpresaFields() {\n         jQuery('#sPersona').hide();\n         jQuery('#sEmpresa').show();\n         nombreInput.removeAttribute('required');\n         apellidoInput.removeAttribute('required');\n         empresaInput.setAttribute('required', 'true');\n     }\n\n     function hideEmpresaFields() {\n         jQuery('#sEmpresa').hide();\n         empresaInput.removeAttribute('required');\n     }\n\n     \/\/ Funci\u00f3n para validar el formato del email\n     function validateEmail() {\n         const isValid = isValidEmail(emailInput.value);\n\n         if (isValid) {\n             clearEmailError();\n         } else {\n             displayEmailError();\n         }\n\n         validateForm();\n     }\n\n     \/\/ Funciones para manejar mensajes de error y \u00e9xito\n     function displayEmailError() {\n         emailError.textContent = \"Correo no v\u00e1lido\";\n         emailInput.classList.add(\"border-primary-700\");\n     }\n\n     function clearEmailError() {\n         emailError.textContent = \"\";\n         emailInput.classList.remove(\"border-primary-700\");\n     }\n\n     \/\/ Funci\u00f3n para validar el formulario\n     function validateForm() {\n         const isValidEmailFormat = isValidEmail(emailInput.value);\n         const areEmailsMatching = emailInput.value === emailInputR.value;\n         const isNDocumentoValid = validateNDocumentoField();\n         const areAllFieldsValid = validateAllFields();\n\n         submitButton.disabled = !areAllFieldsValid || !isValidEmailFormat || !areEmailsMatching || !reCaptcha || !isNDocumentoValid;\n\n     }\n\n     \/\/ Funci\u00f3n para validar todos los campos del formulario\n     function validateAllFields() {\n         const requiredFields = [tipoPersonaSelect, nombreInput, apellidoInput, tipoDocumento, nDocumento, emailInput, emailInputR, motivoUso];\n         return requiredFields.every(field => field.value !== \"\");\n     }\n\n     \/\/ A\u00f1adir eventos de focus para validar en tiempo real\n     function addFocusEvents() {\n         const fieldsToValidate = [emailInput, emailInputR, tipoPersonaSelect, nombreInput, apellidoInput, tipoDocumento, nDocumento, motivoUso];\n         fieldsToValidate.forEach(field => {\n             field.addEventListener(\"focus\", validateForm);\n         });\n     }\n\n     function handleSubmit(event) {\n         event.preventDefault();\n\n         if (submitButton.disabled) {\n             return;\n         }\n         document.querySelector('.lds-ring').classList.remove('hidden');\n         document.querySelector('.submit-text').classList.add('hidden');\n\n         submitButton.disabled = true;\n\n         const apiEndpoint = 'https:\/\/gateway-apim.vuce.gob.pe\/pass-through-https\/olce\/api\/1.0\/usuarios\/generar-token';\n         const apiKey = 'eyJ4NXQiOiJOVGRtWmpNNFpEazNOalkwWXpjNU1tWm1PRGd3TVRFM01XWXdOREU1TVdSbFpEZzROemM0WkE9PSIsImtpZCI6ImdhdGV3YXlfY2VydGlmaWNhdGVfYWxpYXMiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJkZXZlbG9wZXIub2xjZUBjYXJib24uc3VwZXIiLCJhcHBsaWNhdGlvbiI6eyJvd25lciI6ImRldmVsb3Blci5vbGNlIiwidGllclF1b3RhVHlwZSI6bnVsbCwidGllciI6IjUwUGVyTWluIiwibmFtZSI6InNlcnZpY2lvcy1vbGNlIiwiaWQiOjMyLCJ1dWlkIjoiODRmMWIzOGMtYjIzNi00ZGI2LWJlYjEtZTBhMDdlMzZlYTAwIn0sImlzcyI6Imh0dHBzOlwvXC9jb250cm9sLXBsYW5lLWFwaW0udnVjZS5nb2IucGU6NDQzXC9vYXV0aDJcL3Rva2VuIiwidGllckluZm8iOnsiU2lsdmVyIjp7InRpZXJRdW90YVR5cGUiOiJyZXF1ZXN0Q291bnQiLCJncmFwaFFMTWF4Q29tcGxleGl0eSI6MCwiZ3JhcGhRTE1heERlcHRoIjowLCJzdG9wT25RdW90YVJlYWNoIjp0cnVlLCJzcGlrZUFycmVzdExpbWl0IjowLCJzcGlrZUFycmVzdFVuaXQiOm51bGx9LCJVbmxpbWl0ZWQiOnsidGllclF1b3RhVHlwZSI6InJlcXVlc3RDb3VudCIsImdyYXBoUUxNYXhDb21wbGV4aXR5IjowLCJncmFwaFFMTWF4RGVwdGgiOjAsInN0b3BPblF1b3RhUmVhY2giOnRydWUsInNwaWtlQXJyZXN0TGltaXQiOjAsInNwaWtlQXJyZXN0VW5pdCI6bnVsbH19LCJrZXl0eXBlIjoiUFJPRFVDVElPTiIsInBlcm1pdHRlZFJlZmVyZXIiOiIiLCJzdWJzY3JpYmVkQVBJcyI6W3sic3Vic2NyaWJlclRlbmFudERvbWFpbiI6ImNhcmJvbi5zdXBlciIsIm5hbWUiOiJ2dWNlLW9sY2UtYXBpIiwiY29udGV4dCI6IlwvdnVjZS1vbGNlLWFwaVwvdjEiLCJwdWJsaXNoZXIiOiJkZXZlbG9wZXIub2xjZSIsInZlcnNpb24iOiJ2MSIsInN1YnNjcmlwdGlvblRpZXIiOiJTaWx2ZXIifSx7InN1YnNjcmliZXJUZW5hbnREb21haW4iOiJjYXJib24uc3VwZXIiLCJuYW1lIjoidnVjZS1vbGNlLWFwaS1taXNsbyIsImNvbnRleHQiOiJcL3Z1Y2Utb2xjZS1hcGktbWlzbG9cL3YxIiwicHVibGlzaGVyIjoiZGV2ZWxvcGVyLm9sY2UiLCJ2ZXJzaW9uIjoidjEiLCJzdWJzY3JpcHRpb25UaWVyIjoiVW5saW1pdGVkIn1dLCJ0b2tlbl90eXBlIjoiYXBpS2V5IiwicGVybWl0dGVkSVAiOiIiLCJpYXQiOjE3Mzc2NzEyODcsImp0aSI6IjUxNDViMGU5LWJhODgtNGQ1NS1iYTZmLWQ1M2Q2NDlkZTYzNiJ9.M1FhFJRTqG52nDaEiNFt76QLeZG_6PCxTUzjCx9HlPu8edUSBxJ0IzSwDzHyONu5Atjj0q-gZ119Jugf-oJLoTpMnyJpClw8dfz1xPpMu0r-0YN4kyAWfgpMK-XEAtD6XItXy-kgAPuMs_TO04KD75WIUBCUxTiiV8n4dlNmMkrudGE3qzQt_i0JBpANfUTDIDlwEIhFHvrXrXJFajSwrGv7w2lc-NrBV8c4gtAwyVvh2OgV2BEjpf2tNdaxoPx9FQqZcTa1op6nGy_ut3HRrY0rHbTLjdNK2O698rhNOffqffgnrkAwTK_LwsADE5b4XPM89OiW-IcIyW7XFUyxpw==';\n\n         const formData = {\n             nombres: nombreInput.value,\n             apellidos: apellidoInput.value,\n             email: emailInput.value,\n             \"nro-de-documento\": nDocumento.value,\n             \"tipo-de-documento\": tipoDocumento.value,\n             \"tipo-de-persona\": tipoPersonaSelect.value,\n             \"registros-api\": [{\n                 \"registro-de-apikey\": \"nuevo registro\",\n                 \"motivo-de-uso\": motivoUso.value\n             }]\n         };\n\n         const requestOptions = {\n             method: 'POST',\n             headers: {\n                 'Content-Type': 'application\/json',\n                 'ApiKey': apiKey\n             },\n             body: JSON.stringify(formData)\n         };\n\n         fetch(apiEndpoint, requestOptions)\n             .then(response => {\n                 if (!response.ok) {\n                     throw new Error('Error en la solicitud');\n                 }\n                 return response.text();\n                 document.querySelector('.lds-ring').classList.add('hidden');\n                 document.querySelector('.submit-text').classList.remove('hidden');\n             })\n             .then(data => {\n                 document.querySelector('.lds-ring').classList.add('hidden');\n                 document.querySelector('.submit-text').classList.remove('hidden');\n                 document.querySelector('.api-success').style.display = \"block\";\n                 document.querySelector('.api-error').style.display = \"none\";\n                 \/\/ Borrar todos los campos del formulario\n                 nombreInput.value = \"\";\n                 apellidoInput.value = \"\";\n                 emailInput.value = \"\";\n                 emailInputR.value = \"\";\n                 nDocumento.value = \"\";\n                 tipoDocumento.value = \"\";\n                 tipoPersonaSelect.value = \"\";\n                 motivoUso.value = \"\";\n\n                 submitButton.disabled = false;\n             })\n             .catch(error => {\n                 document.querySelector('.lds-ring').classList.add('hidden');\n                 document.querySelector('.submit-text').classList.remove('hidden');\n                 console.error('Error al enviar la solicitud:', error);\n                 document.querySelector('.api-success').style.display = \"none\";\n                 document.querySelector('.api-error').style.display = \"block\";\n                 submitButton.disabled = false;\n\n             });\n     }\n\n     \/\/ Obtiene referencias al nuevo campo y al mensaje de error\n     const nDocumentoInput = document.getElementById(\"n_documento\");\n     const nDocumentoError = document.getElementById(\"n_documento-error\");\n\n     \/\/ A\u00f1ade un evento para validar el campo al escribir\n     nDocumentoInput.addEventListener(\"input\", validateNDocumento);\n\n     \/\/ Funci\u00f3n para validar el campo de n\u00famero de documento\n     function validateNDocumento() {\n         const value = nDocumentoInput.value;\n\n         \/\/ Verifica si solo contiene n\u00fameros usando una expresi\u00f3n regular\n         const isValid = \/^\\d+$\/.test(value);\n\n         if (isValid) {\n             clearNDocumentoError();\n         } else {\n             displayNDocumentoError();\n         }\n\n         validateForm();\n     }\n\n     function validateNDocumentoField() {\n         const value = nDocumentoInput.value;\n         return \/^\\d+$\/.test(value);\n     }\n     nDocumentoInput.addEventListener(\"input\", validateNDocumento);\n\n     \/\/ Funciones para manejar mensajes de error y \u00e9xito para el n\u00famero de documento\n     function displayNDocumentoError() {\n         nDocumentoError.textContent = \"Ingrese solo n\u00fameros\";\n         nDocumentoError.classList.remove(\"!hidden\");\n     }\n\n     function clearNDocumentoError() {\n         nDocumentoError.textContent = \"\";\n         nDocumentoError.classList.add(\"!hidden\");\n     }\n<\/script>\n<style>\n  .lds-ring {\n    position: relative;\n    width: 42px;\n    height: 42px;\n  }\n\n  .lds-ring div {\n    box-sizing: border-box;\n    display: block;\n    position: absolute;\n    width: 20px;\n    height: 20px;\n    margin: 2px;\n    border: 2px solid #fff;\n    border-radius: 50%;\n    animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;\n    border-color: #fff transparent transparent transparent;\n  }\n\n  .lds-ring div:nth-child(1) {\n    animation-delay: -0.45s;\n  }\n\n  .lds-ring div:nth-child(2) {\n    animation-delay: -0.3s;\n  }\n\n  .lds-ring div:nth-child(3) {\n    animation-delay: -0.15s;\n  }\n\n  @keyframes lds-ring {\n    0% {\n      transform: rotate(0deg);\n    }\n\n    100% {\n      transform: rotate(360deg);\n    }\n  }\n\n  .error-not-valid-tip {\n    --tw-bg-opacity: 1;\n    background-color: rgb(253 242 242 \/ var(--tw-bg-opacity));\n    padding: 0.5rem;\n    --tw-text-opacity: 1;\n    color: rgb(240 82 82 \/ var(--tw-text-opacity));\n    font-size: clamp(\n      0.8333333333333334rem,\n      calc(\n        0.8333333333333334rem +\n          ((0.9504 - 0.8333333333333334) * ((100vw - 20rem) \/ (80 - 20)))\n      ),\n      0.9504rem\n    );\n    line-height: 1.3;\n    font-weight: normal;\n    display: block;\n    margin-top: 0px !important;\n  }\n<\/style>\n\n\n<h2 class=\"wp-block-heading text-xl\" style=\"font-style:normal;font-weight:700\" id=\"crea-una-request\">Crea una Request<\/h2><\/div>\n\n\n\n<p class=\"mt-2 wp-block-paragraph\">Explora nuestra <a class=\"olce-link\" href=\"https:\/\/landing.vuce.gob.pe\/olce-wp\/consumo-de-datos-y-api\/\" data-type=\"page\" data-id=\"1314\">selecci\u00f3n de APIs<\/a> y sum\u00e9rgete en el cat\u00e1logo, d\u00f3nde descubrir\u00e1s <strong>instrucciones detalladas<\/strong> sobre c\u00f3mo aprovechar al m\u00e1ximo los indicadores nacionales y multilaterales y nuestros visores geogr\u00e1ficos. Aseg\u00farate de<strong> generar tu API key<\/strong> con antelaci\u00f3n para comenzar.<\/p>\n\n\n\r\n    <div class=\"c-block-enlace block-enlaces \">\r\n        <a class=\"bg-gray-100 flex  md:flex-row  md:items-center justify-between px-3 py-4 tipopage\" href=\"https:\/\/landing.vuce.gob.pe\/vuce-olce-ui\/api\" Target=\"_blank\">\r\n            <div class=\"flex  md:pr-0 md:px-4 w-auto\">\r\n                                <div class=\"flex items-center gap-2\">\r\n                <figure class=\"max-w-[26px]\"><img decoding=\"async\" src=\"https:\/\/landing.vuce.gob.pe\/olce-wp\/wp-content\/uploads\/2023\/02\/book.svg\" alt=\"\"><\/figure>\r\n                                <h3 class=\"text-black font-black text-base mt-0\"><\/h3>\r\n                <\/div>                            <\/div>\r\n            <div class=\"flex gap-2 items-center w-full justify-end mt-0\">\r\n                <span class=\"textourl mr-auto\">Ver la documentaci\u00f3n API<\/span>\r\n                <div class=\"max-h-8 max-w-8 h-8 w-8 arrow-button mt-0\">\r\n                    <img decoding=\"async\" src=\"https:\/\/landing.vuce.gob.pe\/olce-wp\/wp-content\/themes\/wp-theme\/assets\/icons\/whiteArrow.svg\" class=\"max-w-none arrow-icon\" alt=\"decoration\">\r\n                <\/div>\r\n            <\/div>\r\n        <\/a>\r\n    <\/div>\r\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>API Usa la API de OLCE de Per\u00fa. Te proporcionaremos todos los datos usados en el portal. Sigue los pasos descritos a continuaci\u00f3n para conseguir tu clave de registro. Reg\u00edstrate para obtener tu clave Introduce a continuaci\u00f3n tu email para enviarte la clave. Crea una Request Explora nuestra selecci\u00f3n de APIs y sum\u00e9rgete en el [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1314,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-201","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/landing.vuce.gob.pe\/olce-wp\/wp-json\/wp\/v2\/pages\/201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/landing.vuce.gob.pe\/olce-wp\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/landing.vuce.gob.pe\/olce-wp\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/landing.vuce.gob.pe\/olce-wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/landing.vuce.gob.pe\/olce-wp\/wp-json\/wp\/v2\/comments?post=201"}],"version-history":[{"count":51,"href":"https:\/\/landing.vuce.gob.pe\/olce-wp\/wp-json\/wp\/v2\/pages\/201\/revisions"}],"predecessor-version":[{"id":1754,"href":"https:\/\/landing.vuce.gob.pe\/olce-wp\/wp-json\/wp\/v2\/pages\/201\/revisions\/1754"}],"up":[{"embeddable":true,"href":"https:\/\/landing.vuce.gob.pe\/olce-wp\/wp-json\/wp\/v2\/pages\/1314"}],"wp:attachment":[{"href":"https:\/\/landing.vuce.gob.pe\/olce-wp\/wp-json\/wp\/v2\/media?parent=201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}