Simplest API Request - No data?
Posted: Sun Mar 24, 2019 7:00 pm
Hi there,
I'm trying the utmost simplest API request - I'm simply trying to console.log the API response of '/Platforms'.
Here is the URL I'm hitting: https://api.thegamesdb.net/Platforms/?a ... E___KEY___
The response I'm getting is only the following without any platform data.
When using my private key:
{ remaining_monthly_allowance: 0,
extra_allowance: 5999,
allowance_refresh_timer: null }
and when using the public key:
{ remaining_monthly_allowance: 1498,
extra_allowance: 0,
allowance_refresh_timer: 2549259 }
I'm sure I'm missing something ridiculously simple.
Here is the code I'm attempting to run:
I'm trying the utmost simplest API request - I'm simply trying to console.log the API response of '/Platforms'.
Here is the URL I'm hitting: https://api.thegamesdb.net/Platforms/?a ... E___KEY___
The response I'm getting is only the following without any platform data.
When using my private key:
{ remaining_monthly_allowance: 0,
extra_allowance: 5999,
allowance_refresh_timer: null }
and when using the public key:
{ remaining_monthly_allowance: 1498,
extra_allowance: 0,
allowance_refresh_timer: 2549259 }
I'm sure I'm missing something ridiculously simple.
Here is the code I'm attempting to run:
Code: Select all
const fetch = require("node-fetch");
module.exports = {
getPlatforms
};
const API_URL = 'https://api.thegamesdb.net';
const API_KEY = '?apikey=___MY__PRIVATE___KEY___';
async function getPlatforms() {
console.log(API_URL + '/Platforms' + '/' + API_KEY);
fetch(API_URL + '/Platforms' + '/' + API_KEY)
.then(res => res.json())
.then(data => {
console.log(data)
})
.catch(err => {
console.log('error:', data)
});
}