debian-mirror-gitlab/doc/api/repositories.md

451 lines
18 KiB
Markdown
Raw Normal View History

2020-10-24 23:57:45 +05:30
---
stage: Create
group: Source Code
2022-11-25 23:54:43 +05:30
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments"
2020-10-24 23:57:45 +05:30
type: reference, api
---
2021-03-11 19:13:27 +05:30
# Repositories API **(FREE)**
2014-09-02 18:07:02 +05:30
## List repository tree
2022-11-25 23:54:43 +05:30
> Iterating pages of results with a number (`?page=2`) [deprecated](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67509) in GitLab 14.3.
2017-08-17 22:00:37 +05:30
Get a list of repository files and directories in a project. This endpoint can
be accessed without authentication if the repository is publicly accessible.
2022-11-25 23:54:43 +05:30
This command provides essentially the same features as the `git ls-tree`
command. For more information, refer to the section
[Tree Objects](https://git-scm.com/book/en/v2/Git-Internals-Git-Objects/#_tree_objects)
in the Git internals documentation.
2014-09-02 18:07:02 +05:30
2021-11-18 22:05:49 +05:30
WARNING:
2023-04-23 21:23:45 +05:30
This endpoint changed to [keyset-based pagination](rest/index.md#keyset-based-pagination)
2022-11-25 23:54:43 +05:30
in GitLab 15.0. Iterating pages of results with a number (`?page=2`) is unsupported.
2021-11-18 22:05:49 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2014-09-02 18:07:02 +05:30
GET /projects/:id/repository/tree
```
2021-03-11 19:13:27 +05:30
Supported attributes:
2014-09-02 18:07:02 +05:30
2021-03-11 19:13:27 +05:30
| Attribute | Type | Required | Description |
| :---------- | :------------- | :------- | :---------- |
2023-04-23 21:23:45 +05:30
| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. |
2021-11-18 22:05:49 +05:30
| `page_token` | string | no | The tree record ID at which to fetch the next page. Used only with keyset pagination. |
2023-04-23 21:23:45 +05:30
| `pagination` | string | no | If `keyset`, use the [keyset-based pagination method](rest/index.md#keyset-based-pagination). |
2022-11-25 23:54:43 +05:30
| `path` | string | no | The path inside the repository. Used to get content of subdirectories. |
2023-04-23 21:23:45 +05:30
| `per_page` | integer | no | Number of results to show per page. If not specified, defaults to `20`. For more information, see [Pagination](rest/index.md#pagination). |
2022-11-25 23:54:43 +05:30
| `recursive` | boolean | no | Boolean value used to get a recursive tree. Default is `false`. |
| `ref` | string | no | The name of a repository branch or tag or, if not given, the default branch. |
2014-09-02 18:07:02 +05:30
```json
[
{
2017-08-17 22:00:37 +05:30
"id": "a1e8f8d745cc87e3a9248358d9352bb7f9a0aeba",
"name": "html",
2014-09-02 18:07:02 +05:30
"type": "tree",
2017-08-17 22:00:37 +05:30
"path": "files/html",
"mode": "040000"
2014-09-02 18:07:02 +05:30
},
{
2017-08-17 22:00:37 +05:30
"id": "4535904260b1082e14f867f7a24fd8c21495bde3",
"name": "images",
2014-09-02 18:07:02 +05:30
"type": "tree",
2017-08-17 22:00:37 +05:30
"path": "files/images",
"mode": "040000"
2014-09-02 18:07:02 +05:30
},
{
2017-08-17 22:00:37 +05:30
"id": "31405c5ddef582c5a9b7a85230413ff90e2fe720",
"name": "js",
2014-09-02 18:07:02 +05:30
"type": "tree",
2017-08-17 22:00:37 +05:30
"path": "files/js",
"mode": "040000"
2014-09-02 18:07:02 +05:30
},
{
2017-08-17 22:00:37 +05:30
"id": "cc71111cfad871212dc99572599a568bfe1e7e00",
"name": "lfs",
"type": "tree",
"path": "files/lfs",
"mode": "040000"
2014-09-02 18:07:02 +05:30
},
{
2017-08-17 22:00:37 +05:30
"id": "fd581c619bf59cfdfa9c8282377bb09c2f897520",
"name": "markdown",
"type": "tree",
"path": "files/markdown",
"mode": "040000"
2014-09-02 18:07:02 +05:30
},
{
2017-08-17 22:00:37 +05:30
"id": "23ea4d11a4bdd960ee5320c5cb65b5b3fdbc60db",
"name": "ruby",
"type": "tree",
"path": "files/ruby",
"mode": "040000"
},
{
"id": "7d70e02340bac451f281cecf0a980907974bd8be",
"name": "whitespace",
2014-09-02 18:07:02 +05:30
"type": "blob",
2017-08-17 22:00:37 +05:30
"path": "files/whitespace",
"mode": "100644"
2014-09-02 18:07:02 +05:30
}
]
```
2017-08-17 22:00:37 +05:30
## Get a blob from repository
2014-09-02 18:07:02 +05:30
2022-11-25 23:54:43 +05:30
Allows you to receive information, such as size and content, about blobs in a repository.
Blob content is Base64 encoded. This endpoint can be accessed without authentication,
if the repository is publicly accessible.
2014-09-02 18:07:02 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2014-09-02 18:07:02 +05:30
GET /projects/:id/repository/blobs/:sha
```
2021-03-11 19:13:27 +05:30
Supported attributes:
2014-09-02 18:07:02 +05:30
2021-03-11 19:13:27 +05:30
| Attribute | Type | Required | Description |
| :-------- | :------------- | :------- | :---------- |
2023-04-23 21:23:45 +05:30
| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. |
2021-03-11 19:13:27 +05:30
| `sha` | string | yes | The blob SHA. |
2014-09-02 18:07:02 +05:30
## Raw blob content
2022-11-25 23:54:43 +05:30
Get the raw file contents for a blob, by blob SHA. This endpoint can be accessed
2017-08-17 22:00:37 +05:30
without authentication if the repository is publicly accessible.
2014-09-02 18:07:02 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2017-08-17 22:00:37 +05:30
GET /projects/:id/repository/blobs/:sha/raw
2014-09-02 18:07:02 +05:30
```
2021-03-11 19:13:27 +05:30
Supported attributes:
2014-09-02 18:07:02 +05:30
2021-03-11 19:13:27 +05:30
| Attribute | Type | Required | Description |
| :-------- | :------- | :------- | :---------- |
2023-04-23 21:23:45 +05:30
| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. |
2021-10-27 15:23:28 +05:30
| `sha` | string | yes | The blob SHA. |
2014-09-02 18:07:02 +05:30
## Get file archive
2022-08-27 11:52:29 +05:30
> - Support for [including Git LFS blobs](../topics/git/lfs/index.md#lfs-objects-in-project-archives) was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/15079) in GitLab 13.5.
> - Support for downloading a subfolder was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/28827) in GitLab 14.4.
2021-01-03 14:25:43 +05:30
2017-08-17 22:00:37 +05:30
Get an archive of the repository. This endpoint can be accessed without
authentication if the repository is publicly accessible.
2014-09-02 18:07:02 +05:30
2022-11-25 23:54:43 +05:30
For GitLab.com users, this endpoint has a rate limit threshold of 5 requests per minute.
2020-05-24 23:13:21 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2019-02-15 15:39:39 +05:30
GET /projects/:id/repository/archive[.format]
2014-09-02 18:07:02 +05:30
```
2022-11-25 23:54:43 +05:30
`format` is an optional suffix for the archive format, and defaults to
`tar.gz`. For example, specifying `archive.zip` sends an archive in ZIP format.
Available options are:
- `bz2`
- `tar`
- `tar.bz2`
- `tar.gz`
- `tb2`
- `tbz`
- `tbz2`
- `zip`
2019-02-15 15:39:39 +05:30
2021-03-11 19:13:27 +05:30
Supported attributes:
2014-09-02 18:07:02 +05:30
2021-03-11 19:13:27 +05:30
| Attribute | Type | Required | Description |
|:------------|:---------------|:---------|:----------------------|
2023-04-23 21:23:45 +05:30
| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. |
2022-11-25 23:54:43 +05:30
| `path` | string | no | The subpath of the repository to download. If an empty string, defaults to the whole repository. |
| `sha` | string | no | The commit SHA to download. A tag, branch reference, or SHA can be used. If not specified, defaults to the tip of the default branch. |
2021-03-11 19:13:27 +05:30
Example request:
2019-07-07 11:18:12 +05:30
2020-03-13 15:44:24 +05:30
```shell
2021-11-18 22:05:49 +05:30
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.com/api/v4/projects/<project_id>/repository/archive?sha=<commit_sha>&path=<path>"
2019-09-30 21:07:59 +05:30
```
2014-09-02 18:07:02 +05:30
## Compare branches, tags or commits
2017-08-17 22:00:37 +05:30
This endpoint can be accessed without authentication if the repository is
2022-11-25 23:54:43 +05:30
publicly accessible. Diffs can have an empty diff string if
2023-03-17 16:20:25 +05:30
[diff limits](../development/merge_request_concepts/diffs/index.md#diff-limits) are reached.
2017-08-17 22:00:37 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2014-09-02 18:07:02 +05:30
GET /projects/:id/repository/compare
```
2021-03-11 19:13:27 +05:30
Supported attributes:
2014-09-02 18:07:02 +05:30
2021-04-29 21:17:54 +05:30
| Attribute | Type | Required | Description |
| :--------- | :------------- | :------- | :---------- |
2023-04-23 21:23:45 +05:30
| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. |
2021-04-29 21:17:54 +05:30
| `from` | string | yes | The commit SHA or branch name. |
| `to` | string | yes | The commit SHA or branch name. |
2022-11-25 23:54:43 +05:30
| `from_project_id` | integer | no | The ID to compare from. |
| `straight` | boolean | no | Comparison method: `true` for direct comparison between `from` and `to` (`from`..`to`), `false` to compare using merge base (`from`...`to`)'. Default is `false`. |
2014-09-02 18:07:02 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2014-09-02 18:07:02 +05:30
GET /projects/:id/repository/compare?from=master&to=feature
```
2021-03-11 19:13:27 +05:30
Example response:
2014-09-02 18:07:02 +05:30
```json
{
"commit": {
"id": "12d65c8dd2b2676fa3ac47d955accc085a37a9c1",
"short_id": "12d65c8dd2b",
"title": "JS fix",
2020-04-08 14:13:33 +05:30
"author_name": "Example User",
"author_email": "user@example.com",
2014-09-02 18:07:02 +05:30
"created_at": "2014-02-27T10:27:00+02:00"
},
"commits": [{
"id": "12d65c8dd2b2676fa3ac47d955accc085a37a9c1",
"short_id": "12d65c8dd2b",
"title": "JS fix",
2020-04-08 14:13:33 +05:30
"author_name": "Example User",
"author_email": "user@example.com",
2014-09-02 18:07:02 +05:30
"created_at": "2014-02-27T10:27:00+02:00"
}],
"diffs": [{
"old_path": "files/js/application.js",
"new_path": "files/js/application.js",
"a_mode": null,
"b_mode": "100644",
"diff": "--- a/files/js/application.js\n+++ b/files/js/application.js\n@@ -24,8 +24,10 @@\n //= require g.raphael-min\n //= require g.bar-min\n //= require branch-graph\n-//= require highlightjs.min\n-//= require ace/ace\n //= require_tree .\n //= require d3\n //= require underscore\n+\n+function fix() { \n+ alert(\"Fixed\")\n+}",
"new_file": false,
"renamed_file": false,
"deleted_file": false
}],
"compare_timeout": false,
2021-11-11 11:23:49 +05:30
"compare_same_ref": false,
2023-01-13 00:05:48 +05:30
"web_url": "https://gitlab.example.com/janedoe/gitlab-foss/-/compare/ae73cb07c9eeaf35924a10f713b364d32b2dd34f...0b4bc9a49b562e85de7cc9e834518ea6828729b9"
2014-09-02 18:07:02 +05:30
}
```
## Contributors
2022-11-25 23:54:43 +05:30
> - Attributes `additions` and `deletions` [deprecated](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39653) in GitLab 13.4, because they [always returned `0`](https://gitlab.com/gitlab-org/gitlab/-/issues/233119).
> - Attributes `additions` and `deletions` [removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38920) in GitLab 14.0.
2017-08-17 22:00:37 +05:30
Get repository contributors list. This endpoint can be accessed without
authentication if the repository is publicly accessible.
2014-09-02 18:07:02 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2014-09-02 18:07:02 +05:30
GET /projects/:id/repository/contributors
```
2021-03-11 19:13:27 +05:30
Supported attributes:
2014-09-02 18:07:02 +05:30
2021-03-11 19:13:27 +05:30
| Attribute | Type | Required | Description |
| :--------- | :------------- | :------- | :---------- |
2023-04-23 21:23:45 +05:30
| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. |
2021-03-11 19:13:27 +05:30
| `order_by` | string | no | Return contributors ordered by `name`, `email`, or `commits` (orders by commit date) fields. Default is `commits`. |
| `sort` | string | no | Return contributors sorted in `asc` or `desc` order. Default is `asc`. |
2014-09-02 18:07:02 +05:30
2021-03-11 19:13:27 +05:30
Example response:
2014-09-02 18:07:02 +05:30
2020-04-08 14:13:33 +05:30
```json
2014-09-02 18:07:02 +05:30
[{
2020-04-08 14:13:33 +05:30
"name": "Example User",
"email": "example@example.com",
2014-09-02 18:07:02 +05:30
"commits": 117,
2020-10-24 23:57:45 +05:30
"additions": 0,
"deletions": 0
2014-09-02 18:07:02 +05:30
}, {
2020-04-08 14:13:33 +05:30
"name": "Sample User",
"email": "sample@example.com",
2014-09-02 18:07:02 +05:30
"commits": 33,
2020-10-24 23:57:45 +05:30
"additions": 0,
"deletions": 0
2014-09-02 18:07:02 +05:30
}]
```
2018-11-20 20:47:30 +05:30
## Merge Base
2022-11-25 23:54:43 +05:30
Get the common ancestor for 2 or more refs, such as commit SHAs, branch names, or tags.
2018-11-20 20:47:30 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2018-11-20 20:47:30 +05:30
GET /projects/:id/repository/merge_base
```
2021-03-11 19:13:27 +05:30
| Attribute | Type | Required | Description |
2022-11-25 23:54:43 +05:30
| --------- | -------------- | -------- | ---------------------------------------------------------------------------------- |
2023-04-23 21:23:45 +05:30
| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding). |
2022-11-25 23:54:43 +05:30
| `refs` | array | yes | The refs to find the common ancestor of. Accepts multiple refs. |
2021-03-11 19:13:27 +05:30
Example request:
2018-11-20 20:47:30 +05:30
2020-03-13 15:44:24 +05:30
```shell
2019-02-15 15:39:39 +05:30
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/merge_base?refs[]=304d257dcb821665ab5110318fc58a007bd104ed&refs[]=0031876facac3f2b2702a0e53a26e89939a42209"
2018-11-20 20:47:30 +05:30
```
Example response:
```json
{
2019-09-30 21:07:59 +05:30
"id": "1a0b36b3cdad1d2ee32457c102a8c0b7056fa863",
"short_id": "1a0b36b3",
"title": "Initial commit",
"created_at": "2014-02-27T08:03:18.000Z",
"parent_ids": [],
"message": "Initial commit\n",
2020-04-08 14:13:33 +05:30
"author_name": "Example User",
"author_email": "user@example.com",
2019-09-30 21:07:59 +05:30
"authored_date": "2014-02-27T08:03:18.000Z",
2020-04-08 14:13:33 +05:30
"committer_name": "Example User",
"committer_email": "user@example.com",
2019-09-30 21:07:59 +05:30
"committed_date": "2014-02-27T08:03:18.000Z"
2018-11-20 20:47:30 +05:30
}
```
2021-03-11 19:13:27 +05:30
2022-01-26 12:08:38 +05:30
## Add changelog data to a changelog file
2021-03-11 19:13:27 +05:30
2022-11-25 23:54:43 +05:30
> - [Introduced](https://gitlab.com/groups/gitlab-com/gl-infra/-/epics/351) in GitLab 13.9.
> - Commit range limits [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/89032) in GitLab 15.1 [with a flag](../administration/feature_flags.md) named `changelog_commits_limitation`. Enabled by default.
2021-03-11 19:13:27 +05:30
Generate changelog data based on commits in a repository.
2022-11-25 23:54:43 +05:30
Given a [semantic version](https://semver.org/) and a range
2021-04-17 20:07:23 +05:30
of commits, GitLab generates a changelog for all commits that use a particular
2022-11-25 23:54:43 +05:30
[Git trailer](https://git-scm.com/docs/git-interpret-trailers). GitLab adds
a new Markdown-formatted section to a changelog file in the Git repository of
the project. The output format can be customized.
2021-03-11 19:13:27 +05:30
2023-04-23 21:23:45 +05:30
For user-facing documentation, see [Changelogs](../user/project/changelogs.md).
2021-03-11 19:13:27 +05:30
```plaintext
POST /projects/:id/repository/changelog
```
2023-04-23 21:23:45 +05:30
### Supported attributes
Changelogs support these attributes:
2021-03-11 19:13:27 +05:30
| Attribute | Type | Required | Description |
| :-------- | :------- | :--------- | :---------- |
| `version` | string | yes | The version to generate the changelog for. The format must follow [semantic versioning](https://semver.org/). |
2022-11-25 23:54:43 +05:30
| `branch` | string | no | The branch to commit the changelog changes to. Defaults to the project's default branch. |
2022-08-27 11:52:29 +05:30
| `config_file` | string | no | Path to the changelog configuration file in the project's Git repository. Defaults to `.gitlab/changelog_config.yml`. |
2022-11-25 23:54:43 +05:30
| `date` | datetime | no | The date and time of the release. Defaults to the current time. |
| `file` | string | no | The file to commit the changes to. Defaults to `CHANGELOG.md`. |
| `from` | string | no | The SHA of the commit that marks the beginning of the range of commits to include in the changelog. This commit isn't included in the changelog. |
| `message` | string | no | The commit message to use when committing the changes. Defaults to `Add changelog for version X`, where `X` is the value of the `version` argument. |
| `to` | string | no | The SHA of the commit that marks the end of the range of commits to include in the changelog. This commit _is_ included in the changelog. Defaults to the branch specified in the `branch` attribute. Limited to 15000 commits unless the feature flag `changelog_commits_limitation` is disabled. |
| `trailer` | string | no | The Git trailer to use for including commits. Defaults to `Changelog`. Case-sensitive: `Example` does not match `example` or `eXaMpLE`. |
2021-03-11 19:13:27 +05:30
2022-11-25 23:54:43 +05:30
### Requirements for `from` attribute
2022-07-23 23:45:48 +05:30
2021-03-11 19:13:27 +05:30
If the `from` attribute is unspecified, GitLab uses the Git tag of the last
2021-04-17 20:07:23 +05:30
stable version that came before the version specified in the `version`
2022-11-25 23:54:43 +05:30
attribute. For GitLab to extract version numbers from tag names, Git tag names
must follow a specific format. By default, GitLab considers tags using these formats:
2021-03-11 19:13:27 +05:30
2021-04-17 20:07:23 +05:30
- `vX.Y.Z`
- `X.Y.Z`
2021-03-11 19:13:27 +05:30
2022-10-11 01:57:18 +05:30
Where `X.Y.Z` is a version that follows [semantic versioning](https://semver.org/).
2022-08-27 11:52:29 +05:30
For example, consider a project with the following tags:
2021-03-11 19:13:27 +05:30
2021-04-17 20:07:23 +05:30
- v1.0.0-pre1
2021-03-11 19:13:27 +05:30
- v1.0.0
- v1.1.0
- v2.0.0
2022-11-25 23:54:43 +05:30
If the `version` attribute is `2.1.0`, GitLab uses tag `v2.0.0`. And when the
2021-04-17 20:07:23 +05:30
version is `1.1.1`, or `1.2.0`, GitLab uses tag v1.1.0. The tag `v1.0.0-pre1` is
never used, because pre-release tags are ignored.
2021-03-11 19:13:27 +05:30
If `from` is unspecified and no tag to use is found, the API produces an error.
To solve such an error, you must explicitly specify a value for the `from`
attribute.
2021-04-17 20:07:23 +05:30
### Examples
These examples use [cURL](https://curl.se/) to perform HTTP requests.
The example commands use these values:
- **Project ID**: 42
- **Location**: hosted on GitLab.com
- **Example API token**: `token`
This command generates a changelog for version `1.0.0`.
The commit range:
- Starts with the tag of the last release.
2022-11-25 23:54:43 +05:30
- Ends with the last commit on the target branch. The default target branch is
the project's default branch.
2021-04-17 20:07:23 +05:30
If the last tag is `v0.9.0` and the default branch is `main`, the range of commits
included in this example is `v0.9.0..main`:
```shell
2022-01-26 12:08:38 +05:30
curl --request POST --header "PRIVATE-TOKEN: token" --data "version=1.0.0" "https://gitlab.com/api/v4/projects/42/repository/changelog"
2021-04-17 20:07:23 +05:30
```
To generate the data on a different branch, specify the `branch` parameter. This
command generates data from the `foo` branch:
```shell
2022-01-26 12:08:38 +05:30
curl --request POST --header "PRIVATE-TOKEN: token" --data "version=1.0.0&branch=foo" "https://gitlab.com/api/v4/projects/42/repository/changelog"
2021-04-17 20:07:23 +05:30
```
To use a different trailer, use the `trailer` parameter:
```shell
2022-01-26 12:08:38 +05:30
curl --request POST --header "PRIVATE-TOKEN: token" --data "version=1.0.0&trailer=Type" "https://gitlab.com/api/v4/projects/42/repository/changelog"
2021-04-17 20:07:23 +05:30
```
To store the results in a different file, use the `file` parameter:
```shell
2022-01-26 12:08:38 +05:30
curl --request POST --header "PRIVATE-TOKEN: token" --data "version=1.0.0&file=NEWS" "https://gitlab.com/api/v4/projects/42/repository/changelog"
2021-04-17 20:07:23 +05:30
```
2022-01-26 12:08:38 +05:30
## Generate changelog data
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/345934) in GitLab 14.6.
Generate changelog data based on commits in a repository, without committing
them to a changelog file.
Works exactly like `POST /projects/:id/repository/changelog`, except the changelog
data isn't committed to any changelog file.
```plaintext
GET /projects/:id/repository/changelog
```
Supported attributes:
| Attribute | Type | Required | Description |
| :-------- | :------- | :--------- | :---------- |
| `version` | string | yes | The version to generate the changelog for. The format must follow [semantic versioning](https://semver.org/). |
2022-11-25 23:54:43 +05:30
| `config_file` | string | no | The path of changelog configuration file in the project's Git repository, defaults to `.gitlab/changelog_config.yml`. |
| `date` | datetime | no | The date and time of the release, ISO 8601 formatted. Example: `2016-03-11T03:45:40Z`. Defaults to the current time. |
2022-01-26 12:08:38 +05:30
| `from` | string | no | The start of the range of commits (as a SHA) to use for generating the changelog. This commit itself isn't included in the list. |
2023-04-23 21:23:45 +05:30
| `to` | string | no | The end of the range of commits (as a SHA) to use for the changelog. This commit _is_ included in the list. Defaults to the HEAD of the default project branch. |
2022-01-26 12:08:38 +05:30
| `trailer` | string | no | The Git trailer to use for including commits, defaults to `Changelog`. |
```shell
curl --header "PRIVATE-TOKEN: token" "https://gitlab.com/api/v4/projects/42/repository/changelog?version=1.0.0"
```
Example Response:
```json
{
"notes": "## 1.0.0 (2021-11-17)\n\n### feature (2 changes)\n\n- [Title 2](namespace13/project13@ad608eb642124f5b3944ac0ac772fecaf570a6bf) ([merge request](namespace13/project13!2))\n- [Title 1](namespace13/project13@3c6b80ff7034fa0d585314e1571cc780596ce3c8) ([merge request](namespace13/project13!1))\n"
}
```
2023-04-23 21:23:45 +05:30
## Related topics
- User documentation for [changelogs](../user/project/changelogs.md)
- Developer documentation for [changelog entries](../development/changelog.md) in GitLab.