GitHub API实战(包含Graphql API)

GitHub API

These days, we need to implement a tool to help our team get access to Github service so that we can analysis some data.
When searching github API, we find something interesting and useful.

Github API has developed to 2 main version since now.
- Github API V3
- Github Graphql API V4

1 Github API V3

  1. get diff by commit sha
    /repos/owner:/project:/commits/sha:
public static String getDiffByCommit(String commitSHA,String project) {
    String restApi = "repos/bizx/"+project+"/commits/"+commitSHA;
    String url = BASEURL+restApi + "?access_token=" + AUTH;
    String result = "";
    OkHttpClient okHttpClient = new OkHttpClient.Builder().
        connectTimeout(10, TimeUnit.SECONDS)
        .readTimeout(20, TimeUnit.SECONDS).build();
    Request request = new Request.Builder()
        .url(url)
        .header(

你可能感兴趣的:(编程实录,github,github,api,graphql)