Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to request value of only some fields related to issues of a repository on Github from Github API?

When I am using a Github API URL like - https://api.github.com/repos/jquery/jquery/issues to get issues related information for jquery/jquery repository then the API returns information about issues with all the fields for a particular issue like -

"url": "https://api.github.com/repos/jquery/jquery/issues/2192",
    "labels_url": "https://api.github.com/repos/jquery/jquery/issues/2192/labels{/name}",
    "comments_url": "https://api.github.com/repos/jquery/jquery/issues/2192/comments",
    "events_url": "https://api.github.com/repos/jquery/jquery/issues/2192/events",
    "html_url": "https://github.com/jquery/jquery/issues/2192",

But I don't want these all fields for a particular issue. I want the API to return only these fields instead of returning all the fields-

created_at
closed_at
pull_request

I am not using CURL. I am only using the API URL to get JSON data from Github API using a jQuery function -

    var issues_data;
    $.getJSON(URL, function(json){
      issues_data= json;                                 
    });

$.getJSON(URL, function(json) makes use of the URL as specified above and request information related to issues of jquery/jquery repository. But the returned information contains every field about each issue that makes the result size bigger and makes it a heavy request.

I want the Github API to return only above 3 fields for each issue instead of all the fields.

If anybody can help by providing the format of the URL or a code then it would be good.

like image 872
gauravparmar Avatar asked Apr 07 '15 13:04

gauravparmar


People also ask

What is GitHub API rate limit?

Requests from GitHub Actions When using GITHUB_TOKEN , the rate limit is 1,000 requests per hour per repository. For requests to resources that belong to an enterprise account on GitHub.com, GitHub Enterprise Cloud's rate limit applies, and the limit is 15,000 requests per hour per repository.

How do I extract code review comments from GitHub?

You can click on the date in the header of the comment to get a URL to the comment. It will give you specific comment URL in address bar. You can copy and share the link with your colleagues to address those.


1 Answers

Here is an example URL which uses the three query criteria you specified in your question:

https://github.com/search?q=created%3A%3E%3D2013-02-01+closed%3A%3C2013-10-01&type=pr

This searches for all pull requests (type=pr) which were created on or after February 1, 2013 (created%3A%3E%3D2013-02-01) and were also closed before October 1, 2013 (closed%3A%3C2013-10-01).

like image 78
Tim Biegeleisen Avatar answered Nov 11 '22 02:11

Tim Biegeleisen