InfoGrab Docs

프로젝트 템플릿 API

요약

이 API를 사용하여 다음 엔드포인트의 프로젝트별 버전을 가져옵니다: API 버전 5에서 제거될 예정인 이러한 엔드포인트를 대체합니다. 인스턴스 공통 템플릿 외에도 이 API 엔드포인트에서 프로젝트별 템플릿도 사용할 수 있습니다.

이 API를 사용하여 다음 엔드포인트의 프로젝트별 버전을 가져옵니다:

API 버전 5에서 제거될 예정인 이러한 엔드포인트를 대체합니다.

인스턴스 공통 템플릿 외에도 이 API 엔드포인트에서 프로젝트별 템플릿도 사용할 수 있습니다.

그룹용 파일 템플릿도 지원됩니다.

특정 유형의 모든 템플릿 나열#

프로젝트에 대해 지정된 유형의 모든 템플릿을 나열합니다.

GET /projects/:id/templates/:type

지원되는 속성:

속성 유형 필수 여부 설명
id 정수 또는 문자열 Yes 프로젝트의 ID 또는 URL 인코딩된 경로.
type 문자열 Yes 템플릿 유형. 허용 값: dockerfiles, gitignores, gitlab_ci_ymls, licenses, issues, merge_requests.

성공하면 200 OK와 다음 응답 속성을 반환합니다:

속성 유형 설명
key 문자열 템플릿의 고유 식별자.
name 문자열 사람이 읽을 수 있는 템플릿 이름.

예시 요청:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/templates/licenses"

예시 응답 (라이선스):

[
  {
    "key": "epl-1.0",
    "name": "Eclipse Public License 1.0"
  },
  {
    "key": "lgpl-3.0",
    "name": "GNU Lesser General Public License v3.0"
  },
  {
    "key": "unlicense",
    "name": "The Unlicense"
  },
  {
    "key": "agpl-3.0",
    "name": "GNU Affero General Public License v3.0"
  },
  {
    "key": "gpl-3.0",
    "name": "GNU General Public License v3.0"
  },
  {
    "key": "bsd-3-clause",
    "name": "BSD 3-clause \"New\" or \"Revised\" License"
  },
  {
    "key": "lgpl-2.1",
    "name": "GNU Lesser General Public License v2.1"
  },
  {
    "key": "mit",
    "name": "MIT License"
  },
  {
    "key": "apache-2.0",
    "name": "Apache License 2.0"
  },
  {
    "key": "bsd-2-clause",
    "name": "BSD 2-clause \"Simplified\" License"
  },
  {
    "key": "mpl-2.0",
    "name": "Mozilla Public License 2.0"
  },
  {
    "key": "gpl-2.0",
    "name": "GNU General Public License v2.0"
  }
]

특정 유형의 템플릿 가져오기#

프로젝트에 대해 지정된 유형의 템플릿을 가져옵니다.

GET /projects/:id/templates/:type/:name

지원되는 속성:

속성 유형 필수 여부 설명
id 정수 또는 문자열 Yes 프로젝트의 ID 또는 URL 인코딩된 경로.
name 문자열 Yes 컬렉션 엔드포인트에서 가져온 템플릿의 키.
type 문자열 Yes 템플릿 유형. dockerfiles, gitignores, gitlab_ci_ymls, licenses, issues, merge_requests 중 하나.
fullname 문자열 No 템플릿의 플레이스홀더를 확장할 때 사용할 저작권 보유자의 전체 이름. 라이선스에만 영향을 줍니다.
project 문자열 No 템플릿의 플레이스홀더를 확장할 때 사용할 프로젝트 이름. 라이선스에만 영향을 줍니다.
source_template_project_id 정수 No 지정된 템플릿이 저장된 프로젝트 ID. 다른 프로젝트에서 동일한 이름을 가진 여러 템플릿이 있는 경우 유용합니다. source_template_project_id를 지정하지 않으면 여러 템플릿이 동일한 이름을 가질 경우 가장 가까운 상위 항목의 일치 항목이 반환됩니다.

성공하면 200 OK와 다음 응답 속성을 반환합니다:

