{ "platform-version": "3.0", "modules": { "common": { "location": { "full_page_app": { "url": "index.html", "icon": "icon.svg" } }, "functions": { "fetchAuthorsSync": { "timeout": 20 } } }, "contact": {} }, "engines": { "node": "18.17.1", "fdk": "9.7.0" } } ================================================================================= /** * Platform 3.0 Serverless - with fetch */ exports = { fetchAuthorsSync: async function() { console.log('Server: Fetching authors'); const apiKey = '6j-kIn0jxMIQyh3vzv9pKg'; const url = 'https://ebsa.myfreshworks.com/crm-sandbox/sales/api/custom_module/cm_author_master/view/31006006652'; try { const response = await fetch(url, { method: 'GET', headers: { 'Authorization': 'Token token=' + apiKey, 'Content-Type': 'application/json' } }); console.log('Server: Response status:', response.status); if (!response.ok) { throw new Error('API error: ' + response.status); } const data = await response.json(); const authors = data.cm_author_master.slice(0, 25); console.log('Server: Returning', authors.length, 'authors'); return authors; } catch (error) { console.error('Server: Error:', error.message); throw error; } } }; =================================================================================
Loading authors...