Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 3
Message 1 of 7

Listing all project releases via the API

Solved! Go to Solution.

Hello I am trying to list all releases from a private repo, and I just keep seeing 404 errors.

 

(Private Repo)

https://github.com/runtman/testy-mctesttest

 

This has two releases:

 

Screenshot from 2019-01-31 19-22-30.png

According to this documentation:

 

https://developer.github.com/v3/repos/releases/

 

It says I need to use the following:

 

GET /repos/:owner/:repo/releases

 

However, when I use this syntax:

 

curl_setopt($curl,CURLOPT_URL,"https://api.github.com/repos/runtman/testy-mctesttest/releases/")

 

I get a 404 returned from the API.

HTTP/1.1 404 Not Found
Server: GitHub.com
Date: Thu, 31 Jan 2019 19:15:48 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 87
Status: 404 Not Found

What am I doing wrong? I have tried with the id's instead of names and that didn't work either, I am definitley authing fine as if I remove that then I get a access denied error instead.

6 Replies
Solution
GitHub Staff
Message 2 of 7

Re: Listing all project releases via the API

Hi @runtman

 

I believe the answer to this may be as easy as removing the trailing slash from the URL you are trying to get. Using the node Repository as an example, I am able to fetch:

 

https://api.github.com/repos/nodejs/node/releases

 

But, when I try to fetch 

 

https://api.github.com/repos/nodejs/node/releases/

 

I get a 404. 

 

Let me know if this works!

Copilot Lvl 3
Message 3 of 7

Re: Listing all project releases via the API

That's embararsing, I do get results but not what I would expect:

 

Array
(
    [url] => https://api.github.com/repos/runtman/testy-mctesttest/releases
    [content_type] => application/json; charset=utf-8
    [http_code] => 200
    [header_size] => 1208
    [request_size] => 285
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0.443677
    [namelookup_time] => 0.012436
    [connect_time] => 0.105148
    [pretransfer_time] => 0.312936
    [size_upload] => 0
    [size_download] => 5
    [speed_download] => 11
    [speed_upload] => 0
    [download_content_length] => 5
    [upload_content_length] => -1
    [starttransfer_time] => 0.44362
    [redirect_time] => 0
    [redirect_url] => 
    [primary_ip] => 192.30.253.117
    [certinfo] => Array
        (
        )

    [primary_port] => 443
    [local_ip] => 192.168.1.67
    [local_port] => 39770
)

 

Is this because it's private? I see no download urls etc 

Copilot Lvl 3
Message 4 of 7

Re: Listing all project releases via the API

HTTP/1.1 200 OK
Server: GitHub.com
Date: Sat, 02 Feb 2019 23:47:04 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 5
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4993
X-RateLimit-Reset: 1549154013
Cache-Control: private, max-age=60, s-maxage=60
Vary: Accept, Authorization, Cookie, X-GitHub-OTP
ETag: "847ca9e05b55c0f672831817ef26025b"
X-OAuth-Scopes: admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion
X-Accepted-OAuth-Scopes: repo
X-GitHub-Media-Type: github.v3; format=json
Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
X-GitHub-Request-Id: 9F5C:6489:64DEC0:DD811A:5C562BF7

[

]

 

So that's dumping info and output of the curl request, I don't see anything useful here

Copilot Lvl 3
Message 5 of 7

Re: Listing all project releases via the API

I need to get good, thanks :)

GitHub Staff
Message 6 of 7

Re: Listing all project releases via the API

Hey @runtman!

 

I believe the issue here is that you're creating releases via Git Tags, and not actually creating releases.

 

If you want to be able to list them via this API, you'll have to do a bit more! Otherwise, you should be able to use the tag list API to see the information on that page. 

Copilot Lvl 3
Message 7 of 7

Re: Listing all project releases via the API

Aha! Thanks sir.