검색 API

Tier: Free, Premium, Ultimate Offering: GitLab.com, Self-Managed, GitLab Dedicated

피처 플래그 search_filter_by_confidential가 GitLab 13.6에서 제거되었습니다.

모든 검색 API 호출은 인증되어야 합니다.

추가 범위

Tier: Premium, Ultimate Offering: GitLab.com, Self-Managed, GitLab Dedicated

Elasticsearch가 활성화되어 있을 경우, 고급 검색 API그룹 검색 API를 위한 추가 범위가 제공됩니다: blobs, commits, notes, wiki_blobs.

고급 검색 API

GitLab 인스턴스 전역에서 표현식을 검색하여 지정된 범위 내에서 응답을 확인합니다.

GET /search
속성 유형 필수 여부 설명
scope string Yes 검색할 범위입니다. projects, issues, merge_requests, milestones, snippet_titles, users와 같은 값이 포함됩니다. 추가 범위: blobs, commits, notes, wiki_blobs.
search string Yes 검색 쿼리입니다.
confidential boolean No 기밀성에 따라 필터링합니다. issues 범위를 지원하며, 다른 범위는 무시됩니다.
order_by string No created_at 만 허용됩니다. 설정되지 않으면, 기본 검색 결과의 경우 created_at을 기준으로 내림차순으로 정렬되거나, 고급 검색 결과의 경우 가장 관련성 있는 문서를 기준으로 정렬됩니다.
sort string No asc 또는 desc만 허용됩니다. 설정되지 않으면, 결과는 기본 검색결과의 경우 created_at를 기준으로 내림차순으로 정렬되거나, 고급 검색 결과의 경우 가장 관련성 있는 문서를 기준으로 정렬됩니다.
state string No 상태에 따라 필터링합니다. issuesmerge_requests 범위를 지원하며, 다른 범위는 무시됩니다.

범위: projects

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/search?scope=projects&search=flight"

예시 응답:

[
  {
    "id": 6,
    "description": "Nobis sed ipsam vero quod cupiditate veritatis hic.",
    "name": "Flight",
    "name_with_namespace": "Twitter / Flight",
    "path": "flight",
    "path_with_namespace": "twitter/flight",
    "created_at": "2017-09-05T07:58:01.621Z",
    "default_branch": "main",
    "tag_list":[], //사용하지 말고 `topics`를 사용하세요
    "topics":[],
    "ssh_url_to_repo": "ssh://jarka@localhost:2222/twitter/flight.git",
    "http_url_to_repo": "http://localhost:3000/twitter/flight.git",
    "web_url": "http://localhost:3000/twitter/flight",
    "readme_url": "http://localhost:3000/twitter/flight/-/blob/main/README.md",
    "avatar_url": null,
    "star_count": 0,
    "forks_count": 0,
    "last_activity_at": "2018-01-31T09:56:30.902Z"
  }
]

범위: issues

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/search?scope=issues&search=file"

예시 응답:

[
  {
    "id": 83,
    "iid": 1,
    "project_id": 12,
    "title": "Add file",
    "description": "첫 번째 파일 추가",
    "state": "opened",
    "created_at": "2018-01-24T06:02:15.514Z",
    "updated_at": "2018-02-06T12:36:23.263Z",
    "closed_at": null,
    "labels":[],
    "milestone": null,
    "assignees": [{
      "id": 20,
      "name": "Ceola Deckow",
      "username": "sammy.collier",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/c23d85a4f50e0ea76ab739156c639231?s=80&d=identicon",
      "web_url": "http://localhost:3000/sammy.collier"
    }],
    "author": {
      "id": 1,
      "name": "Administrator",
      "username": "root",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
      "web_url": "http://localhost:3000/root"
    },
    "assignee": {
      "id": 20,
      "name": "Ceola Deckow",
      "username": "sammy.collier",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/c23d85a4f50e0ea76ab739156c639231?s=80&d=identicon",
      "web_url": "http://localhost:3000/sammy.collier"
    },
    "user_notes_count": 0,
    "upvotes": 0,
    "downvotes": 0,
    "due_date": null,
    "confidential": false,
    "discussion_locked": null,
    "web_url": "http://localhost:3000/h5bp/7bp/subgroup-prj/issues/1",
    "time_stats": {
      "time_estimate": 0,
      "total_time_spent": 0,
      "human_time_estimate": null,
      "human_total_time_spent": null
    }
  }
]
note
assignee 열은 사용되지 않습니다. GitLab EE API와 일치하도록 단일 크기의 배열 assignees로 나타납니다.

