Skip to main content

이 버전의 GitHub Enterprise는 다음 날짜에 중단되었습니다. 2024-09-25. 중요한 보안 문제에 대해서도 패치 릴리스가 이루어지지 않습니다. 더 뛰어난 성능, 향상된 보안, 새로운 기능을 위해 최신 버전의 GitHub Enterprise Server로 업그레이드합니다. 업그레이드에 대한 도움말은 GitHub Enterprise 지원에 문의하세요.

이제 REST API의 버전이 지정되었습니다. 자세한 내용은 "API 버전 관리 정보"를 참조하세요.

검색에 대한 REST API 엔드포인트

REST API를 사용하여 GitHub Enterprise Server에서 특정 항목을 검색합니다.

REST API를 사용하여 찾으려는 특정 항목을 검색할 수 있습니다. 예를 들어 리포지토리에서 사용자 또는 특정 파일을 찾을 수 있습니다. Google에서 검색을 수행하는 방법을 생각해 보세요. 원하는 결과(또는 찾고 있는 몇 가지 결과)를 찾을 수 있도록 설계되었습니다. Google에서 검색하는 것과 마찬가지로 요구 사항에 가장 적합한 항목을 찾을 수 있도록 검색 결과의 몇 페이지를 표시하려는 경우가 있습니다. 요구를 충족하기 위해 GitHub Enterprise Server REST API는 각 검색에 대해 최대 1,000개의 결과를 제공합니다.

쿼리를 사용하여 검색 범위를 좁힐 수 있습니다. 검색 쿼리 구문에 대한 자세한 내용은 검색에 대한 REST API 엔드포인트을(를) 참조하세요.

검색 결과 순위 지정

다른 정렬 옵션이 쿼리 매개 변수로 제공되지 않는 한 결과는 내림차순으로 가장 일치하는 항목별로 정렬됩니다. 여러 요소가 결합되어 가장 관련성이 높은 항목을 결과 목록의 맨 위로 끌어올립니다.

속도 제한

Note

기본적으로 GitHub Enterprise Server에 대한 트래픽률 제한은 사용하지 않도록 설정됩니다. 인스턴스에 대한 트래픽률 제한을 확인하려면 사이트 관리자에게 문의하세요.

REST API에는 검색에 대한 사용자 지정 속도 제한이 있습니다. 인증된 요청의 경우 검색 코드 엔드포인트를 제외한 모든 검색 엔드포인트에 대해 분당 최대 30개의 요청 인증되지 않은 요청의 경우 속도 제한을 사용하면 분당 최대 10개의 요청을 만들 수 있습니다.

현재 속도 제한 상태를 확인하는 방법에 대한 자세한 내용은 속도 제한을 참조하세요.

검색 쿼리 생성

검색의 각 엔드포인트는 쿼리 매개 변수를 사용하여 GitHub Enterprise Server에 대한 검색을 수행합니다. 엔드포인트 및 쿼리 매개 변수를 포함하는 예제는 개별 엔드포인트를 참조하세요.

쿼리는 GitHub Enterprise Server에서 지원되는 검색 한정자의 조합을 포함할 수 있습니다. 검색 쿼리의 형식은 다음과 같습니다.

SEARCH_KEYWORD_1 SEARCH_KEYWORD_N QUALIFIER_1 QUALIFIER_N

예를 들어 README 파일에서 GitHubOctocat이라는 단어가 포함된 defunkt가 소유한 모든 _리포지토리_를 검색하려는 경우 검색 리포지토리 엔드포인트와 함께 다음 쿼리를 사용합니다.

GitHub Octocat in:readme user:defunkt

참고: 언어의 기본 HTML 인코더를 사용하여 쿼리 문자열을 구성해야 합니다. 예시:

// JavaScript
const queryString = 'q=' + encodeURIComponent('GitHub Octocat in:readme user:defunkt');

사용 가능한 한정자의 전체 목록, 해당 형식, 사용 방법의 예는 GitHub에서 검색을(를) 참조하세요. 연산자를 사용하여 특정 수량, 날짜를 일치시키거나 결과를 제외하는 방법에 대한 자세한 내용은 검색 구문 이해을(를) 참조하세요.

쿼리 길이 제한 사항

다음과 같은 쿼리는 사용할 수 없습니다.

  • 256자보다 긴 쿼리(연산자 또는 한정자 포함 안 함).
  • 5개 이상의 AND``OR, NOT 연산자.

검색 쿼리는 “유효성 검사 실패” 오류 메시지를 반환합니다.

검색 범위 제한

모든 사용자에 대해 REST API를 빠르게 유지하기 위해 쿼리에서 리포지토리 수를 제한합니다. REST API는 필터와 일치하고 해당 리포지토리의 결과를 반환하는 최대 4,000개의 리포지토리를 찾습니다.

시간 제한 및 불완전한 결과

모든 사용자가 REST API를 계속해서 빠르게 수행할 수 있도록 개별 쿼리를 실행할 수 있는 시간을 제한합니다. 시간 제한을 초과하는 쿼리의 경우 API는 제한 시간 이전에 이미 발견된 일치 항목을 반환하고 응답에는 incomplete_results 속성이 true로 설정됩니다.

시간 제한에 도달한다고 해서 검색 결과가 불완전하다는 의미는 아닙니다. 더 많은 결과가 발견되었을 수도 있지만 그렇지 않을 수도 있습니다.

액세스 오류 또는 누락된 검색 결과

성공적으로 인증하고 검색 쿼리의 리포지토리에 액세스할 수 있어야 합니다. 그렇지 않으면 “유효성 검사 실패” 메시지와 함께 422 Unprocessable Entry 오류가 표시됩니다. 예를 들어 GitHub에 로그인할 때 액세스할 수 없는 리소스를 요청하는 repo:, user: 또는 org: 한정자가 쿼리에 포함된 경우 검색이 실패합니다.

검색 쿼리가 여러 리소스를 요청하는 경우 응답에는 액세스 권한이 있는 리소스만 포함되며 반환되지 않은 리소스를 나열하는 오류 메시지가 표시되지 않습니다.

