Topics API

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

REST API를 사용하여 프로젝트 토픽과 상호 작용합니다.

토픽 목록

GitLab 인스턴스에서 연결된 프로젝트 수에 따라 정렬된 프로젝트 토픽 목록을 반환합니다.

GET /topics

지원되는 속성:

속성 유형 필수 여부 설명
page integer 아니오 검색할 페이지. 기본값은 1입니다.
per_page integer 아니오 페이지당 반환할 레코드 수. 기본값은 20입니다.
search string 아니오 name에 대한 토픽 검색.
without_projects boolean 아니오 할당된 프로젝트가 없는 토픽으로 결과 제한.

예시 요청:

curl "https://gitlab.example.com/api/v4/topics?search=git"

예시 응답:

[
  {
    "id": 1,
    "name": "gitlab",
    "title": "GitLab",
    "description": "GitLab은 내장된 버전 관리, 이슈 추적, 코드 리뷰, CI/CD 등을 갖춘 오픈 소스 엔드투엔드 소프트웨어 개발 플랫폼입니다.",
    "total_projects_count": 1000,
    "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon"
  },
  {
    "id": 3,
    "name": "git",
    "title": "Git",
    "description": "Git은 소규모에서 매우 큰 프로젝트까지 모두 처리할 수 있도록 설계된 무료 오픈 소스 분산 버전 관리 시스템입니다.",
    "total_projects_count": 900,
    "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon"
  },
  {
    "id": 2,
    "name": "git-lfs",
    "title": "Git LFS",
    "description": null,
    "total_projects_count": 300,
    "avatar_url": null
  }
]

토픽 가져오기

프로젝트 토픽을 ID로 가져옵니다.

GET /topics/:id

지원되는 속성:

속성 유형 필수 여부 설명
id integer 프로젝트 토픽의 ID

예시 요청:

curl "https://gitlab.example.com/api/v4/topics/1"

예시 응답:

{
  "id": 1,
  "name": "gitlab",
  "title": "GitLab",
  "description": "GitLab은 내장된 버전 관리, 이슈 추적, 코드 리뷰, CI/CD 등을 갖춘 오픈 소스 엔드투엔드 소프트웨어 개발 플랫폼입니다.",
  "total_projects_count": 1000,
  "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon"
}

토픽에 할당된 프로젝트 목록

특정 토픽에 할당된 모든 프로젝트를 나열하려면 프로젝트 API를 사용하세요.

GET /projects?topic=<topic_name>

프로젝트 토픽 생성

새로운 프로젝트 토픽을 생성합니다. 관리자만 사용할 수 있습니다.

POST /topics

지원되는 속성:

속성 유형 필수 여부 설명
name string 슬러그 (이름)
title string 제목
avatar file 아니오 아바타
description string 아니오 설명

예시 요청:

curl --request POST \
     --data "name=topic1&title=Topic 1" \
     --header "PRIVATE-TOKEN: <your_access_token>" \
     "https://gitlab.example.com/api/v4/topics"

예시 응답:

{
  "id": 1,
  "name": "topic1",
  "title": "Topic 1",
  "description": null,
  "total_projects_count": 0,
  "avatar_url": null
}

프로젝트 토픽 업데이트

프로젝트 토픽을 업데이트합니다. 관리자만 사용할 수 있습니다.

PUT /topics/:id

지원되는 속성:

속성 유형 필수 여부 설명
id integer 프로젝트 토픽의 ID
avatar file 아니오 아바타
description string 아니오 설명
name string 아니오 슬러그 (이름)
title string 아니오 제목

예시 요청:

curl --request PUT \
     --data "name=topic1" \
     --header "PRIVATE-TOKEN: <your_access_token>" \
     "https://gitlab.example.com/api/v4/topics/1"

예시 응답:

{
  "id": 1,
  "name": "topic1",
  "title": "Topic 1",
  "description": null,
  "total_projects_count": 0,
  "avatar_url": null
}

토픽 아바타 업로드

파일 시스템에서 아바타 파일을 업로드하려면 --form 인수를 사용하십시오. 이 인수는 cURL이 Content-Type: multipart/form-data 헤더를 사용하여 데이터를 게시하도록합니다. file= 매개변수는 파일 시스템의 파일을 가리켜야하며 앞에 @ 기호가 있어야합니다. 예를 들면:

curl --request PUT \
     --header "PRIVATE-TOKEN: <your_access_token>" \
     "https://gitlab.example.com/api/v4/topics/1" \
     --form "avatar=@/tmp/example.png"

토픽 아바타 제거

토픽 아바타를 제거하려면 avatar 속성에 빈 값을 사용하십시오.

예시 요청:

curl --request PUT \
     --data "avatar=" \
     --header "PRIVATE-TOKEN: <your_access_token>" \
     "https://gitlab.example.com/api/v4/topics/1"

프로젝트 토픽 삭제

프로젝트 토픽을 삭제하려면 관리자여야합니다. 프로젝트 토픽을 삭제하면 프로젝트에 대한 토픽 할당도 삭제됩니다.

DELETE /topics/:id

지원되는 속성:

속성 유형 필수 설명
id 정수 프로젝트 토픽 ID

예시 요청:

curl --request DELETE \
     --header "PRIVATE-TOKEN: <your_access_token>" \
     "https://gitlab.example.com/api/v4/topics/1"

토픽 병합

소스 토픽을 대상 토픽으로 병합하려면 관리자 여야합니다. 토픽을 병합하면 소스 토픽이 삭제되고 모든 할당된 프로젝트가 대상 토픽으로 이동됩니다.

POST /topics/merge

지원되는 속성:

속성 유형 필수 설명
source_topic_id 정수 소스 프로젝트 토픽 ID
target_topic_id 정수 대상 프로젝트 토픽 ID

예시 요청:

curl --request POST \
     --data "source_topic_id=2&target_topic_id=1" \
     --header "PRIVATE-TOKEN: <your_access_token>" \
     "https://gitlab.example.com/api/v4/topics/merge"

예시 응답:

{
  "id": 1,
  "name": "topic1",
  "title": "Topic 1",
  "description": null,
  "total_projects_count": 0,
  "avatar_url": null
}