API Documentation Page Generator

API Documentation Page Generator

Structure and document your endpoint specifications.

Service API Documentation
Version: 1.0 | Base URL: /api/v1

Endpoints

Add New Endpoint

Parameters (Query/Path)

Current Endpoints

Document Metadata

No endpoints defined. Use the builder to start documenting your API.

'; } endpoints.forEach(ep => { // --- 1. Render Dashboard Output --- // Determine Method Color Class let methodClass = 'api-method-get'; if (ep.method === 'POST') methodClass = 'api-method-post'; else if (ep.method === 'PUT') methodClass = 'api-method-put'; else if (ep.method === 'DELETE') methodClass = 'api-method-delete'; let cardHtml = `
${ep.method} ${baseUrl}${ep.path}
Description

${ep.description}

Parameters (${ep.params.length})
${ep.params.map(p => ` `).join('')}
NameTypeNotes
${p.name} ${p.type} ${p.desc}
Example Response (200 OK)
${ep.response}
`; docContainer.innerHTML += cardHtml; // --- 2. Render Builder List --- const listItem = document.createElement('div'); listItem.className = 'api-list-item'; listItem.innerHTML = ` [${ep.method}] ${ep.path} `; builderListContainer.appendChild(listItem); }); }; // --- Attach Listeners to Config Inputs --- document.getElementById('conf-title').addEventListener('input', apiRenderAll); document.getElementById('conf-version').addEventListener('input', apiRenderAll); document.getElementById('conf-base-url').addEventListener('input', apiRenderAll); // Initial render apiRenderAll(); // --- PDF Export --- document.getElementById('api-download-btn').addEventListener('click', function() { apiRenderAll(); // Final sync before capture const element = document.getElementById('api-output-page'); const footer = element.querySelector('.api-pdf-footer'); // Show footer for PDF footer.style.display = 'block'; const opt = { margin: 0.4, filename: document.getElementById('conf-title').value.replace(/\s+/g, '_') + '_Doc_v' + document.getElementById('conf-version').value + '.pdf', image: { type: 'jpeg', quality: 0.98 }, html2canvas: { scale: 2 }, jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' } }; html2pdf().set(opt).from(element).save().then(function(){ footer.style.display = 'none'; }); }); });
Scroll to Top