예를 들어 검색 쿼리가 octocat/testcodertocat/test 리포지토리를 검색하지만 octocat/test 액세스 권한만 있는 경우 응답에 octocat/test에 대한 검색 결과가 표시되고 codertocat/test에 대한 검색 결과는 표시되지 않습니다. 이 동작은 GitHub에서 검색이 작동하는 방식을 모방합니다.

텍스트 일치 메타데이터

GitHub에서 코드 조각 및 강조 표시에서 제공하는 컨텍스트를 검색 결과에 사용할 수 있습니다. 검색 엔드포인트는 검색 결과를 표시할 때 일치하는 검색어를 강조 표시할 수 있는 추가 메타데이터를 반환합니다.

요청은 응답에서 해당 텍스트 조각을 수신하도록 선택할 수 있으며, 모든 조각에는 일치하는 각 검색 용어의 정확한 위치를 식별하는 숫자 오프셋이 함께 제공됩니다.

검색 결과에서 이 메타데이터를 얻으려면 Accept 헤더에 text-match 미디어 형식을 지정합니다.

application/vnd.github.text-match+json

text-match 미디어 형식을 지정하면 텍스트 내의 검색어 위치 및 검색어를 포함하는 text_matches에 대한 정보를 제공하는 추가 키가 property라는 JSON 페이로드에 수신됩니다. text_matches 배열 내에서 각 개체에는 다음 특성이 포함됩니다.

속성설명
object_url검색어 중 하나와 일치하는 문자열 속성이 포함된 리소스의 URL입니다.
object_type지정된 object_url에 있는 리소스 형식의 이름입니다.
propertyobject_url에 있는 리소스 속성의 이름입니다. 해당 속성은 검색어 중 하나와 일치하는 문자열입니다. (object_url에서 반환된 JSON에 fragment의 전체 콘텐츠는 이 이름의 속성에 있습니다.)
fragmentproperty 값의 하위 집합입니다. 하나 이상의 검색어와 일치하는 텍스트 조각입니다.
matchesfragment에 있는 하나 이상의 검색어의 배열입니다. 인덱스(즉, “오프셋”)는 조각을 기준으로 합니다. (property전체 콘텐츠를 기준으로 하지 않습니다.)

예시

curl 명령 및 위의 예제 이슈 검색을 사용한 API 요청은 다음과 같습니다.

curl -H 'Accept: application/vnd.github.text-match+json' \
'http(s)://HOSTNAME/api/v3/search/issues?q=windows+label:bug \
+language:python+state:open&sort=created&order=asc'

응답에는 각 검색 결과에 대한 text_matches 배열이 포함됩니다. 아래 JSON에는 text_matches 배열에 두 개의 개체가 있습니다.

문제의 body 속성에서 첫 번째 텍스트 일치가 발생했습니다. 문제 본문에서 텍스트 조각이 표시됩니다. 검색어(windows)는 해당 조각 내에 두 번 나타나며 각 항목에 대한 인덱스가 있습니다.

문제의 주석 중 하나의 body 속성에서 두 번째 텍스트 일치가 발생했습니다. 문제 주석에 대한 URL이 있습니다. 물론 주석 본문에서 텍스트 조각이 표시됩니다. 검색어(windows)는 해당 조각 내에 한 번 나타납니다.

{
  "text_matches": [
    {
      "object_url": "https://api.github.com/repositories/215335/issues/132",
      "object_type": "Issue",
      "property": "body",
      "fragment": "comprehensive windows font I know of).\n\nIf we can find a commonly
      distributed windows font that supports them then no problem (we can use html
      font tags) but otherwise the '(21)' style is probably better.\n",
      "matches": [
        {
          "text": "windows",
          "indices": [
            14,
            21
          ]
        },
        {
          "text": "windows",
          "indices": [
            78,
            85
          ]
        }
      ]
    },
    {
      "object_url": "https://api.github.com/repositories/215335/issues/comments/25688",
      "object_type": "IssueComment",
      "property": "body",
      "fragment": " right after that are a bit broken IMHO :). I suppose we could
      have some hack that maxes out at whatever the font does...\n\nI'll check
      what the state of play is on Windows.\n",
      "matches": [
        {
          "text": "Windows",
          "indices": [
            163,
            170
          ]
        }
      ]
    }
  ]
}

Search code

Searches for query terms inside of a file. This method returns up to 100 results per page.

When searching for code, you can get text match metadata for the file content and file path fields when you pass the text-match media type. For more details about how to receive highlighted search results, see Text match metadata.

For example, if you want to find the definition of the addClass function inside jQuery repository, your query would look something like this:

q=addClass+in:file+language:js+repo:jquery/jquery

This query searches for the keyword addClass within a file's contents. The query limits the search to files where the language is JavaScript in the jquery/jquery repository.

Considerations for code search:

Due to the complexity of searching code, there are a few restrictions on how searches are performed:

  • Only the default branch is considered. In most cases, this will be the master branch.
  • Only files smaller than 384 KB are searchable.
  • You must always include at least one search term when searching source code. For example, searching for language:go is not valid, while amazing language:go is.

"Search code"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 어떤 권한도 필요하지 않습니다.

공용 리소스만 요청되는 경우 인증 없이 이 엔드포인트를 사용할 수 있습니다.

"Search code"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

쿼리 매개 변수
속성, 형식, 설명
q string Required

The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub Enterprise Server. The REST API supports the same qualifiers as the web interface for GitHub Enterprise Server. To learn more about the format of the query, see Constructing a search query. See "Searching code" for a detailed list of qualifiers.

sort string

Sorts the results of your query. Can only be indexed, which indicates how recently a file has been indexed by the GitHub Enterprise Server search infrastructure. Default: best match

: indexed

order string

Determines whether the first search result returned is the highest number of matches (desc) or lowest number of matches (asc). This parameter is ignored unless you provide sort.

기본값: desc

