github-api

RESTful API design: best way to CRUD lightweight connections?

China☆狼群 提交于 2019-12-10 15:28:29
问题 (Pardon the question title; hard to summarize this question.) On Facebook, you like things. On Twitter, you follow people. On GitHub, you also follow people and star repos and gists. All of these cases are pretty similar: those connections are lightweight, not really "resources" themselves. E.g. none of those three APIs expose public IDs for such connections. This raises the question: what's the "best" (in terms of REST) way to expose an API for creating/querying/deleting those connections?

How to update a fork from it's original via the Github API

你离开我真会死。 提交于 2019-12-10 13:21:50
问题 I've created a fork of a github repository via the github API. Now, later on, I want to pull any updates from the origin repository into the fork. This should always be a fast-forward in my use case. I have read access to the origin repository and read-write to the fork. I thought of maybe creating a Pull Request then accepting (both of which you can do via the API) but this creates noise (Pull Requests being created and destroyed) and just doesn't seem right. Is there any way to do this via

Decoding base64 while using GitHub API to Download a File

守給你的承諾、 提交于 2019-12-10 11:23:01
问题 I am using the GitHub API to download a file from GitHub. I have been able to successfully authenticate as well as get a response from github, and see a base64 encoded string representing the file contents. Unfortunately, I get an unusual error (string length is not a multiple of 4) when decoding the base64 string. The HTTP request is illustrated below: GET /repos/:owner/:repo/contents/:path The (partial) response is illustrated below: { "name":...., "download_url":...", "type":"file",

How to upload github asset file using CURL

折月煮酒 提交于 2019-12-10 10:43:26
问题 I want to upload a file on my desktop called 'hello.txt' to my git repository which has a release. How do I do this? I read the git documentation but it says something like : POST https://<upload_url>/repos/:owner/:repo/releases/:id/assets?name . How to do this in CURL. I did not understand this. How to post this file as a release asset to my github release? Thanks 回答1: curl \ -H "Authorization: token $GITHUB_TOKEN" \ -H "Content-Type: $(file -b --mime-type $FILE)" \ --data-binary @$FILE \

github - enable branch lock

。_饼干妹妹 提交于 2019-12-10 10:27:12
问题 As a GitHub administrator, I would like to lock a particular branch in GitHub for all users. For e.g. if I do not want anyone to push to Master/Production or a Project branch, how can I do that. Instead of using any client side hooks, is there a way to lock a branch on GitHub server directly ? Are there any third party tools/api's/scripts which can help achieve this ? 回答1: The easiest solution is to have that branch in its own repo (for which no collaborators) are declared. Otherwise, GitHub

Creating a fork with the GitHub V3 API (REST)

匆匆过客 提交于 2019-12-10 07:35:51
问题 I'm trying to fork a repo using the GitHub V3 API via REST, however, I am having issues making a POST request as per the docs (https://developer.github.com/v3/repos/forks/#create-a-fork). Basically, what I have so far: - A logged-in user with an OAuth Token - A POST request setup to the API (url - https://api.github.com/repos/carmichaelalonso/infiniteflight/forks/) - I am testing this with hurl.it to begin with. - Headers in the request: one has the name 'Authorization' with the value 'token

Posting images to Gists via the HTTP API

江枫思渺然 提交于 2019-12-10 03:58:03
问题 Is it possible to post binary files (such as images) to GitHub gists via the HTTP api? In particular, the Gist api docs describe how to post files with string contents. There are two problems here for uploading images. One is that the api has something like a 64kb limit on POST requests (although this is not documented), which is pretty small for image files. Second, it's not obvious what encoding should be used on the wire for image files. It's easy to do this by cloning the git repository

file_get_contents() gets 403 from api.github.com every time

风格不统一 提交于 2019-12-10 02:07:54
问题 I call myself an experienced PHP developer, but this is one drives me crazy. I'm trying to get release informations of a repository for displaying update-warnings, but I keep returning 403 errors. For simplifying it I used the most simple usage of GitHubs API: GET https://api.github.com/zen. It is kind of a hello world. This works directly in the browser with a plain curl https://api.github.com/zen in a terminal with a PHP-Github-API-Class like php-github-api This works not with a simple file

How do i get the list of Reviewers for a pull request using Github api?

假装没事ソ 提交于 2019-12-10 02:04:15
问题 I need the list of reviewers for a PR, and the Review Requests API present in Github only provides me the requested reviewers which becomes empty once the reviewers have accepted their invitations. I also tried the Reviews API to get all reviews and then get unique users, but that seems to be only for users who enter one and not for those who have accepted the request review invitation and never posted a review. 回答1: Just went through this problem with the following solution. According to

Jenkins configuration and security issues

瘦欲@ 提交于 2019-12-09 09:15:30
问题 This is the first time I am using Jenkins and I have gone through several online articles but couldn’t find satisfactory answers. We have .Net project, and we are using private GitHub repository. Now I am trying to build CI server with Jenkins. Idea is to whenever developer push the code to GitHub we want to build the project on CI server. I have already installed Jenkins (v 1.646) and GitHub,Git and MSBuild Plugin on CI server. After working with Jenkins for last several hours i have now