Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
17e5ef4b
Commit
17e5ef4b
authored
Feb 13, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add docs and changelog
parent
de83f29a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
1 deletion
+78
-1
changelogs/unreleased/41899-api-endpoint-for-importing-a-project-export.yml
...sed/41899-api-endpoint-for-importing-a-project-export.yml
+5
-0
doc/api/project_import_export.md
doc/api/project_import_export.md
+72
-0
lib/api/project_import.rb
lib/api/project_import.rb
+1
-1
No files found.
changelogs/unreleased/41899-api-endpoint-for-importing-a-project-export.yml
0 → 100644
View file @
17e5ef4b
---
title
:
API endpoint for importing a project export
merge_request
:
17025
author
:
type
:
added
doc/api/project_import_export.md
0 → 100644
View file @
17e5ef4b
# Project import API
[
Introduced
][
ce-41899
]
in GitLab 10.6
[
Project import/export
](
../user/project/settings/import_export.md
)
## Import a file
```
http
POST /projects/import
```
| Attribute | Type | Required | Description |
| --------- | -------------- | -------- | ---------------------------------------- |
|
`namespace`
| integer/string | no | The ID or path of the namespace that the project will be imported to. Defaults to the user's namespace |
|
`file`
| string | yes | The file to be uploaded |
|
`path`
| string | yes | Name and path for new project |
To upload a file from your filesystem, use the
`--form`
argument. This causes
cURL to post data using the header
`Content-Type: multipart/form-data`
.
The
`file=`
parameter must point to a file on your filesystem and be preceded
by
`@`
. For example:
```
console
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" -F "path=api-project" -F "file=@/path/to/file" https://gitlab.example.com/api/v4/projects/import
```
```
json
{
"id"
:
1
,
"description"
:
null
,
"name"
:
"api-project"
,
"name_with_namespace"
:
"Administrator / api-project"
,
"path"
:
"api-project"
,
"path_with_namespace"
:
"root/api-project"
,
"created_at"
:
"2018-02-13T09:05:58.023Z"
,
"import_status"
:
"scheduled"
}
```
## Import status
Get the status of export.
```
http
GET /projects/:id/import
```
| Attribute | Type | Required | Description |
| --------- | -------------- | -------- | ---------------------------------------- |
|
`id`
| integer/string | yes | The ID or
[
URL-encoded path of the project
](
README.md#namespaced-path-encoding
)
owned by the authenticated user |
```
console
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/1/import
```
Status can be one of
`none`
,
`started`
, or
`finished`
.
```
json
{
"id"
:
1
,
"description"
:
"Itaque perspiciatis minima aspernatur corporis consequatur."
,
"name"
:
"Gitlab Test"
,
"name_with_namespace"
:
"Gitlab Org / Gitlab Test"
,
"path"
:
"gitlab-test"
,
"path_with_namespace"
:
"gitlab-org/gitlab-test"
,
"created_at"
:
"2017-08-29T04:36:44.383Z"
,
"import_status"
:
"started"
}
```
[
ce-41899
]:
https://gitlab.com/gitlab-org/gitlab-ce/issues/41899
lib/api/project_import.rb
View file @
17e5ef4b
...
@@ -19,8 +19,8 @@ module API
...
@@ -19,8 +19,8 @@ module API
resource
:projects
,
requirements:
{
id:
%r{[^/]+}
}
do
resource
:projects
,
requirements:
{
id:
%r{[^/]+}
}
do
params
do
params
do
requires
:path
,
type:
String
,
desc:
'The new project path and name'
requires
:path
,
type:
String
,
desc:
'The new project path and name'
optional
:namespace
,
type:
String
,
desc:
'The ID or name of the namespace that the project will be imported into. Defaults to the user namespace.'
requires
:file
,
type:
File
,
desc:
'The project export file to be imported'
requires
:file
,
type:
File
,
desc:
'The project export file to be imported'
optional
:namespace
,
type:
String
,
desc:
'The ID or name of the namespace that the project will be imported into. Defaults to the user namespace.'
end
end
desc
'Get export status'
do
desc
'Get export status'
do
success
Entities
::
ProjectImportStatus
success
Entities
::
ProjectImportStatus
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment