summaryrefslogtreecommitdiff
path: root/doc/api/import.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/api/import.md')
-rw-r--r--doc/api/import.md77
1 files changed, 68 insertions, 9 deletions
diff --git a/doc/api/import.md b/doc/api/import.md
index 1baea5d1500..78b9beb1815 100644
--- a/doc/api/import.md
+++ b/doc/api/import.md
@@ -1,7 +1,7 @@
---
stage: Manage
group: Import
-info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
+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
---
# Import API **(FREE)**
@@ -14,13 +14,14 @@ Import your projects from GitHub to GitLab via the API.
POST /import/github
```
-| Attribute | Type | Required | Description |
-|------------|---------|----------|---------------------|
-| `personal_access_token` | string | yes | GitHub personal access token |
-| `repo_id` | integer | yes | GitHub repository ID |
-| `new_name` | string | no | New repository name |
-| `target_namespace` | string | yes | Namespace to import repository into. Supports subgroups like `/namespace/subgroup`. |
-| `github_hostname` | string | no | Custom GitHub Enterprise hostname. Do not set for GitHub.com. |
+| Attribute | Type | Required | Description |
+|-------------------------|---------|----------|-------------------------------------------------------------------------------------|
+| `personal_access_token` | string | yes | GitHub personal access token |
+| `repo_id` | integer | yes | GitHub repository ID |
+| `new_name` | string | no | New repository name |
+| `target_namespace` | string | yes | Namespace to import repository into. Supports subgroups like `/namespace/subgroup` |
+| `github_hostname` | string | no | Custom GitHub Enterprise hostname. Do not set for GitHub.com. |
+| `optional_stages` | object | no | [Additional items to import](../user/project/import/github.md#select-additional-items-to-import). [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/373705) in GitLab 15.5 |
```shell
curl --request POST \
@@ -32,10 +33,23 @@ curl --request POST \
"repo_id": "12345",
"target_namespace": "group/subgroup",
"new_name": "NEW-NAME",
- "github_hostname": "https://github.example.com"
+ "github_hostname": "https://github.example.com",
+ "optional_stages": {
+ "single_endpoint_issue_events_import": true,
+ "single_endpoint_notes_import": true,
+ "attachments_import": true
+ }
}'
```
+The following keys are available for `optional_stages`:
+
+- `single_endpoint_issue_events_import`, for issue and pull request events import.
+- `single_endpoint_notes_import`, for an alternative and more thorough comments import.
+- `attachments_import`, for Markdown attachments import.
+
+For more information, see [Select additional items to import](../user/project/import/github.md#select-additional-items-to-import).
+
Example response:
```json
@@ -47,6 +61,51 @@ Example response:
}
```
+## Cancel GitHub project import
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/364783) in GitLab 15.5.
+
+Cancel an in-progress GitHub project import using the API.
+
+```plaintext
+POST /import/github/cancel
+```
+
+| Attribute | Type | Required | Description |
+|------------|---------|----------|---------------------|
+| `project_id` | integer | yes | GitLab project ID |
+
+```shell
+curl --request POST \
+ --url "https://gitlab.example.com/api/v4/import/github/cancel" \
+ --header "content-type: application/json" \
+ --header "PRIVATE-TOKEN: <your_access_token>" \
+ --data '{
+ "project_id": 12345
+}'
+```
+
+Example response:
+
+```json
+{
+ "id": 160,
+ "name": "my-repo",
+ "full_path": "/root/my-repo",
+ "full_name": "Administrator / my-repo",
+ "import_source": "source/source-repo",
+ "import_status": "canceled",
+ "human_import_status_name": "canceled",
+ "provider_link": "/source/source-repo"
+}
+```
+
+Returns the following status codes:
+
+- `200 OK`: the project import is being canceled.
+- `400 Bad Request`: the project import cannot be canceled.
+- `404 Not Found`: the project associated with `project_id` does not exist.
+
## Import repository from Bitbucket Server
Import your projects from Bitbucket Server to GitLab via the API.