I'm trying to create a GitHub issue using the GitHub API, and I found this https://github.com/ceceliacreates/APITools which is exactly what I need, but it keeps showing me my GitHub API was not found.
Following is the code:
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
I was checking the official GitHub website for the API usage, but I can't find anything wrong. Can anyone help me with the situation?
[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
}
}