How can I use github api to get all tags or releases for a project?
This morning I received an answer to this same question that I posted to the github support team. Not sure how I can attribute the answer correctly but here is their response.
Quote from Ivan Žužak of Github support team
You can get a list of all tags for a repository using this API call:
http://developer.github.com/v3/repos/#list-tags
So, for example, making the following cURL request will return the list of tags for the libgit2/libgit2 repository:
$ curl -v "https://api.github.com/repos/libgit2/libgit2/tags"
Note: for the releases specifically of a GitHub repo, you now have (since Sept. 25th, 2013), an api to list all the releases:
List releases for a repository
- Users with push access to the repository will receive all releases (i.e., published releases and draft releases).
Users with pull access will receive published releases only.
GET /repos/:owner/:repo/releases
Response
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
{
"url": "https://api.github.com/repos/octocat/Hello-World/releases/1",
"html_url": "https://github.com/octocat/Hello-World/releases/v1.0.0",
"assets_url": "https://api.github.com/repos/octocat/Hello-World/releases/1/assets",
"upload_url": "https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name}",
"id": 1,
"tag_name": "v1.0.0",
"target_commitish": "master",
"name": "v1.0.0",
"body": "Description of the release",
"draft": false,
"prerelease": false,
"created_at": "2013-02-27T19:35:32Z",
"published_at": "2013-02-27T19:35:32Z"
}
]
Get a single release
GET /repos/:owner/:repo/releases/:id
It's possible, but the documentation is perhaps not in the place you'd expect it to be.
http://developer.github.com/v3/git/refs/
You can also request a sub-namespace. For example, to get all the tag references, you can call:
GET /repos/:owner/:repo/git/refs/tags