This is how my code looks like:
const axios = require('axios');
require('dotenv').config();
const api_key = process.env.PTERO_API_KEY;
const base_url = process.env.PTERO_BASE_URL;
module.exports = function requestPterodactylAPI(endpoint, method, headers = {}, params = {}, data = {}) {
return axios({
method: method,
url: `${base_url}/api/${endpoint}`,
headers: {
...headers,
'Accept': 'application/json',
'Authorization': `Bearer ${api_key}`
},
withCredentials: true,
params: params,
data: data,
validateStatus: function (status) {
return status >= 200 && status < 300; // default
},
jar: true,
withCredentials: true
})
.then(response => {
return response.data;
})
.catch(error => {
console.log(error);
throw error;
});
};
``` it might be that i use the wrong api URL but i have no idea what URL that has to be.
