Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking if a repo is starred with GitHub API

I'm currently attempting to check and see if a repo is starred by an authenticated user using the GitHub API (v3). I can successfully list the repos starred by the logged in user, but I can't seem to get it to work when checking if a repo is starred by the user.

For instance..

(GET) /user/starred?access_token=... correctly returns the full list of repos I have starred.

(GET) /user/starred/joynet/node?access_token=... always returns status 404, no matter what owner/repo combination I use or if I actually have that repo starred or not.

I should also note that I can't seem to access anything at /user/starred except (GET) /user/starred. Any request to PUT, DELETE, or POST to /user/starred/:owner/:repo returns a 404, no matter what I do.

Any idea how I'm supposed to be using this API? I've read the documentation, and this I believe I'm doing it correctly, but I just can't seem to get it work.

like image 443
Jason L. Avatar asked Dec 08 '12 14:12

Jason L.


People also ask

How do you see who has starred your GitHub repo?

These information is now available in the About section of the repository on the right side of the page beside the code section. The numbers before 'star' and 'watching' are clickable.

What does it mean to star a GitHub repo?

Users on the GitHub website are able to "star" other people's repositories, thereby saving them in their list of Starred Repos. Some people use "stars" to indicate that they like a project, other people use them as bookmarks so they can follow what's going on with the repo later.

How do I get my GitHub API repository?

You can use the github api for this. Hitting https://api.github.com/users/USERNAME/repos will list public repositories for the user USERNAME.

Does GitHub use REST API?

GitHub REST APIs allow users to communicate with GitHub and extract the desired information effectively by using an authenticated access token. With GitHub REST APIs, you can easily create and manage repositories, issues, branches, and more, with only a few lines of code.


1 Answers

I was able to solve this problem. The issue was I skimmed the documentation and didn't see I had to request the repo scope during authorization to be able to modify stars :) Simply adding the "repo" scope fixed my issue!

GitHub briefly mentions their scopes here: http://developer.github.com/v3/oauth/ but no where was it mentioned that starring needs the "repo" scope.

like image 89
Jason L. Avatar answered Sep 20 '22 16:09

Jason L.