我是一个非常新的程序员。
我正在尝试使用 GitHub API 创建一个 GitHub 问题,我发现这个https://github.com/ceceliacreates/APITools正是我需要的,但它一直显示我的 GitHub API 没有找到。
以下是代码:
createIssuesFromJSON = function(file) {
file.forEach(issue => {
fetch(`https://api.github.com/repos/${user}/${repo}/issues/`, {
method: 'POST',
body: JSON.stringify(issue),
headers: {'Content-Type': 'application/json', 'Authorization': `${process.env.TOKEN}`}
})
.then((res)=>{
console.log(res);
return res.json();
})
.then(json => {
})
})
}
createIssuesFromJSON(file);
error: 404 URL not found,我正在查看Github官方网站的API使用情况,但我找不到任何错误。任何人都可以帮助我解决这种情况...谢谢!
[Symbol(Response internals)]: {
url: 'https://api.github.com/repos/{my github}/{my repo}/issues/',
status: 404,
statusText: 'Not Found',
headers: Headers { [Symbol(map)]: [Object: null prototype] },
counter: 0
}
}