검색 API
피처 플래그
search_filter_by_confidential
가 GitLab 13.6에서 제거되었습니다.
모든 검색 API 호출은 인증되어야 합니다.
추가 범위
추가 범위는 고급 검색 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 | 아니요 | 상태별로 필터링합니다. issues 및 merge_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": "첫 번째 파일 추가",
"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
로 표시됩니다.Scope: 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": "관리자",
"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
}
}
]
Scope: 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"
}
]
Scope: 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": "관리자",
"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
- Moved to GitLab Premium in 13.9.
이 스코프는 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
}
]
filename
은 path
대신에 사용되며, 향후 filename
은 파일 이름만이 아닌 전체 경로를 반환하는 것을 의도하고 있습니다. 자세한 내용은 issue 34521을 참조하세요.범위: 커밋
- 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
}
]
범위: 블롭
- 13.9 버전에서 GitLab Premium으로 이동되었습니다.
이 범위는 Elasticsearch이 활성화된 경우에만 사용할 수 있습니다.
이 범위에 대해 사용 가능한 필터는 다음과 같습니다:
- 파일명
- 경로
- 확장자
필터를 사용하려면 쿼리에 포함하십시오. 예: 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
}
]
filename
은 앞으로 파일명만이 아닌 전체 경로를 반환하도록 의도되어 있습니다. 자세한 내용은 이슈 34521을 참조하십시오.범위: 노트
- 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
| 문자열 | 아니오 | 상태로 필터링합니다. issues 와 merge_requests 만 지원하며 다른 범위는 무시됩니다.
|
응답은 요청된 범위에 따라 달라집니다.
Scope: 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"
}
]
Scope: 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
로 표시됩니다.Scope: 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": "Add first file",
"description": "This is a test MR to add file",
"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
}
}
]
### 범위: `마일스톤`
```shell
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
- 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
}
]
filename
은 path
에 대한 대안으로 사용되며 두 가지 모두 리포지터리 내 파일의 전체 경로를 반환하지만, 미래에 filename
은 파일 이름만이 아닌 전체 경로가 아닌 것을 의도하고 있습니다. 자세한 내용은 이슈 34521을 참조하세요.범위: 커밋
- 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
}
]
범위: 블롭
- 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
}
]
filename
은 path
에 대한 대안으로 사용되며 두 가지 모두 리포지터리 내 파일의 전체 경로를 반환하지만, 미래에 filename
은 파일 이름만이 아닌 전체 경로가 아닌 것을 의도하고 있습니다. 자세한 내용은 이슈 34521을 참조하세요.범위: 노트
- 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
| 문자열 | 아니요 | 상태로 필터링합니다. issues 및 merge_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": "열림",
"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": "관리자",
"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 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": "열림",
"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": "관리자",
"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": [
"루비",
"테스트"
],
"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": "Merge 가능",
"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": "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"
}
]
범위: 노트
- 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": "사용자 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
}
]
범위: 위키 블롭
- 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
}
]
filename
은 path
에 비해 사용이 중단되었습니다. 둘 다 리포지터리 내 파일의 전체 경로를 반환하지만, 앞으로 filename
은 파일명만이 아닌 전체 경로를 반환할 예정입니다. 자세한 내용은 이슈 34521을 참조하십시오.범위: 커밋
- 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
}
]
범위: 블롭
- 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
}
]
filename
은 path
에 비해 사용이 중단되었습니다. 둘 다 리포지터리 내 파일의 전체 경로를 반환하지만, 앞으로 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"
}
]