import axios from 'axios'; import dotenv from 'dotenv'; // Load environment variables from .env file dotenv.config(); // Base64 encode username and password for Basic Authentication const authToken = Buffer.from(`${process.env.ONET_USERNAME}:${process.env.ONET_PASSWORD}`).toString('base64'); // Define the API endpoint to test const url = 'https://services.onetcenter.org/ws/mnm/interestprofiler/questions?start=1&end=5'; // Send a GET request with Authorization header axios.get(url, { headers: { 'Authorization': `Basic ${authToken}`, 'Accept': 'application/json' } }) .then(response => { console.log('API Response:', response.data); }) .catch(error => { console.error('Error:', error.response ? error.response.data : error.message); });