다음 중 하나일 수 있습니다.: desc, asc

per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

기본값: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

기본값: 1

"Search code"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

304

Not modified

403

Forbidden

422

Validation failed, or the endpoint has been spammed.

503

Service unavailable

"Search code"에 대한 코드 샘플

요청 예제

get/search/code
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "http(s)://HOSTNAME/api/v3/search/code?q=Q"

Response

Status: 200
{ "total_count": 7, "incomplete_results": false, "items": [ { "name": "classes.js", "path": "src/attributes/classes.js", "sha": "d7212f9dee2dcc18f084d7df8f417b80846ded5a", "url": "https://HOSTNAME/repositories/167174/contents/src/attributes/classes.js?ref=825ac3773694e0cd23ee74895fd5aeb535b27da4", "git_url": "https://HOSTNAME/repositories/167174/git/blobs/d7212f9dee2dcc18f084d7df8f417b80846ded5a", "html_url": "https://github.com/jquery/jquery/blob/825ac3773694e0cd23ee74895fd5aeb535b27da4/src/attributes/classes.js", "repository": { "id": 167174, "node_id": "MDEwOlJlcG9zaXRvcnkxNjcxNzQ=", "name": "jquery", "full_name": "jquery/jquery", "owner": { "login": "jquery", "id": 70142, "node_id": "MDQ6VXNlcjcwMTQy", "avatar_url": "https://0.gravatar.com/avatar/6906f317a4733f4379b06c32229ef02f?d=https%3A%2F%2Fidenticons.github.com%2Ff426f04f2f9813718fb806b30e0093de.png", "gravatar_id": "", "url": "https://HOSTNAME/users/jquery", "html_url": "https://github.com/jquery", "followers_url": "https://HOSTNAME/users/jquery/followers", "following_url": "https://HOSTNAME/users/jquery/following{/other_user}", "gists_url": "https://HOSTNAME/users/jquery/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/jquery/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/jquery/subscriptions", "organizations_url": "https://HOSTNAME/users/jquery/orgs", "repos_url": "https://HOSTNAME/users/jquery/repos", "events_url": "https://HOSTNAME/users/jquery/events{/privacy}", "received_events_url": "https://HOSTNAME/users/jquery/received_events", "type": "Organization", "site_admin": false }, "private": false, "html_url": "https://github.com/jquery/jquery", "description": "jQuery JavaScript Library", "fork": false, "url": "https://HOSTNAME/repos/jquery/jquery", "forks_url": "https://HOSTNAME/repos/jquery/jquery/forks", "keys_url": "https://HOSTNAME/repos/jquery/jquery/keys{/key_id}", "collaborators_url": "https://HOSTNAME/repos/jquery/jquery/collaborators{/collaborator}", "teams_url": "https://HOSTNAME/repos/jquery/jquery/teams", "hooks_url": "https://HOSTNAME/repos/jquery/jquery/hooks", "issue_events_url": "https://HOSTNAME/repos/jquery/jquery/issues/events{/number}", "events_url": "https://HOSTNAME/repos/jquery/jquery/events", "assignees_url": "https://HOSTNAME/repos/jquery/jquery/assignees{/user}", "branches_url": "https://HOSTNAME/repos/jquery/jquery/branches{/branch}", "tags_url": "https://HOSTNAME/repos/jquery/jquery/tags", "blobs_url": "https://HOSTNAME/repos/jquery/jquery/git/blobs{/sha}", "git_tags_url": "https://HOSTNAME/repos/jquery/jquery/git/tags{/sha}", "git_refs_url": "https://HOSTNAME/repos/jquery/jquery/git/refs{/sha}", "trees_url": "https://HOSTNAME/repos/jquery/jquery/git/trees{/sha}", "statuses_url": "https://HOSTNAME/repos/jquery/jquery/statuses/{sha}", "languages_url": "https://HOSTNAME/repos/jquery/jquery/languages", "stargazers_url": "https://HOSTNAME/repos/jquery/jquery/stargazers", "contributors_url": "https://HOSTNAME/repos/jquery/jquery/contributors", "subscribers_url": "https://HOSTNAME/repos/jquery/jquery/subscribers", "subscription_url": "https://HOSTNAME/repos/jquery/jquery/subscription", "commits_url": "https://HOSTNAME/repos/jquery/jquery/commits{/sha}", "git_commits_url": "https://HOSTNAME/repos/jquery/jquery/git/commits{/sha}", "comments_url": "https://HOSTNAME/repos/jquery/jquery/comments{/number}", "issue_comment_url": "https://HOSTNAME/repos/jquery/jquery/issues/comments/{number}", "contents_url": "https://HOSTNAME/repos/jquery/jquery/contents/{+path}", "compare_url": "https://HOSTNAME/repos/jquery/jquery/compare/{base}...{head}", "merges_url": "https://HOSTNAME/repos/jquery/jquery/merges", "archive_url": "https://HOSTNAME/repos/jquery/jquery/{archive_format}{/ref}", "downloads_url": "https://HOSTNAME/repos/jquery/jquery/downloads", "issues_url": "https://HOSTNAME/repos/jquery/jquery/issues{/number}", "pulls_url": "https://HOSTNAME/repos/jquery/jquery/pulls{/number}", "milestones_url": "https://HOSTNAME/repos/jquery/jquery/milestones{/number}", "notifications_url": "https://HOSTNAME/repos/jquery/jquery/notifications{?since,all,participating}", "labels_url": "https://HOSTNAME/repos/jquery/jquery/labels{/name}", "deployments_url": "http://HOSTNAME/repos/octocat/Hello-World/deployments", "releases_url": "http://HOSTNAME/repos/octocat/Hello-World/releases{/id}" }, "score": 1 } ] }

Search commits

Find commits via various criteria on the default branch (usually main). This method returns up to 100 results per page.

When searching for commits, you can get text match metadata for the message field when you provide the text-match media type. For more details about how to receive highlighted search results, see Text match metadata.

For example, if you want to find commits related to CSS in the octocat/Spoon-Knife repository. Your query would look something like this:

