검색 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

추가 범위는 고급 검색 API그룹 검색 API에 대해 사용할 수 있습니다. Elasticsearch가 활성화된 경우: blobs, commits, notes, wiki_blobs.

고급 검색 API

지정된 범위에서 GitLab 인스턴스 전역으로 식을 검색합니다. 응답은 요청된 범위에 따라 다릅니다.

GET /search
속성 유형 필수 설명
scope string 검색 범위입니다. projects, issues, merge_requests, milestones, snippet_titles, users 값을 포함합니다. 추가 범위: blobs, commits, notes, wiki_blobs.
search string 검색 쿼리입니다.
confidential boolean 아니요 기밀 여부로 필터링합니다. issues 범위를 지원하며, 다른 범위는 무시됩니다.
order_by string 아니요 created_at만 허용됩니다. 설정되지 않으면, 결과는 기본 검색의 경우 created_at로 내림차순 정렬되거나 고급 검색의 경우 관련 문서 중에서 가장 관련성이 높은 것으로 정렬됩니다.
sort string 아니요 asc 또는 desc만 허용됩니다. 설정되지 않으면, 결과는 기본 검색의 경우 created_at로 내림차순 정렬되거나 고급 검색의 경우 관련 문서 중에서 가장 관련성이 높은 것으로 정렬됩니다.
state string 아니요 상태로 필터링합니다. 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":[], //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/search?scope=issues&search=file"

예시 응답:

[
  {
    "id": 83,
    "iid": 1,
    "project_id": 12,
    "title": "Add file",
    "description": "Add first file",
    "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
    }
  }
]

참고: assignee 열은 사용되지 않습니다. 단일 크기의 배열 assignees로 표시되어 GitLab EE API에 준수됩니다.

범위: 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
        }
    }
]

범위: milestones

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": "다음 릴리스",
        "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"
    }
]

범위: snippet_titles

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

예시 응답:

[
    {
        "id": 50,
        "title": "샘플 파일",
        "file_name": "file.rb",
        "description": "간단한 루비 파일",
        "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"
    }
]

Scope: wiki_blobs

Tier: 프리미엄, 얼티밋 Offering: GitLab.com, Self-Managed, GitLab 전용
  • 13.9에서 GitLab 프리미엄으로 이전되었습니다.

이 scope는 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은 파일 이름만 반환하고 전체 경로는 반환하지 않을 것입니다. 자세한 내용은 이슈 34521을 참조하세요.

Scope: commits

Tier: 프리미엄, 얼티밋 Offering: GitLab.com, Self-Managed, GitLab 전용
  • 13.9에서 GitLab 프리미엄으로 이전되었습니다.

이 scope는 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
  }
]

Scope: blobs

Tier: 프리미엄, 얼티밋 Offering: GitLab.com, Self-Managed, GitLab 전용
  • 13.9에서 GitLab 프리미엄으로 이전되었습니다.

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

이 scope에 대해 사용 가능한 필터:

  • 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은 파일 이름만 반환하고 전체 경로는 반환하지 않을 것입니다. 자세한 내용은 이슈 34521을 참조하세요.

Scope: notes

Tier: 프리미엄, 얼티밋 Offering: GitLab.com, Self-Managed, GitLab 전용
  • 13.9에서 GitLab 프리미엄으로 이전되었습니다.

이 scope는 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
  }
]


### 범위: 사용자

```shell
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": "Add file",
    "description": "Add first file",
    "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
    }
  }
]

참고: 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,
    "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
    }
  }
]

범위: milestones

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": "다음 릴리스",
    "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": "안녕하세요\n\n그리고 안녕\n\n끝",
    "path": "home.md",
    "filename": "home.md",
    "id": null,
    "ref": "main",
    "startline": 5,
    "project_id": 6,
    "group_id": 1
  }
]

참고: 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가 활성화된 경우에만 사용할 수 있습니다.

이 범위에 대해 사용 가능한 필터:

  • 파일명
  • 경로
  • 확장자

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

와일드카드(*)를 사용하여 glob 일치를 할 수 있습니다.

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
  }
]

참고: 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/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": "Issue",
    "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 범위를 지원하며, 다른 범위는 무시됩니다.

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

범위: issues

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": "열림",
    "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": "활성",
      "avatar_url": "https://www.gravatar.com/avatar/c23d85a4f50e0ea76ab739156c639231?s=80&d=identicon",
      "web_url": "http://localhost:3000/sammy.collier"
    }],
    "author": {
      "id": 1,
      "name": "관리자",
      "username": "root",
      "state": "활성",
      "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": "활성",
      "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
    }
  }
]

참고: assignee 열은 폐기되었습니다. 이제 GitLab EE API와 일치하도록 단일 크기의 배열 assignees로 표시합니다.

범위: merge_requests

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
    }
  }
]

범위: milestones

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"
  }
]

범위: notes

세부 정보: Tier: Premium, Ultimate Offering: GitLab.com, Self-managed, GitLab Dedicated

  • GitLab 13.9에서 GitLab 프리미엄으로 이전되었습니다.
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
  }
]

Scope: wiki_blobs

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

필터가 이 스코프에 대해 사용 가능합니다:

  • filename
  • path
  • extension

쿼리에 필터를 포함하여 사용하세요. 예: a query filename:some_name*. 와일드카드(*)를 사용하여 글로브 매칭을 할 수 있습니다.

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

  • 파일 이름에서 찾은 결과가 내용에서 찾은 결과보다 먼저 표시됩니다.
  • 동일한 블롭에 대해 여러 일치 항목을 포함할 수 있습니다. 이는 검색 문자열이 파일 이름과 내용 둘 다에 있을 수 있거나 내용에서 여러 번 나타날 수 있기 때문입니다.
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
  }
]

참고: filenamepath를 대체하기 위해 사용되고 있습니다. 두 가지 모두 저장소 내의 파일의 전체 경로를 반환하지만 향후에 filename은 파일 이름만을 나타내고 전체 경로가 아닌 것으로 의도되어 있습니다. 자세한 내용은 이슈 34521을 참조하세요.

Scope: commits

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

이 스코프는 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
  }
]

Scope: blobs

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

필터가 이 스코프에 대해 사용 가능합니다:

  • Filename
  • Path
  • Extension

쿼리에 필터를 포함하여 사용하세요. 예: a query filename:some_name*. 와일드카드(*)를 사용하여 글로브 매칭을 할 수 있습니다.

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

  • 파일 이름에서 찾은 결과가 내용에서 찾은 결과보다 먼저 표시됩니다.
  • 동일한 블롭에 대해 여러 일치 항목을 포함할 수 있습니다. 이는 검색 문자열이 파일 이름과 내용 둘 다에 있을 수 있거나 내용에서 여러 번 나타날 수 있기 때문입니다.
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
  }
]

참고: filenamepath를 대체하기 위해 사용되고 있습니다. 두 가지 모두 저장소 내의 파일의 전체 경로를 반환하지만 향후에 filename은 파일 이름만을 나타내고 전체 경로가 아닌 것으로 의도되어 있습니다. 자세한 내용은 이슈 34521을 참조하세요.

범위: 사용자

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"
  }
]