检查回购是否使用GitHub API加星标 [英] Checking if a repo is starred with GitHub API

查看:130
本文介绍了检查回购是否使用GitHub API加星标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正尝试使用GitHub API(v3)检查并检查回购是否由通过身份验证的用户加星标。我可以成功列出登录用户发表的回购协议,但在检查回购是否由用户出演时,似乎无法使其工作。



例如..



(GET)/ user / starred?access_token = ...正确返回已加星标的完整回购列表。



(GET)/ user / starred / joynet / node?access_token = ...总是返回状态404,无论我使用的是拥有者/回购组合还是实际拥有该回购站点。



我还应该注意,除(GET)/ user / starred之外,我似乎无法访问/ user / starred中的任何内容。任何请求PUT,DELETE或POST到/ user / starred /:owner /:repo都会返回404,无论我做什么。



米应该使用这个API?我已经阅读了文档,并且我相信我正确地做了,但我似乎无法得到它的工作。

解决方案 div>

我能解决这个问题。问题是我浏览了文档,没有看到我必须在授权期间请求回购范围才能修改星号:)只需添加回购范围即可解决我的问题!



GitHub在这里简要地提到他们的范围: http://developer.github.com/v3/ oauth / ,但没有提到,主演需要回购范围。


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.

解决方案

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.

这篇关于检查回购是否使用GitHub API加星标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