API usage example in JavaScript
To help you get started with using Feature Upvote’s public REST API, here’s an example in Vanilla JavaScript you can copy and paste. It will list all of your feedback boards.
// Base URL for the Feature Upvote API v1const BASE_URL = 'https://api.featureupvote.com/api/v1';// Replace this value with your actual Feature Upvote API keyconst API_KEY = 'YOUR_API_KEY_HERE';
/** * Fetches boards from the Feature Upvote API. */async function fetchBoardsList() {
// Construct the API endpoint for listing boards const endpoint = `${BASE_URL}/boards`;
try { // Perform standard network fetch with authorization headers const response = await fetch(endpoint, { method: 'GET', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' } });
// Check for HTTP errors (e.g. 401 Unauthorized, 404 Not Found) if (!response.ok) { throw new Error(`HTTP Error: ${response.status} - ${response.statusText}`); }
// Parse the JSON data stream const boardsData = await response.json();
// Output the results console.log(`Successfully retrieved ${boardsData.length} boards`); console.log(boardsData);
} catch (error) { console.error('Failed to communicate with Feature Upvote API:', error); }}
fetchBoardsList();