Reputation: 967
I want to search in github api with my query. For example:
https://github.com/antirez/redis/issues?q=is%3Aopen+is%3Aissue+sample
I want to convert this link to github api link. How can i do this? Is it possible?
Upvotes: 0
Views: 719
Reputation: 137182
The API documentation is pretty clear:
Search issues
Find issues by state and keyword. (This method returns up to 100 results per page.)
GET /search/issues
I'm reformatting the parameters here, since Stack Overflow Markdown doesn't support tables:
Parameters
q
, a string: The search terms.sort
, a string: The sort field. Can becomments
,created
, orupdated
. Default: results are sorted by best match.order
, a string: The sort order ifsort
parameter is provided. One ofasc
ordesc
. Default:desc
The
q
search term can also contain any combination of the supported issue search qualifiers:
I'll skip over most of these, but it looks like you may be interested in
state
Filter issues based on whether they’re open or closed.
or
is
Searches for items within repositories that match a certain state, such asopen
,closed
, ormerged
Note that this endpoint is only for Issues, so your is:issue
parameter is unnecessary.
Upvotes: 1
Reputation: 90
I think this is what you are looking for:
https://api.github.com/search/issues?q=sample+user:antirez+repo:redis+state:open
This returns a json document that contains a list of objects representing the issues that match the search criteria. However this returns a broader set of issues.
The difference between the result set you provided because the issue search via the GUI is only searching the comments. To get the exact result you get from the front-end page you need to add the in:comments
restriction to the search, the url for that would look like this:
https://api.github.com/search/issues?q=sample+user:antirez+repo:redis+state:open+in:comments
You can browse the GitHub API Documentation and more specifically this endpoint's documentation for more details.
Let me know if you need any other clarification or if this was not quite you where looking for
Upvotes: 0