Я использую GitHub API в Метеор, но не смог решить эту проблему:GitHub API неподдерживаемый тип средств массовой информации 415
Этот код пытается получить общее количество трафика в течение определенного репо.
HTTP.call('GET', 'https://api.github.com/repos/hackmdio/hackmd/traffic/views',
{
headers:
{
'Content-Type':'application/json',
"Accept":"application/vnd.github.v3+json",
"User-Agent": "whales"
},
},
function(error, response) {
if (error) {
console.log('---------------------------error occurred-----------------------------------')
console.log('---------------------------error occurred-----------------------------------')
console.log(error);
} else {
console.log('--------------------------data got it!!-------------------------------------')
console.log('--------------------------data got it!!-------------------------------------')
console.log(response);
}
});
Ошибка:
{
"message": "If you would like to help us test the Repo Traffic API during its preview period, you must specify a custom media type in the 'Accept' header. Please see the docs for full details.",
"documentation_url": "https://developer.github.com/v3"
}
Я искал подобные вопросы и добавил "Content-Type" и "Accept", но это все еще не работает.
Я тогда попытался сделать это в Postman, а также в терминале с теми же заголовками, но эта ошибка продолжалась.
Большое спасибо.