q=repo:octocat/Spoon-Knife+css

"Search commits"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 어떤 권한도 필요하지 않습니다.

공용 리소스만 요청되는 경우 인증 없이 이 엔드포인트를 사용할 수 있습니다.

"Search commits"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

쿼리 매개 변수
속성, 형식, 설명
q string Required

The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub Enterprise Server. The REST API supports the same qualifiers as the web interface for GitHub Enterprise Server. To learn more about the format of the query, see Constructing a search query. See "Searching commits" for a detailed list of qualifiers.

sort string

Sorts the results of your query by author-date or committer-date. Default: best match

다음 중 하나일 수 있습니다.: author-date, committer-date

order string

Determines whether the first search result returned is the highest number of matches (desc) or lowest number of matches (asc). This parameter is ignored unless you provide sort.

기본값: desc

다음 중 하나일 수 있습니다.: desc, asc

per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

기본값: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

기본값: 1

"Search commits"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

304

Not modified

"Search commits"에 대한 코드 샘플

요청 예제

get/search/commits
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "http(s)://HOSTNAME/api/v3/search/commits?q=Q"

Response

Status: 200
{ "total_count": 1, "incomplete_results": false, "items": [ { "url": "https://HOSTNAME/repos/octocat/Spoon-Knife/commits/bb4cc8d3b2e14b3af5df699876dd4ff3acd00b7f", "sha": "bb4cc8d3b2e14b3af5df699876dd4ff3acd00b7f", "html_url": "https://github.com/octocat/Spoon-Knife/commit/bb4cc8d3b2e14b3af5df699876dd4ff3acd00b7f", "comments_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/commits/bb4cc8d3b2e14b3af5df699876dd4ff3acd00b7f/comments", "commit": { "url": "https://HOSTNAME/repos/octocat/Spoon-Knife/git/commits/bb4cc8d3b2e14b3af5df699876dd4ff3acd00b7f", "author": { "date": "2014-02-04T14:38:36-08:00", "name": "The Octocat", "email": "octocat@nowhere.com" }, "committer": { "date": "2014-02-12T15:18:55-08:00", "name": "The Octocat", "email": "octocat@nowhere.com" }, "message": "Create styles.css and updated README", "tree": { "url": "https://HOSTNAME/repos/octocat/Spoon-Knife/git/trees/a639e96f9038797fba6e0469f94a4b0cc459fa68", "sha": "a639e96f9038797fba6e0469f94a4b0cc459fa68" }, "comment_count": 8 }, "author": { "login": "octocat", "id": 583231, "node_id": "MDQ6VXNlcjU4MzIzMQ==", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=3", "gravatar_id": "", "url": "https://HOSTNAME/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://HOSTNAME/users/octocat/followers", "following_url": "https://HOSTNAME/users/octocat/following{/other_user}", "gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions", "organizations_url": "https://HOSTNAME/users/octocat/orgs", "repos_url": "https://HOSTNAME/users/octocat/repos", "events_url": "https://HOSTNAME/users/octocat/events{/privacy}", "received_events_url": "https://HOSTNAME/users/octocat/received_events", "type": "User", "site_admin": false }, "committer": {}, "parents": [ { "url": "https://HOSTNAME/repos/octocat/Spoon-Knife/commits/a30c19e3f13765a3b48829788bc1cb8b4e95cee4", "html_url": "https://github.com/octocat/Spoon-Knife/commit/a30c19e3f13765a3b48829788bc1cb8b4e95cee4", "sha": "a30c19e3f13765a3b48829788bc1cb8b4e95cee4" } ], "repository": { "id": 1300192, "node_id": "MDEwOlJlcG9zaXRvcnkxMzAwMTky", "name": "Spoon-Knife", "full_name": "octocat/Spoon-Knife", "owner": { "login": "octocat", "id": 583231, "node_id": "MDQ6VXNlcjU4MzIzMQ==", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=3", "gravatar_id": "", "url": "https://HOSTNAME/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://HOSTNAME/users/octocat/followers", "following_url": "https://HOSTNAME/users/octocat/following{/other_user}", "gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions", "organizations_url": "https://HOSTNAME/users/octocat/orgs", "repos_url": "https://HOSTNAME/users/octocat/repos", "events_url": "https://HOSTNAME/users/octocat/events{/privacy}", "received_events_url": "https://HOSTNAME/users/octocat/received_events", "type": "User", "site_admin": false }, "private": false, "html_url": "https://github.com/octocat/Spoon-Knife", "description": "This repo is for demonstration purposes only.", "fork": false, "url": "https://HOSTNAME/repos/octocat/Spoon-Knife", "forks_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/forks", "keys_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/keys{/key_id}", "collaborators_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/collaborators{/collaborator}", "teams_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/teams", "hooks_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/hooks", "issue_events_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/issues/events{/number}", "events_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/events", "assignees_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/assignees{/user}", "branches_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/branches{/branch}", "tags_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/tags", "blobs_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/git/blobs{/sha}", "git_tags_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/git/tags{/sha}", "git_refs_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/git/refs{/sha}", "trees_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/git/trees{/sha}", "statuses_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/statuses/{sha}", "languages_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/languages", "stargazers_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/stargazers", "contributors_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/contributors", "subscribers_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/subscribers", "subscription_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/subscription", "commits_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/commits{/sha}", "git_commits_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/git/commits{/sha}", "comments_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/comments{/number}", "issue_comment_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/issues/comments{/number}", "contents_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/contents/{+path}", "compare_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/compare/{base}...{head}", "merges_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/merges", "archive_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/{archive_format}{/ref}", "downloads_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/downloads", "issues_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/issues{/number}", "pulls_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/pulls{/number}", "milestones_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/milestones{/number}", "notifications_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/notifications{?since,all,participating}", "labels_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/labels{/name}", "releases_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/releases{/id}", "deployments_url": "https://HOSTNAME/repos/octocat/Spoon-Knife/deployments" }, "score": 1, "node_id": "MDQ6VXNlcjU4MzIzMQ==" } ] }

Search issues and pull requests

Find issues by state and keyword. This method returns up to 100 results per page.

When searching for issues, you can get text match metadata for the issue title, issue body, and issue comment body fields when you pass the text-match media type. For more details about how to receive highlighted search results, see Text match metadata.

For example, if you want to find the oldest unresolved Python bugs on Windows. Your query might look something like this.

q=windows+label:bug+language:python+state:open&sort=created&order=asc

This query searches for the keyword windows, within any open issue that is labeled as bug. The search runs across repositories whose primary language is Python. The results are sorted by creation date in ascending order, which means the oldest issues appear first in the search results.

Note

For requests made by GitHub Apps with a user access token, you can't retrieve a combination of issues and pull requests in a single query. Requests that don't include the is:issue or is:pull-request qualifier will receive an HTTP 422 Unprocessable Entity response. To get results for both issues and pull requests, you must send separate queries for issues and pull requests. For more information about the is qualifier, see "Searching only issues or pull requests."

"Search issues and pull requests"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 어떤 권한도 필요하지 않습니다.

공용 리소스만 요청되는 경우 인증 없이 이 엔드포인트를 사용할 수 있습니다.

"Search issues and pull requests"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

쿼리 매개 변수
속성, 형식, 설명
q string Required

The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub Enterprise Server. The REST API supports the same qualifiers as the web interface for GitHub Enterprise Server. To learn more about the format of the query, see Constructing a search query. See "Searching issues and pull requests" for a detailed list of qualifiers.

sort string

Sorts the results of your query by the number of comments, reactions, reactions-+1, reactions--1, reactions-smile, reactions-thinking_face, reactions-heart, reactions-tada, or interactions. You can also sort results by how recently the items were created or updated, Default: best match

다음 중 하나일 수 있습니다.: comments, reactions, reactions-+1, reactions--1, reactions-smile, reactions-thinking_face, reactions-heart, reactions-tada, interactions, created, updated

order string

Determines whether the first search result returned is the highest number of matches (desc) or lowest number of matches (asc). This parameter is ignored unless you provide sort.

기본값: desc

다음 중 하나일 수 있습니다.: desc, asc

per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

기본값: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

기본값: 1

"Search issues and pull requests"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

304

Not modified

403

Forbidden

422

Validation failed, or the endpoint has been spammed.

503

Service unavailable

"Search issues and pull requests"에 대한 코드 샘플

요청 예제

get/search/issues
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "http(s)://HOSTNAME/api/v3/search/issues?q=Q"

Response

Status: 200
{ "total_count": 280, "incomplete_results": false, "items": [ { "url": "https://HOSTNAME/repos/batterseapower/pinyin-toolkit/issues/132", "repository_url": "https://HOSTNAME/repos/batterseapower/pinyin-toolkit", "labels_url": "https://HOSTNAME/repos/batterseapower/pinyin-toolkit/issues/132/labels{/name}", "comments_url": "https://HOSTNAME/repos/batterseapower/pinyin-toolkit/issues/132/comments", "events_url": "https://HOSTNAME/repos/batterseapower/pinyin-toolkit/issues/132/events", "html_url": "https://github.com/batterseapower/pinyin-toolkit/issues/132", "id": 35802, "node_id": "MDU6SXNzdWUzNTgwMg==", "number": 132, "title": "Line Number Indexes Beyond 20 Not Displayed", "user": { "login": "Nick3C", "id": 90254, "node_id": "MDQ6VXNlcjkwMjU0", "avatar_url": "https://secure.gravatar.com/avatar/934442aadfe3b2f4630510de416c5718?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png", "gravatar_id": "", "url": "https://HOSTNAME/users/Nick3C", "html_url": "https://github.com/Nick3C", "followers_url": "https://HOSTNAME/users/Nick3C/followers", "following_url": "https://HOSTNAME/users/Nick3C/following{/other_user}", "gists_url": "https://HOSTNAME/users/Nick3C/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/Nick3C/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/Nick3C/subscriptions", "organizations_url": "https://HOSTNAME/users/Nick3C/orgs", "repos_url": "https://HOSTNAME/users/Nick3C/repos", "events_url": "https://HOSTNAME/users/Nick3C/events{/privacy}", "received_events_url": "https://HOSTNAME/users/Nick3C/received_events", "type": "User", "site_admin": true }, "labels": [ { "id": 4, "node_id": "MDU6TGFiZWw0", "url": "https://HOSTNAME/repos/batterseapower/pinyin-toolkit/labels/bug", "name": "bug", "color": "ff0000" } ], "state": "open", "assignee": null, "milestone": { "url": "https://HOSTNAME/repos/octocat/Hello-World/milestones/1", "html_url": "https://github.com/octocat/Hello-World/milestones/v1.0", "labels_url": "https://HOSTNAME/repos/octocat/Hello-World/milestones/1/labels", "id": 1002604, "node_id": "MDk6TWlsZXN0b25lMTAwMjYwNA==", "number": 1, "state": "open", "title": "v1.0", "description": "Tracking milestone for version 1.0", "creator": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://HOSTNAME/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://HOSTNAME/users/octocat/followers", "following_url": "https://HOSTNAME/users/octocat/following{/other_user}", "gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions", "organizations_url": "https://HOSTNAME/users/octocat/orgs", "repos_url": "https://HOSTNAME/users/octocat/repos", "events_url": "https://HOSTNAME/users/octocat/events{/privacy}", "received_events_url": "https://HOSTNAME/users/octocat/received_events", "type": "User", "site_admin": false }, "open_issues": 4, "closed_issues": 8, "created_at": "2011-04-10T20:09:31Z", "updated_at": "2014-03-03T18:58:10Z", "closed_at": "2013-02-12T13:22:01Z", "due_on": "2012-10-09T23:39:01Z" }, "comments": 15, "created_at": "2009-07-12T20:10:41Z", "updated_at": "2009-07-19T09:23:43Z", "closed_at": null, "pull_request": { "url": "https://api/github.com/repos/octocat/Hello-World/pull/1347", "html_url": "https://github.com/octocat/Hello-World/pull/1347", "diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff", "patch_url": "https://HOSTNAME/repos/octocat/Hello-World/pulls/1347" }, "body": "...", "score": 1, "locked": true, "author_association": "COLLABORATOR", "state_reason": "completed" } ] }

Search labels

Find labels in a repository with names or descriptions that match search keywords. Returns up to 100 results per page.

When searching for labels, you can get text match metadata for the label name and description fields when you pass the text-match media type. For more details about how to receive highlighted search results, see Text match metadata.

For example, if you want to find labels in the linguist repository that match bug, defect, or enhancement. Your query might look like this:

q=bug+defect+enhancement&repository_id=64778136

The labels that best match the query appear first in the search results.

"Search labels"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 다음 권한 집합이 있어야 합니다.:

  • "Metadata" repository permissions (read)

공용 리소스만 요청되는 경우 인증 또는 앞서 언급한 권한 없이 이 엔드포인트를 사용할 수 있습니다.

"Search labels"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

쿼리 매개 변수
속성, 형식, 설명
repository_id integer Required

The id of the repository.

q string Required

The search keywords. This endpoint does not accept qualifiers in the query. To learn more about the format of the query, see Constructing a search query.

sort string

Sorts the results of your query by when the label was created or updated. Default: best match

다음 중 하나일 수 있습니다.: created, updated

order string

Determines whether the first search result returned is the highest number of matches (desc) or lowest number of matches (asc). This parameter is ignored unless you provide sort.

기본값: desc

다음 중 하나일 수 있습니다.: desc, asc

per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

기본값: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

기본값: 1

"Search labels"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

304

Not modified

403

Forbidden

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

"Search labels"에 대한 코드 샘플

요청 예제

get/search/labels
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "http(s)://HOSTNAME/api/v3/search/labels?repository_id=REPOSITORY_ID&q=Q"

Response

Status: 200
{ "total_count": 2, "incomplete_results": false, "items": [ { "id": 418327088, "node_id": "MDU6TGFiZWw0MTgzMjcwODg=", "url": "https://HOSTNAME/repos/octocat/linguist/labels/enhancement", "name": "enhancement", "color": "84b6eb", "default": true, "description": "New feature or request.", "score": 1 }, { "id": 418327086, "node_id": "MDU6TGFiZWw0MTgzMjcwODY=", "url": "https://HOSTNAME/repos/octocat/linguist/labels/bug", "name": "bug", "color": "ee0701", "default": true, "description": "Something isn't working.", "score": 1 } ] }

Search repositories

Find repositories via various criteria. This method returns up to 100 results per page.

When searching for repositories, you can get text match metadata for the name and description fields when you pass the text-match media type. For more details about how to receive highlighted search results, see Text match metadata.

For example, if you want to search for popular Tetris repositories written in assembly code, your query might look like this:

q=tetris+language:assembly&sort=stars&order=desc

This query searches for repositories with the word tetris in the name, the description, or the README. The results are limited to repositories where the primary language is assembly. The results are sorted by stars in descending order, so that the most popular repositories appear first in the search results.

"Search repositories"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 어떤 권한도 필요하지 않습니다.

공용 리소스만 요청되는 경우 인증 없이 이 엔드포인트를 사용할 수 있습니다.

"Search repositories"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

쿼리 매개 변수
속성, 형식, 설명
q string Required

The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub Enterprise Server. The REST API supports the same qualifiers as the web interface for GitHub Enterprise Server. To learn more about the format of the query, see Constructing a search query. See "Searching for repositories" for a detailed list of qualifiers.

sort string

Sorts the results of your query by number of stars, forks, or help-wanted-issues or how recently the items were updated. Default: best match

다음 중 하나일 수 있습니다.: stars, forks, help-wanted-issues, updated

order string

Determines whether the first search result returned is the highest number of matches (desc) or lowest number of matches (asc). This parameter is ignored unless you provide sort.

기본값: desc

다음 중 하나일 수 있습니다.: desc, asc

per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

기본값: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

기본값: 1

"Search repositories"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

304

Not modified

422

Validation failed, or the endpoint has been spammed.

503

Service unavailable

"Search repositories"에 대한 코드 샘플

요청 예제

get/search/repositories
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "http(s)://HOSTNAME/api/v3/search/repositories?q=Q"

Response

Status: 200
{ "total_count": 40, "incomplete_results": false, "items": [ { "id": 3081286, "node_id": "MDEwOlJlcG9zaXRvcnkzMDgxMjg2", "name": "Tetris", "full_name": "dtrupenn/Tetris", "owner": { "login": "dtrupenn", "id": 872147, "node_id": "MDQ6VXNlcjg3MjE0Nw==", "avatar_url": "https://secure.gravatar.com/avatar/e7956084e75f239de85d3a31bc172ace?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png", "gravatar_id": "", "url": "https://HOSTNAME/users/dtrupenn", "received_events_url": "https://HOSTNAME/users/dtrupenn/received_events", "type": "User", "html_url": "https://github.com/octocat", "followers_url": "https://HOSTNAME/users/octocat/followers", "following_url": "https://HOSTNAME/users/octocat/following{/other_user}", "gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions", "organizations_url": "https://HOSTNAME/users/octocat/orgs", "repos_url": "https://HOSTNAME/users/octocat/repos", "events_url": "https://HOSTNAME/users/octocat/events{/privacy}", "site_admin": true }, "private": false, "html_url": "https://github.com/dtrupenn/Tetris", "description": "A C implementation of Tetris using Pennsim through LC4", "fork": false, "url": "https://HOSTNAME/repos/dtrupenn/Tetris", "created_at": "2012-01-01T00:31:50Z", "updated_at": "2013-01-05T17:58:47Z", "pushed_at": "2012-01-01T00:37:02Z", "homepage": "https://github.com", "size": 524, "stargazers_count": 1, "watchers_count": 1, "language": "Assembly", "forks_count": 0, "open_issues_count": 0, "master_branch": "master", "default_branch": "master", "score": 1, "archive_url": "https://HOSTNAME/repos/dtrupenn/Tetris/{archive_format}{/ref}", "assignees_url": "https://HOSTNAME/repos/dtrupenn/Tetris/assignees{/user}", "blobs_url": "https://HOSTNAME/repos/dtrupenn/Tetris/git/blobs{/sha}", "branches_url": "https://HOSTNAME/repos/dtrupenn/Tetris/branches{/branch}", "collaborators_url": "https://HOSTNAME/repos/dtrupenn/Tetris/collaborators{/collaborator}", "comments_url": "https://HOSTNAME/repos/dtrupenn/Tetris/comments{/number}", "commits_url": "https://HOSTNAME/repos/dtrupenn/Tetris/commits{/sha}", "compare_url": "https://HOSTNAME/repos/dtrupenn/Tetris/compare/{base}...{head}", "contents_url": "https://HOSTNAME/repos/dtrupenn/Tetris/contents/{+path}", "contributors_url": "https://HOSTNAME/repos/dtrupenn/Tetris/contributors", "deployments_url": "https://HOSTNAME/repos/dtrupenn/Tetris/deployments", "downloads_url": "https://HOSTNAME/repos/dtrupenn/Tetris/downloads", "events_url": "https://HOSTNAME/repos/dtrupenn/Tetris/events", "forks_url": "https://HOSTNAME/repos/dtrupenn/Tetris/forks", "git_commits_url": "https://HOSTNAME/repos/dtrupenn/Tetris/git/commits{/sha}", "git_refs_url": "https://HOSTNAME/repos/dtrupenn/Tetris/git/refs{/sha}", "git_tags_url": "https://HOSTNAME/repos/dtrupenn/Tetris/git/tags{/sha}", "git_url": "git:github.com/dtrupenn/Tetris.git", "issue_comment_url": "https://HOSTNAME/repos/dtrupenn/Tetris/issues/comments{/number}", "issue_events_url": "https://HOSTNAME/repos/dtrupenn/Tetris/issues/events{/number}", "issues_url": "https://HOSTNAME/repos/dtrupenn/Tetris/issues{/number}", "keys_url": "https://HOSTNAME/repos/dtrupenn/Tetris/keys{/key_id}", "labels_url": "https://HOSTNAME/repos/dtrupenn/Tetris/labels{/name}", "languages_url": "https://HOSTNAME/repos/dtrupenn/Tetris/languages", "merges_url": "https://HOSTNAME/repos/dtrupenn/Tetris/merges", "milestones_url": "https://HOSTNAME/repos/dtrupenn/Tetris/milestones{/number}", "notifications_url": "https://HOSTNAME/repos/dtrupenn/Tetris/notifications{?since,all,participating}", "pulls_url": "https://HOSTNAME/repos/dtrupenn/Tetris/pulls{/number}", "releases_url": "https://HOSTNAME/repos/dtrupenn/Tetris/releases{/id}", "ssh_url": "git@github.com:dtrupenn/Tetris.git", "stargazers_url": "https://HOSTNAME/repos/dtrupenn/Tetris/stargazers", "statuses_url": "https://HOSTNAME/repos/dtrupenn/Tetris/statuses/{sha}", "subscribers_url": "https://HOSTNAME/repos/dtrupenn/Tetris/subscribers", "subscription_url": "https://HOSTNAME/repos/dtrupenn/Tetris/subscription", "tags_url": "https://HOSTNAME/repos/dtrupenn/Tetris/tags", "teams_url": "https://HOSTNAME/repos/dtrupenn/Tetris/teams", "trees_url": "https://HOSTNAME/repos/dtrupenn/Tetris/git/trees{/sha}", "clone_url": "https://github.com/dtrupenn/Tetris.git", "mirror_url": "git:git.example.com/dtrupenn/Tetris", "hooks_url": "https://HOSTNAME/repos/dtrupenn/Tetris/hooks", "svn_url": "https://svn.github.com/dtrupenn/Tetris", "forks": 1, "open_issues": 1, "watchers": 1, "has_issues": true, "has_projects": true, "has_pages": true, "has_wiki": true, "has_downloads": true, "archived": true, "disabled": true, "visibility": "private", "license": { "key": "mit", "name": "MIT License", "url": "https://HOSTNAME/licenses/mit", "spdx_id": "MIT", "node_id": "MDc6TGljZW5zZW1pdA==", "html_url": "https://HOSTNAME/licenses/mit" } } ] }

Search topics

Find topics via various criteria. Results are sorted by best match. This method returns up to 100 results per page. See "Searching topics" for a detailed list of qualifiers.

When searching for topics, you can get text match metadata for the topic's short_description, description, name, or display_name field when you pass the text-match media type. For more details about how to receive highlighted search results, see Text match metadata.

For example, if you want to search for topics related to Ruby that are featured on https://github.com/topics. Your query might look like this:

q=ruby+is:featured

This query searches for topics with the keyword ruby and limits the results to find only topics that are featured. The topics that are the best match for the query appear first in the search results.

"Search topics"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 어떤 권한도 필요하지 않습니다.

공용 리소스만 요청되는 경우 인증 없이 이 엔드포인트를 사용할 수 있습니다.

"Search topics"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

쿼리 매개 변수
속성, 형식, 설명
q string Required

The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub Enterprise Server. The REST API supports the same qualifiers as the web interface for GitHub Enterprise Server. To learn more about the format of the query, see Constructing a search query.

per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

기본값: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

기본값: 1

"Search topics"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

304

Not modified

"Search topics"에 대한 코드 샘플

요청 예제

get/search/topics
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "http(s)://HOSTNAME/api/v3/search/topics?q=Q"

Response

Status: 200
{ "total_count": 6, "incomplete_results": false, "items": [ { "name": "ruby", "display_name": "Ruby", "short_description": "Ruby is a scripting language designed for simplified object-oriented programming.", "description": "Ruby was developed by Yukihiro \"Matz\" Matsumoto in 1995 with the intent of having an easily readable programming language. It is integrated with the Rails framework to create dynamic web-applications. Ruby's syntax is similar to that of Perl and Python.", "created_by": "Yukihiro Matsumoto", "released": "December 21, 1995", "created_at": "2016-11-28T22:03:59Z", "updated_at": "2017-10-30T18:16:32Z", "featured": true, "curated": true, "score": 1 }, { "name": "rails", "display_name": "Rails", "short_description": "Ruby on Rails (Rails) is a web application framework written in Ruby.", "description": "Ruby on Rails (Rails) is a web application framework written in Ruby. It is meant to help simplify the building of complex websites.", "created_by": "David Heinemeier Hansson", "released": "December 13 2005", "created_at": "2016-12-09T17:03:50Z", "updated_at": "2017-10-30T16:20:19Z", "featured": true, "curated": true, "score": 1 }, { "name": "python", "display_name": "Python", "short_description": "Python is a dynamically typed programming language.", "description": "Python is a dynamically typed programming language designed by Guido Van Rossum. Much like the programming language Ruby, Python was designed to be easily read by programmers. Because of its large following and many libraries, Python can be implemented and used to do anything from webpages to scientific research.", "created_by": "Guido van Rossum", "released": "February 20, 1991", "created_at": "2016-12-07T00:07:02Z", "updated_at": "2017-10-27T22:45:43Z", "featured": true, "curated": true, "score": 1 }, { "name": "jekyll", "display_name": "Jekyll", "short_description": "Jekyll is a simple, blog-aware static site generator.", "description": "Jekyll is a blog-aware, site generator written in Ruby. It takes raw text files, runs it through a renderer and produces a publishable static website.", "created_by": "Tom Preston-Werner", "released": "2008", "created_at": "2016-12-16T21:53:08Z", "updated_at": "2017-10-27T19:00:24Z", "featured": true, "curated": true, "score": 1 }, { "name": "sass", "display_name": "Sass", "short_description": "Sass is a stable extension to classic CSS.", "description": "Sass is a stylesheet language with a main implementation in Ruby. It is an extension of CSS that makes improvements to the old stylesheet format, such as being able to declare variables and using a cleaner nesting syntax.", "created_by": "Hampton Catlin, Natalie Weizenbaum, Chris Eppstein", "released": "November 28, 2006", "created_at": "2016-12-16T21:53:45Z", "updated_at": "2018-01-16T16:30:40Z", "featured": true, "curated": true, "score": 1 }, { "name": "homebrew", "display_name": "Homebrew", "short_description": "Homebrew is a package manager for macOS.", "description": "Homebrew is a package manager for Apple's macOS operating system. It simplifies the installation of software and is popular in the Ruby on Rails community.", "created_by": "Max Howell", "released": "2009", "created_at": "2016-12-17T20:30:44Z", "updated_at": "2018-02-06T16:14:56Z", "featured": true, "curated": true, "score": 1 } ] }

Search users

Find users via various criteria. This method returns up to 100 results per page.

When searching for users, you can get text match metadata for the issue login, public email, and name fields when you pass the text-match media type. For more details about highlighting search results, see Text match metadata. For more details about how to receive highlighted search results, see Text match metadata.

For example, if you're looking for a list of popular users, you might try this query:

q=tom+repos:%3E42+followers:%3E1000

This query searches for users with the name tom. The results are restricted to users with more than 42 repositories and over 1,000 followers.

This endpoint does not accept authentication and will only include publicly visible users. As an alternative, you can use the GraphQL API. The GraphQL API requires authentication and will return private users, including Enterprise Managed Users (EMUs), that you are authorized to view. For more information, see "GraphQL Queries."

"Search users"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 어떤 권한도 필요하지 않습니다.

공용 리소스만 요청되는 경우 인증 없이 이 엔드포인트를 사용할 수 있습니다.

"Search users"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

쿼리 매개 변수
속성, 형식, 설명
q string Required

The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub Enterprise Server. The REST API supports the same qualifiers as the web interface for GitHub Enterprise Server. To learn more about the format of the query, see Constructing a search query. See "Searching users" for a detailed list of qualifiers.

sort string

Sorts the results of your query by number of followers or repositories, or when the person joined GitHub Enterprise Server. Default: best match

다음 중 하나일 수 있습니다.: followers, repositories, joined

order string

Determines whether the first search result returned is the highest number of matches (desc) or lowest number of matches (asc). This parameter is ignored unless you provide sort.

기본값: desc

다음 중 하나일 수 있습니다.: desc, asc

per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

기본값: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

기본값: 1

"Search users"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

304

Not modified

422

Validation failed, or the endpoint has been spammed.

503

Service unavailable

"Search users"에 대한 코드 샘플

요청 예제

get/search/users
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "http(s)://HOSTNAME/api/v3/search/users?q=Q"

Response

Status: 200
{ "total_count": 12, "incomplete_results": false, "items": [ { "login": "mojombo", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://secure.gravatar.com/avatar/25c7c18223fb42a4c6ae1c8db6f50f9b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png", "gravatar_id": "", "url": "https://HOSTNAME/users/mojombo", "html_url": "https://github.com/mojombo", "followers_url": "https://HOSTNAME/users/mojombo/followers", "subscriptions_url": "https://HOSTNAME/users/mojombo/subscriptions", "organizations_url": "https://HOSTNAME/users/mojombo/orgs", "repos_url": "https://HOSTNAME/users/mojombo/repos", "received_events_url": "https://HOSTNAME/users/mojombo/received_events", "type": "User", "score": 1, "following_url": "https://HOSTNAME/users/mojombo/following{/other_user}", "gists_url": "https://HOSTNAME/users/mojombo/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/mojombo/starred{/owner}{/repo}", "events_url": "https://HOSTNAME/users/mojombo/events{/privacy}", "site_admin": true } ] }