Code Search API for multiple-repo queries #54835
-
Select Topic AreaQuestion BodyIs there an API for the code search that supports searching across multiple of my own repositories? I have found docs about search, but it seems to only work in a single repository and not be related to the newest version of search that's much more useful |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Yes, GitHub provides a code search API that allows you to search across multiple repositories, including your own. This API is part of the GitHub REST API, which allows you to interact with GitHub programmatically. To use the code search API, you can send a GET request to the following endpoint: In the query string of the request, you can specify the search terms using the Here's an example request that searches for the term "hello world" in all of your repositories: In this example, replace "your-username" with your GitHub username. The You can also authenticate your requests using a personal access token (PAT) to access private repositories or to increase your rate limit. To do this, add the following header to your request: Replace |
Beta Was this translation helpful? Give feedback.
-
I am using a token with all privileged given to it, but then also its showing t "message": "Bad credentials", |
Beta Was this translation helpful? Give feedback.
Yes, GitHub provides a code search API that allows you to search across multiple repositories, including your own. This API is part of the GitHub REST API, which allows you to interact with GitHub programmatically.
To use the code search API, you can send a GET request to the following endpoint:
https://api.github.com/search/code
In the query string of the request, you can specify the search terms using the
q
parameter. You can also specify additional parameters to filter the search results, such as the repository or organization to search in, the file path, and the language.Here's an example request that searches for the term "hello world" in all of your repositories:
GET https://api.gi…