속성 유형 설명
conditions 배열 라이선스 조건 배열. 라이선스에만 사용 가능.
content 문자열 템플릿 내용.
description 문자열 라이선스 설명. 라이선스에만 사용 가능.
html_url 문자열 라이선스 정보 페이지 URL. 라이선스에만 사용 가능.
key 문자열 템플릿의 고유 식별자. 라이선스에만 사용 가능.
limitations 배열 라이선스 제한 배열. 라이선스에만 사용 가능.
name 문자열 사람이 읽을 수 있는 템플릿 이름.
nickname 문자열 라이선스의 일반 별칭. 라이선스에만 사용 가능.
permissions 배열 라이선스 권한 배열. 라이선스에만 사용 가능.
popular 불리언 true이면 인기 있는 라이선스임을 나타냄. 라이선스에만 사용 가능.
source_url 문자열 라이선스 소스 URL. 라이선스에만 사용 가능.

예시 요청:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/templates/dockerfiles/Binary"

예시 응답 (Dockerfile):

{
  "name": "Binary",
  "content": "# This file is a template, and might need editing before it works on your project.\n# This Dockerfile installs a compiled binary into a bare system.\n# You must either commit your compiled binary into source control (not recommended)\n# or build the binary first as part of a CI/CD pipeline.\n\nFROM buildpack-deps:buster\n\nWORKDIR /usr/local/bin\n\n# Change `app` to whatever your binary is called\nAdd app .\nCMD [\"./app\"]\n"
}

예시 요청:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/templates/licenses/mit"

예시 응답 (라이선스):

{
  "key": "mit",
  "name": "MIT License",
  "nickname": null,
  "popular": true,
  "html_url": "http://choosealicense.com/licenses/mit/",
  "source_url": "https://opensource.org/licenses/MIT",
  "description": "A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.",
  "conditions": [
    "include-copyright"
  ],
  "permissions": [
    "commercial-use",
    "modifications",
    "distribution",
    "private-use"
  ],
  "limitations": [
    "liability",
    "warranty"
  ],
  "content": "MIT License\n\nCopyright (c) 2018 [fullname]\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
}

프로젝트 템플릿 API

Tier: Free, Premium, Ultimate
Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
원문 보기
요약

이 API를 사용하여 다음 엔드포인트의 프로젝트별 버전을 가져옵니다: API 버전 5에서 제거될 예정인 이러한 엔드포인트를 대체합니다. 인스턴스 공통 템플릿 외에도 이 API 엔드포인트에서 프로젝트별 템플릿도 사용할 수 있습니다.

이 API를 사용하여 다음 엔드포인트의 프로젝트별 버전을 가져옵니다:

API 버전 5에서 제거될 예정인 이러한 엔드포인트를 대체합니다.

인스턴스 공통 템플릿 외에도 이 API 엔드포인트에서 프로젝트별 템플릿도 사용할 수 있습니다.

그룹용 파일 템플릿도 지원됩니다.

특정 유형의 모든 템플릿 나열#

프로젝트에 대해 지정된 유형의 모든 템플릿을 나열합니다.

GET /projects/:id/templates/:type

지원되는 속성:

속성 유형 필수 여부 설명
id 정수 또는 문자열 Yes 프로젝트의 ID 또는 URL 인코딩된 경로.
type 문자열 Yes 템플릿 유형. 허용 값: dockerfiles, gitignores, gitlab_ci_ymls, licenses, issues, merge_requests.

성공하면 200 OK와 다음 응답 속성을 반환합니다:

속성 유형 설명
key 문자열 템플릿의 고유 식별자.
name 문자열 사람이 읽을 수 있는 템플릿 이름.

예시 요청:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/templates/licenses"

예시 응답 (라이선스):