범위: merge_requests

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/search?scope=merge_requests&search=file"

예시 응답:

[
  {
    "id": 56,
    "iid": 8,
    "project_id": 6,
    "title": "첫 번째 파일 추가",
    "description": "이것은 파일을 추가하기 위한 테스트 MR입니다.",
        "state": "opened",
        "created_at": "2018-01-22T14:21:50.830Z",
        "updated_at": "2018-02-06T12:40:33.295Z",
        "target_branch": "main",
        "source_branch": "jaja-test",
        "upvotes": 0,
        "downvotes": 0,
        "author": {
          "id": 1,
          "name": "Administrator",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "assignee": {
          "id": 5,
          "name": "Jacquelyn Kutch",
          "username": "abigail",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/3138c66095ee4bd11a508c2f7f7772da?s=80&d=identicon",
          "web_url": "http://localhost:3000/abigail"
        },
        "source_project_id": 6,
        "target_project_id": 6,
        "labels": [
          "ruby",
          "tests"
        ],
        "draft": false,
        "work_in_progress": false,
        "milestone": {
          "id": 13,
          "iid": 3,
          "project_id": 6,
          "title": "v2.0",
          "description": "Qui aut qui eos dolor beatae itaque tempore molestiae.",
          "state": "active",
          "created_at": "2017-09-05T07:58:29.099Z",
          "updated_at": "2017-09-05T07:58:29.099Z",
          "due_date": null,
          "start_date": null
        },
        "merge_when_pipeline_succeeds": false,
        "merge_status": "can_be_merged",
        "sha": "78765a2d5e0a43585945c58e61ba2f822e4d090b",
        "merge_commit_sha": null,
        "squash_commit_sha": null,
        "user_notes_count": 0,
        "discussion_locked": null,
        "should_remove_source_branch": null,
        "force_remove_source_branch": true,
        "web_url": "http://localhost:3000/twitter/flight/merge_requests/8",
        "time_stats": {
          "time_estimate": 0,
          "total_time_spent": 0,
          "human_time_estimate": null,
          "human_total_time_spent": null
        }
  }
]

범위: 마일스톤

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/search?scope=milestones&search=release"

예시 응답:

[
  {
    "id": 44,
    "iid": 1,
    "project_id": 12,
    "title": "next release",
    "description": "Next release milestone",
    "state": "active",
    "created_at": "2018-02-06T12:43:39.271Z",
    "updated_at": "2018-02-06T12:44:01.298Z",
    "due_date": "2018-04-18",
    "start_date": "2018-02-04"
  }
]

범위: 코드 조각 제목

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/search?scope=snippet_titles&search=sample"

예시 응답:

[
  {
    "id": 50,
    "title": "Sample file",
    "file_name": "file.rb",
    "description": "Simple ruby file",
    "author": {
      "id": 1,
      "name": "Administrator",
      "username": "root",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
      "web_url": "http://localhost:3000/root"
    },
    "updated_at": "2018-02-06T12:49:29.104Z",
    "created_at": "2017-11-28T08:20:18.071Z",
    "project_id": 9,
    "web_url": "http://localhost:3000/root/jira-test/snippets/50"
  }
]

범위: 위키 블롭

Tier: Premium, Ultimate Offering: GitLab.com, Self-Managed, GitLab Dedicated
  • 13.9에서 GitLab Premium으로 이전되었습니다.

Elasticsearch이 활성화된 경우에만 이 범위를 사용할 수 있습니다.

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/search?scope=wiki_blobs&search=bye"

예시 응답:


[
  {
    "basename": "home",
    "data": "hello\n\nand bye\n\nend",
    "path": "home.md",
    "filename": "home.md",
    "id": null,
    "ref": "main",
    "startline": 5,
    "project_id": 6,
    "group_id": null
  }
]
note
filenamepath로 대체되었습니다. 둘 다 리포지터리 내부의 파일 전체 경로를 반환하지만 앞으로 filename은 파일명만을 의도하고 전체 경로가 아닌 것으로 변경될 예정입니다. 자세한 내용은 issue 34521을 참조하십시오.

범위: 커밋

Tier: Premium, Ultimate Offering: GitLab.com, Self-Managed, GitLab Dedicated
  • 13.9에서 GitLab Premium으로 이전되었습니다.

Elasticsearch이 활성화된 경우에만 이 범위를 사용할 수 있습니다.

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/search?scope=commits&search=bye"

예시 응답:


[
  {
  "id": "4109c2d872d5fdb1ed057400d103766aaea97f98",
  "short_id": "4109c2d8",
  "title": "goodbye $.browser",
  "created_at": "2013-02-18T22:02:54.000Z",
  "parent_ids": [
    "59d05353ab575bcc2aa958fe1782e93297de64c9"
  ],
  "message": "goodbye $.browser\n",
  "author_name": "angus croll",
  "author_email": "anguscroll@gmail.com",
  "authored_date": "2013-02-18T22:02:54.000Z",
  "committer_name": "angus croll",
  "committer_email": "anguscroll@gmail.com",
  "committed_date": "2013-02-18T22:02:54.000Z",
  "project_id": 6
  }
]

범위: 블롭

Tier: Premium, Ultimate Offering: GitLab.com, Self-Managed, GitLab Dedicated
  • 13.9에서 GitLab Premium으로 이전되었습니다.

Elasticsearch이 활성화된 경우에만 이 범위를 사용할 수 있습니다.

이 범위에는 필터가 있습니다:

  • filename
  • path
  • extension

필터를 사용하려면 쿼리에 포함하십시오. 예: a query filename:some_name*.

와일드카드(*)를 사용하여 글로브 매칭을 할 수 있습니다.

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/search?scope=blobs&search=installation"

예시 응답:


[
  {
    "basename": "README",
    "data": "```\n\n## Installation\n\nQuick start using the [pre-built",
    "path": "README.md",
    "filename": "README.md",
    "id": null,
    "ref": "main",
    "startline": 46,
    "project_id": 6
  }
]
note
filenamepath로 대체되었습니다. 둘 다 리포지터리 내부의 파일 전체 경로를 반환하지만 앞으로 filename은 파일명만을 의도하고 전체 경로가 아닌 것으로 변경될 예정입니다. 자세한 내용은 issue 34521을 참조하십시오.

범위: 노트

Tier: Premium, Ultimate Offering: Gitlab.com, Self-Managed, Gitlab Dedicated
  • 13.9에서 Gitlab Premium으로 이전되었습니다.

Elasticsearch이 활성화된 경우에만 이 범위를 사용할 수 있습니다.

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/search?scope=notes&search=maxime"

예시 응답:

[
  {
    "id": 191,
    "body": "Harum maxime consequuntur et et deleniti assumenda facilis.",
    "attachment": null,
    "author": {
      "id": 23,
      "name": "User 1",
      "username": "user1",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/111d68d06e2d317b5a59c2c6c5bad808?s=80&d=identicon",
      "web_url": "http://localhost:3000/user1"
    },
    "created_at": "2017-09-05T08:01:32.068Z",
    "updated_at": "2017-09-05T08:01:32.068Z",
    "system": false,
    "noteable_id": 22,
    "noteable_type": "Issue",
    "project_id": 6,
    "noteable_iid": 2
  }
]

범위: 사용자

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/search?scope=users&search=doe"

예시 응답:

[
  {
    "id": 1,
    "name": "John Doe1",
    "username": "user1",
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon",
    "web_url": "http://localhost/user1"
  }
]

그룹 검색 API

지정된 그룹에서 표현식을 검색합니다.

사용자가 그룹의 구성원이 아니고 그룹이 비공개인 경우, 해당 그룹에 대한 GET 요청은 404 Not Found 상태 코드로 결과됩니다.

GET /groups/:id/search
속성 타입 필수 설명
id 정수 또는 문자열 인증된 사용자가 소유한 그룹의 ID 또는 URL-인코딩된 경로입니다.
scope 문자열 검색 대상 범위입니다. issues, merge_requests, milestones, projects, users를 포함한 값들이 있습니다. 추가적인 범위: blobs, commits, notes, wiki_blobs를 포함합니다.
search 문자열 검색 쿼리입니다.
confidential 부울 아니요 기밀 처리를 필터링합니다. issues 범위만 지원하며, 다른 범위는 무시됩니다.
order_by 문자열 아니요 허용된 값은 오직 created_at뿐입니다. 설정되지 않은 경우, 결과는 기본 검색에 대해 created_at로 내림차순으로 정렬되거나, 고급 검색의 가장 관련있는 문서로 정렬됩니다.
sort 문자열 아니요 허용된 값은 오직 asc 또는 desc뿐입니다. 설정되지 않은 경우, 결과는 기본 검색에 대해 created_at로 내림차순으로 정렬되거나, 고급 검색의 가장 관련있는 문서로 정렬됩니다.
state 문자열 아니요 상태로 필터링합니다. issuesmerge_requests를 지원하며, 다른 범위는 무시됩니다.

응답은 요청한 범위에 따라 다릅니다.

범위: projects

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/3/search?scope=projects&search=flight"

예시 응답:

[
  {
    "id": 6,
    "description": "Nobis sed ipsam vero quod cupiditate veritatis hic.",
    "name": "Flight",
    "name_with_namespace": "Twitter / Flight",
    "path": "flight",
    "path_with_namespace": "twitter/flight",
    "created_at": "2017-09-05T07:58:01.621Z",
    "default_branch": "main",
    "tag_list":[], //deprecated, use `topics` instead
    "topics":[],
    "ssh_url_to_repo": "ssh://jarka@localhost:2222/twitter/flight.git",
    "http_url_to_repo": "http://localhost:3000/twitter/flight.git",
    "web_url": "http://localhost:3000/twitter/flight",
    "readme_url": "http://localhost:3000/twitter/flight/-/blob/main/README.md",
    "avatar_url": null,
    "star_count": 0,
    "forks_count": 0,
    "last_activity_at": "2018-01-31T09:56:30.902Z"
  }
]

범위: issues

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/3/search?scope=issues&search=file"

예시 응답:

[
  {
    "id": 83,
    "iid": 1,
    "project_id": 12,
    "title": "파일 추가",
    "description": "첫 번째 파일 추가",
    "state": "opened",
    "created_at": "2018-01-24T06:02:15.514Z",
    "updated_at": "2018-02-06T12:36:23.263Z",
    "closed_at": null,
    "labels":[],
    "milestone": null,
    "assignees": [{
      "id": 20,
      "name": "Ceola Deckow",
      "username": "sammy.collier",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/c23d85a4f50e0ea76ab739156c639231?s=80&d=identicon",
      "web_url": "http://localhost:3000/sammy.collier"
    }],
    "author": {
      "id": 1,
      "name": "Administrator",
      "username": "root",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
      "web_url": "http://localhost:3000/root"
    },
    "user_notes_count": 0,
    "upvotes": 0,
    "downvotes": 0,
    "due_date": null,
    "confidential": false,
    "discussion_locked": null,
    "web_url": "http://localhost:3000/h5bp/7bp/subgroup-prj/issues/1",
    "time_stats": {
      "time_estimate": 0,
      "total_time_spent": 0,
      "human_time_estimate": null,
      "human_total_time_spent": null
    }
  }
]
note
assignee 열은 더 이상 사용되지 않으며, 이제 GitLab EE API에 맞추어 단일 크기의 배열 assignees로 표시됩니다.

범위: merge_requests

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/3/search?scope=merge_requests&search=file"

예시 응답:

[
  {
    "id": 56,
    "iid": 8,
    "project_id": 6,
    "title": "첫 번째 파일 추가",
    "description": "이것은 파일을 추가하는 테스트 MR입니다.",
    "state": "opened",
    "created_at": "2018-01-22T14:21:50.830Z",
    "updated_at": "2018-02-06T12:40:33.295Z",
    "target_branch": "main",
    "source_branch": "jaja-test",
    "upvotes": 0,
    "downvotes": 0,
    "author": {
      "id": 1,
      "name": "Administrator",
      "username": "root",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
      "web_url": "http://localhost:3000/root"
    },
    "assignee": {
      "id": 5,
      "name": "Jacquelyn Kutch",
      "username": "abigail",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/3138c66095ee4bd11a508c2f7f7772da?s=80&d=identicon",
      "web_url": "http://localhost:3000/abigail"
    },
    "source_project_id": 6,
    "target_project_id": 6,
    "labels": [
      "ruby",
      "tests"
    ],
    "draft": false,
    "work_in_progress": false,
    "merge_when_pipeline_succeeds": false,
    "merge_status": "can_be_merged",
    "sha": "78765a2d5e0a43585945c58e61ba2f822e4d090b",
    "user_notes_count": 0,
    "discussion_locked": null,
    "should_remove_source_branch": null,
    "force_remove_source_branch": true,
    "web_url": "http://localhost:3000/twitter/flight/merge_requests/8",
    "time_stats": {
      "time_estimate": 0,
      "total_time_spent": 0,
      "human_time_estimate": null,
      "human_total_time_spent": null
    }
  }
]

범위: 마일스톤

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/3/search?scope=milestones&search=release"

예시 응답:

[
  {
    "id": 44,
    "iid": 1,
    "project_id": 12,
    "title": "next release",
    "description": "다음 릴리스 마일스톤",
    "state": "active",
    "created_at": "2018-02-06T12:43:39.271Z",
    "updated_at": "2018-02-06T12:44:01.298Z",
    "due_date": "2018-04-18",
    "start_date": "2018-02-04"
  }
]

범위: wiki_blobs

Tier: Premium, Ultimate Offering: GitLab.com, Self-Managed, GitLab Dedicated
  • 13.9에서 GitLab Premium으로 이전되었습니다.

이 범위는 Elasticsearch가 활성화된 경우에만 사용할 수 있습니다.

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/6/search?scope=wiki_blobs&search=bye"

예시 응답:


[
  {
    "basename": "home",
    "data": "hello\n\nand bye\n\nend",
    "path": "home.md",
    "filename": "home.md",
    "id": null,
    "ref": "main",
    "startline": 5,
    "project_id": 6,
    "group_id": 1
  }
]
note
filenamepath의 대안으로 더 이상 사용되지 않습니다. 둘 다 리포지터리 내 파일의 전체 경로를 반환하지만, 앞으로 filename은 파일 이름만 반환되며 전체 경로는 반환하지 않도록 의도되어 있습니다. 자세한 내용은 이슈 34521을 참조하십시오.

범위: 커밋

Tier: Premium, Ultimate Offering: GitLab.com, Self-Managed, GitLab Dedicated
  • 13.9에서 GitLab Premium으로 이전되었습니다.

이 범위는 Elasticsearch가 활성화된 경우에만 사용할 수 있습니다.

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/6/search?scope=commits&search=bye"

예시 응답:


[
  {
  "id": "4109c2d872d5fdb1ed057400d103766aaea97f98",
  "short_id": "4109c2d8",
  "title": "goodbye $.browser",
  "created_at": "2013-02-18T22:02:54.000Z",
  "parent_ids": [
    "59d05353ab575bcc2aa958fe1782e93297de64c9"
  ],
  "message": "goodbye $.browser\n",
  "author_name": "angus croll",
  "author_email": "anguscroll@gmail.com",
  "authored_date": "2013-02-18T22:02:54.000Z",
  "committer_name": "angus croll",
  "committer_email": "anguscroll@gmail.com",
  "committed_date": "2013-02-18T22:02:54.000Z",
  "project_id": 6
  }
]

범위: 파일

Tier: Premium, Ultimate Offering: GitLab.com, Self-Managed, GitLab Dedicated
  • 13.9에서 GitLab Premium으로 이전되었습니다.

이 범위는 Elasticsearch가 활성화된 경우에만 사용할 수 있습니다.

이 범위에 대해 사용 가능한 필터는 다음과 같습니다:

  • filename
  • path
  • extension

필터를 사용하려면 쿼리에 포함하십시오. 예를들어: a query filename:some_name*.

글로브 일치를 위해 와일드카드(*)를 사용할 수 있습니다.

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/6/search?scope=blobs&search=installation"

예시 응답:


[
  {
    "basename": "README",
    "data": "```\n\n## Installation\n\nQuick start using the [pre-built",
    "path": "README.md",
    "filename": "README.md",
    "id": null,
    "ref": "main",
    "startline": 46,
    "project_id": 6
  }
]
note
filenamepath의 대안으로 더 이상 사용되지 않습니다. 둘 다 리포지터리 내 파일의 전체 경로를 반환하지만, 앞으로 filename은 파일 이름만 반환되며 전체 경로는 반환하지 않도록 의도되어 있습니다. 자세한 내용은 이슈 34521을 참조하십시오.

범위: 노트

Tier: Premium, Ultimate Offering: GitLab.com, Self-Managed, GitLab Dedicated
  • 13.9에서 GitLab Premium으로 이전되었습니다.

이 범위는 Elasticsearch가 활성화된 경우에만 사용할 수 있습니다.

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/6/search?scope=notes&search=maxime"

예시 응답:

[
  {
    "id": 191,
    "body": "Harum maxime consequuntur et et deleniti assumenda facilis.",
    "attachment": null,
    "author": {
      "id": 23,
      "name": "User 1",
      "username": "user1",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/111d68d06e2d317b5a59c2c6c5bad808?s=80&d=identicon",
      "web_url": "http://localhost:3000/user1"
    },
    "created_at": "2017-09-05T08:01:32.068Z",
    "updated_at": "2017-09-05T08:01:32.068Z",
    "system": false,
    "noteable_id": 22,
    "noteable_type": "이슈",
    "project_id": 6,
    "noteable_iid": 2
  }
]

범위: 사용자

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/3/search?scope=users&search=doe"

예시 응답:

[
  {
    "id": 1,
    "name": "John Doe1",
    "username": "user1",
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon",
    "web_url": "http://localhost/user1"
  }
]

프로젝트 검색 API

지정된 프로젝트에서 표현식을 검색합니다.

사용자가 프로젝트의 구성원이 아니거나 프로젝트가 비공개인 경우, 해당 프로젝트에 대한 GET 요청은 404 상태 코드를 반환합니다.

GET /projects/:id/search
속성 유형 필수 설명
id 정수 또는 문자열 인증된 사용자가 소유한 프로젝트의 ID 또는 URL 인코딩된 경로.
scope 문자열 검색 범위. blobs, commits, issues, merge_requests, milestones, notes, users, wiki_blobs 등의 값이 포함됩니다.
search 문자열 검색 쿼리.
confidential 부울 아니오 기밀 여부로 필터링합니다. issues 범위를 지원하며, 다른 범위는 무시됩니다.
ref 문자열 아니오 검색할 리포지터리 브랜치 또는 태그의 이름. 기본적으로 프로젝트의 기본 브랜치가 사용됩니다. blobs, commits, wiki_blobs 범위에만 해당됩니다.
order_by 문자열 아니오 허용되는 값은 created_at만 해당됩니다. 설정되지 않으면, 결과는 기본 검색의 경우 created_at을 내림차순으로 정렬하거나 고급 검색의 경우 가장 관련 있는 문서를 기준으로 정렬됩니다.
sort 문자열 아니오 허용되는 값은 asc 또는 desc만 해당됩니다. 설정되지 않으면, 결과는 기본 검색의 경우 created_at을 내림차순으로 정렬하거나 고급 검색의 경우 가장 관련 있는 문서를 기준으로 정렬됩니다.
state 문자열 아니오 상태로 필터링합니다. issuesmerge_requests 범위를 지원하며, 다른 범위는 무시됩니다.

응답은 요청된 범위에 따라 달라집니다.

범위: 이슈

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/12/search?scope=issues&search=file"

예시 응답:

[
  {
    "id": 83,
    "iid": 1,
    "project_id": 12,
    "title": "파일 추가",
    "description": "첫 번째 파일 추가",
    "state": "opened",
    "created_at": "2018-01-24T06:02:15.514Z",
    "updated_at": "2018-02-06T12:36:23.263Z",
    "closed_at": null,
    "labels":[],
    "milestone": null,
    "assignees": [{
      "id": 20,
      "name": "Ceola Deckow",
      "username": "sammy.collier",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/c23d85a4f50e0ea76ab739156c639231?s=80&d=identicon",
      "web_url": "http://localhost:3000/sammy.collier"
    }],
    "author": {
      "id": 1,
      "name": "Administrator",
      "username": "root",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
      "web_url": "http://localhost:3000/root"
    },
    "assignee": {
      "id": 20,
      "name": "Ceola Deckow",
      "username": "sammy.collier",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/c23d85a4f50e0ea76ab739156c639231?s=80&d=identicon",
      "web_url": "http://localhost:3000/sammy.collier"
    },
    "user_notes_count": 0,
    "upvotes": 0,
    "downvotes": 0,
    "due_date": null,
    "confidential": false,
    "discussion_locked": null,
    "web_url": "http://localhost:3000/h5bp/7bp/subgroup-prj/issues/1",
    "time_stats": {
      "time_estimate": 0,
      "total_time_spent": 0,
      "human_time_estimate": null,
      "human_total_time_spent": null
    }
  }
]
note
assignee 열은 폐기되었으며, 이제 GitLab EE API에 맞추기 위해 단일 크기의 배열 assignees로 표시됩니다.

범위: Merge Request

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/6/search?scope=merge_requests&search=file"

예시 응답:

[
  {
    "id": 56,
    "iid": 8,
    "project_id": 6,
    "title": "첫 번째 파일 추가",
    "description": "이것은 파일을 추가하는 테스트 MR입니다.",
    "state": "opened",
    "created_at": "2018-01-22T14:21:50.830Z",
    "updated_at": "2018-02-06T12:40:33.295Z",
    "target_branch": "main",
    "source_branch": "jaja-test",
    "upvotes": 0,
    "downvotes": 0,
    "author": {
      "id": 1,
      "name": "Administrator",
      "username": "root",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
      "web_url": "http://localhost:3000/root"
    },
    "assignee": {
      "id": 5,
      "name": "Jacquelyn Kutch",
      "username": "abigail",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/3138c66095ee4bd11a508c2f7f7772da?s=80&d=identicon",
      "web_url": "http://localhost:3000/abigail"
    },
    "source_project_id": 6,
    "target_project_id": 6,
    "labels": [
      "ruby",
      "tests"
    ],
    "draft": false,
    "work_in_progress": false,
    "milestone": {
      "id": 13,
      "iid": 3,
      "project_id": 6,
      "title": "v2.0",
      "description": "Qui aut qui eos dolor beatae itaque tempore molestiae.",
      "state": "active",
      "created_at": "2017-09-05T07:58:29.099Z",
      "updated_at": "2017-09-05T07:58:29.099Z",
      "due_date": null,
      "start_date": null
    },
    "merge_when_pipeline_succeeds": false,
    "merge_status": "can_be_merged",
    "sha": "78765a2d5e0a43585945c58e61ba2f822e4d090b",
    "merge_commit_sha": null,
    "squash_commit_sha": null,
    "user_notes_count": 0,
    "discussion_locked": null,
    "should_remove_source_branch": null,
    "force_remove_source_branch": true,
    "web_url": "http://localhost:3000/twitter/flight/merge_requests/8",
    "time_stats": {
      "time_estimate": 0,
      "total_time_spent": 0,
      "human_time_estimate": null,
      "human_total_time_spent": null
    }
  }
]

범위: 마일스톤

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/12/search?scope=milestones&search=release"

예시 응답:

[
  {
    "id": 44,
    "iid": 1,
    "project_id": 12,
    "title": "다음 릴리스",
    "description": "다음 릴리스 마일스톤",
    "state": "active",
    "created_at": "2018-02-06T12:43:39.271Z",
    "updated_at": "2018-02-06T12:44:01.298Z",
    "due_date": "2018-04-18",
    "start_date": "2018-02-04"
  }
]

범위: 노트

Tier: Premium, Ultimate Offering: GitLab.com, Self-Managed형, GitLab Dedicated
  • 13.9에서 GitLab Premium으로 이전되었습니다.
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/6/search?scope=notes&search=maxime"

예시 응답:

[
  {
    "id": 191,
    "body": "Harum maxime consequuntur et et deleniti assumenda facilis.",
    "attachment": null,
    "author": {
      "id": 23,
      "name": "User 1",
      "username": "user1",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/111d68d06e2d317b5a59c2c6c5bad808?s=80&d=identicon",
      "web_url": "http://localhost:3000/user1"
    },
    "created_at": "2017-09-05T08:01:32.068Z",
    "updated_at": "2017-09-05T08:01:32.068Z",
    "system": false,
    "noteable_id": 22,
    "noteable_type": "Issue",
    "project_id": 6,
    "noteable_iid": 2
  }
]

범위: wiki_blobs

Tier: Premium, Ultimate Offering: GitLab.com, Self-Managed, GitLab Dedicated
  • 13.9에서 GitLab Premium으로 이동되었습니다.

이 범위에 대한 필터가 있습니다:

  • 파일 이름
  • 경로
  • 확장자

필터를 사용하려면 쿼리에 포함하십시오. 예: a query filename:some_name*. 와일드카드(*)를 사용하여 glob 매칭을 할 수 있습니다.

위키 블롭 검색은 파일 이름과 내용 모두에서 수행됩니다. 검색 결과:

  • 파일 이름에서 찾은 결과가 내용에서 찾은 결과보다 먼저 표시됩니다.
  • 동일한 블롭에 대해 동일한 일치 항목이 여러 개 포함될 수 있습니다. 왜냐하면 검색 문자열이 파일 이름과 내용 모두에 있을 수 있거나 내용에서 여러 번 나타날 수 있기 때문입니다.
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/6/search?scope=wiki_blobs&search=bye"

예시 응답:


[
  {
    "basename": "home",
    "data": "hello\n\nand bye\n\nend",
    "path": "home.md",
    "filename": "home.md",
    "id": null,
    "ref": "main",
    "startline": 5,
    "project_id": 6,
    "group_id": 1
  }
]
note
filenamepath보다는 path가 선호됩니다. 두 가지 모두 리포지터리 내 파일의 전체 경로를 반환하지만 앞으로 filename은 파일 이름만 반환되고 전체 경로가 아니도록 의도되어 있습니다. 자세한 내용은 이슈 34521을 참조하세요.

범위: commits

Tier: Premium, Ultimate Offering: GitLab.com, Self-Managed, GitLab Dedicated
  • 13.9에서 GitLab Premium으로 이동되었습니다.

이 범위는 Elasticsearch가 활성화되어 있는 경우에만 사용할 수 있습니다.

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/6/search?scope=commits&search=bye"

예시 응답:


[
  {
  "id": "4109c2d872d5fdb1ed057400d103766aaea97f98",
  "short_id": "4109c2d8",
  "title": "goodbye $.browser",
  "created_at": "2013-02-18T22:02:54.000Z",
  "parent_ids": [
    "59d05353ab575bcc2aa958fe1782e93297de64c9"
  ],
  "message": "goodbye $.browser\n",
  "author_name": "angus croll",
  "author_email": "anguscroll@gmail.com",
  "authored_date": "2013-02-18T22:02:54.000Z",
  "committer_name": "angus croll",
  "committer_email": "anguscroll@gmail.com",
  "committed_date": "2013-02-18T22:02:54.000Z",
  "project_id": 6
  }
]

범위: blobs

Tier: Premium, Ultimate Offering: GitLab.com, Self-Managed, GitLab Dedicated
  • 13.9에서 GitLab Premium으로 이동되었습니다.

이 범위에 대한 필터가 있습니다:

  • 파일 이름
  • 경로
  • 확장자

필터를 사용하려면 쿼리에 포함하십시오. 예: a query filename:some_name*. 와일드카드(*)를 사용하여 glob 매칭을 할 수 있습니다.

블롭 검색은 파일 이름과 내용 모두에서 수행됩니다. 검색 결과:

  • 파일 이름에서 찾은 결과가 내용에서 찾은 결과보다 먼저 표시됩니다.
  • 동일한 블롭에 대해 동일한 일치 항목이 여러 개 포함될 수 있습니다. 왜냐하면 검색 문자열이 파일 이름과 내용 모두에 있을 수 있거나 내용에서 여러 번 나타날 수 있기 때문입니다.
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/6/search?scope=blobs&search=keyword%20filename:*.py

예시 응답:


[
  {
    "basename": "README",
    "data": "```\n\n## Installation\n\nQuick start using the [pre-built",
    "path": "README.md",
    "filename": "README.md",
    "id": null,
    "ref": "main",
    "startline": 46,
    "project_id": 6
  }
]
note
filenamepath보다는 path가 선호됩니다. 두 가지 모두 리포지터리 내 파일의 전체 경로를 반환하지만 앞으로 filename은 파일 이름만 반환되고 전체 경로가 아니도록 의도되어 있습니다. 자세한 내용은 이슈 34521을 참조하세요.

범위: users

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/6/search?scope=users&search=doe"

예시 응답:

[
  {
    "id": 1,
    "name": "John Doe1",
    "username": "user1",
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon",
    "web_url": "http://localhost/user1"
  }
]