Use this API to retrieve project-specific templates, in addition to the templates common to the entire instance:
- Dockerfile templates
- Gitignore templates
- GitLab CI/CD configuration templates
- Open source license templates
- Issue and merge request templates
These endpoints supersede the instance template endpoints, which are scheduled for removal in API version 5. File templates for groups are also supported.
List all templates of a particular type
GET /api/v4/projects/{id}/templates/{type}
Lists all templates of a specified type for a project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
typePath, | String | The type (dockerfiles|gitigno Allowed values: dockerfiles,gitignores,gitlab_,licenses,issues,merge_Minimum length: 1 |
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Retrieve a template of a particular type
GET /api/v4/projects/{id}/templates/{type}/{name}
Retrieves a template of a specified type for a project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
typePath, | String | The type (dockerfiles|gitigno Allowed values: dockerfiles,gitignores,gitlab_,licenses,issues,merge_Minimum length: 1 |
namePath, | String | The key of the template, Example: MIT |
source_Query | Integer | The project id where a given template is being stored. Example: 1 |
projectQuery | String | The project name to use when expanding placeholders in the template. Example: Git |
fullnameQuery | String | The full name of the copyright holder to use when expanding placeholders in the template. Example: Git |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Schemas
Objects returned by the operations above and objects nested in their request bodies.
APIEntitiesLicense
| Property | Type | Description |
|---|---|---|
conditions | Array of strings | Example:["include- |
content | String | Example:GNU GENERAL PUBLIC LICENSE |
description | String | Example:A simple license |
html_ | String | Example:http: |
key | String | Example:gpl- |
limitations | Array of strings | Example:["liability"] |
name | String | Example:GNU General Public License v3. |
nickname | String | Example:GNU GPLv3 |
permissions | Array of strings | Example:["commercial- |
popular | Boolean | — |
source_ | String | — |
APIEntitiesTemplatesList
| Property | Type | Description |
|---|---|---|
key | String | Example:mit |
name | String | Example:MIT License |