Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create and publish a Release using GitHub API v3 with curl?

According to the github api documentation (https://developer.github.com/v3/repos/releases/) I need to send a post request including a payload that requires the tag_name. So I proceeded to build the following curl request in order to try and publish an existing tag (0.0.5)

curl -v -i -X POST -H "Content-Type:application/json" -H "Authorization: token 1a1a1a11a11a11a11a11a11a11a1a11a1a1a1a1" https://api.github.com/repos/codeStyler87/test-tags/releases -d '{"tag_name":"0.0.5","target_commitish": "develop","name": "0.0.5","body": "Description of the release","draft": false,"prerelease": false}'

but i get HTTP/1.1 404 Not Found.

What's wrong with my request?

Am I using the API correctly?

Why GitHub API dont provide an accurate error message?

like image 604
fndg87 Avatar asked May 17 '16 16:05

fndg87


People also ask

How do I fetch API in GitHub?

Now that you have a fair idea of where your request would be made and the structure of the data you would be getting, you can now make a request to the API with your code comfortably. A fetch request is shown below: 1fetch(URL, init:{method: 'GET', headers:{}, body}) 2 . then(response => response.


1 Answers

Your access token misses the privilege public_repo.

like image 122
Vampire Avatar answered Sep 21 '22 01:09

Vampire