[
  {
    "key": "epl-1.0",
    "name": "Eclipse Public License 1.0"
  },
  {
    "key": "lgpl-3.0",
    "name": "GNU Lesser General Public License v3.0"
  },
  {
    "key": "unlicense",
    "name": "The Unlicense"
  },
  {
    "key": "agpl-3.0",
    "name": "GNU Affero General Public License v3.0"
  },
  {
    "key": "gpl-3.0",
    "name": "GNU General Public License v3.0"
  },
  {
    "key": "bsd-3-clause",
    "name": "BSD 3-clause \"New\" or \"Revised\" License"
  },
  {
    "key": "lgpl-2.1",
    "name": "GNU Lesser General Public License v2.1"
  },
  {
    "key": "mit",
    "name": "MIT License"
  },
  {
    "key": "apache-2.0",
    "name": "Apache License 2.0"
  },
  {
    "key": "bsd-2-clause",
    "name": "BSD 2-clause \"Simplified\" License"
  },
  {
    "key": "mpl-2.0",
    "name": "Mozilla Public License 2.0"
  },
  {
    "key": "gpl-2.0",
    "name": "GNU General Public License v2.0"
  }
]

특정 유형의 템플릿 가져오기#

프로젝트에 대해 지정된 유형의 템플릿을 가져옵니다.

GET /projects/:id/templates/:type/:name

지원되는 속성:

속성 유형 필수 여부 설명
id 정수 또는 문자열 Yes 프로젝트의 ID 또는 URL 인코딩된 경로.
name 문자열 Yes 컬렉션 엔드포인트에서 가져온 템플릿의 키.
type 문자열 Yes 템플릿 유형. dockerfiles, gitignores, gitlab_ci_ymls, licenses, issues, merge_requests 중 하나.
fullname 문자열 No 템플릿의 플레이스홀더를 확장할 때 사용할 저작권 보유자의 전체 이름. 라이선스에만 영향을 줍니다.
project 문자열 No 템플릿의 플레이스홀더를 확장할 때 사용할 프로젝트 이름. 라이선스에만 영향을 줍니다.
source_template_project_id 정수 No 지정된 템플릿이 저장된 프로젝트 ID. 다른 프로젝트에서 동일한 이름을 가진 여러 템플릿이 있는 경우 유용합니다. source_template_project_id를 지정하지 않으면 여러 템플릿이 동일한 이름을 가질 경우 가장 가까운 상위 항목의 일치 항목이 반환됩니다.

성공하면 200 OK와 다음 응답 속성을 반환합니다:

속성 유형 설명
conditions 배열 라이선스 조건 배열. 라이선스에만 사용 가능.
content 문자열 템플릿 내용.
description 문자열 라이선스 설명. 라이선스에만 사용 가능.
html_url 문자열 라이선스 정보 페이지 URL. 라이선스에만 사용 가능.
key 문자열 템플릿의 고유 식별자. 라이선스에만 사용 가능.
limitations 배열 라이선스 제한 배열. 라이선스에만 사용 가능.
name 문자열 사람이 읽을 수 있는 템플릿 이름.
nickname 문자열 라이선스의 일반 별칭. 라이선스에만 사용 가능.
permissions 배열 라이선스 권한 배열. 라이선스에만 사용 가능.
popular 불리언 true이면 인기 있는 라이선스임을 나타냄. 라이선스에만 사용 가능.
source_url 문자열 라이선스 소스 URL. 라이선스에만 사용 가능.

예시 요청:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/templates/dockerfiles/Binary"

예시 응답 (Dockerfile):

{
  "name": "Binary",
  "content": "# This file is a template, and might need editing before it works on your project.\n# This Dockerfile installs a compiled binary into a bare system.\n# You must either commit your compiled binary into source control (not recommended)\n# or build the binary first as part of a CI/CD pipeline.\n\nFROM buildpack-deps:buster\n\nWORKDIR /usr/local/bin\n\n# Change `app` to whatever your binary is called\nAdd app .\nCMD [\"./app\"]\n"
}

예시 요청:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/templates/licenses/mit"

예시 응답 (라이선스):

{
  "key": "mit",
  "name": "MIT License",
  "nickname": null,
  "popular": true,
  "html_url": "http://choosealicense.com/licenses/mit/",
  "source_url": "https://opensource.org/licenses/MIT",
  "description": "A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.",
  "conditions": [
    "include-copyright"
  ],
  "permissions": [
    "commercial-use",
    "modifications",
    "distribution",
    "private-use"
  ],
  "limitations": [
    "liability",
    "warranty"
  ],
  "content": "MIT License\n\nCopyright (c) 2018 [fullname]\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
}