1

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
  }
}
1

1 Answer 1

0

That code is from github.com/ceceliacreates/APITools/CreateIssuesFromJSON/CreateIssuesFromJSON.js.
Except with fetch("https://api.github.com/repos/${user}/${repo}/issues")

It seems to follow the header I mentioned before.

You need to double-check the token used, and its associated scope.

And try to use the library itself.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.