diff options
author | Marcia Ramos <virtua.creative@gmail.com> | 2018-07-12 13:06:14 +0300 |
---|---|---|
committer | Marcia Ramos <virtua.creative@gmail.com> | 2018-07-12 13:06:14 +0300 |
commit | c08ba900100d14d9e1ccf67d2d99e89887e580f9 (patch) | |
tree | 6e18a22154a031297c7a7b0eeb04ba9b5ecaac76 /doc | |
parent | 638fe750b49cbedad5a66fc63967a837452b56b8 (diff) | |
parent | 491afd39a0c5aae1d8626cb25fd5d05be75fa416 (diff) |
Merge branch 'project_import_export_update' into 'master'
Update project_import_export.md to include example remote import script and additional curl command
See merge request gitlab-org/gitlab-ce!20529
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/project_import_export.md | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/doc/api/project_import_export.md b/doc/api/project_import_export.md index 085437c801a..83e405141f1 100644 --- a/doc/api/project_import_export.md +++ b/doc/api/project_import_export.md @@ -28,8 +28,11 @@ POST /projects/:id/export | `upload[url]` | string | yes | The URL to upload the project | | `upload[http_method]` | string | no | The HTTP method to upload the exported project. Only `PUT` and `POST` methods allowed. Default is `PUT` | + ```console -curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/1/export --data "description=FooBar&upload[http_method]=PUT&upload[url]=https://example-bucket.s3.eu-west-3.amazonaws.com/backup?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIMBJHN2O62W8IELQ%2F20180312%2Feu-west-3%2Fs3%2Faws4_request&X-Amz-Date=20180312T110328Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=8413facb20ff33a49a147a0b4abcff4c8487cc33ee1f7e450c46e8f695569dbd" +curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/1/export \ + --data "upload[http_method]=PUT" \ + --data-urlencode "upload[url]=https://example-bucket.s3.eu-west-3.amazonaws.com/backup?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIMBJHN2O62W8IELQ%2F20180312%2Feu-west-3%2Fs3%2Faws4_request&X-Amz-Date=20180312T110328Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=8413facb20ff33a49a147a0b4abcff4c8487cc33ee1f7e450c46e8f695569dbd" ``` ```json @@ -125,6 +128,29 @@ by `@`. For example: curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" --form "path=api-project" --form "file=@/path/to/file" https://gitlab.example.com/api/v4/projects/import ``` +cURL doesn't support posting a file from a remote server. Importing a project from a remote server can be accomplished through something like the following: + +```python +import requests +import urllib +import json +import sys + +s3_file = urllib.urlopen(presigned_url) + +url = 'https://gitlab.example.com/api/v4/projects/import' +files = {'file': s3_file} +data = { + "path": "example-project", + "namespace": "example-group" +} +headers = { + 'Private-Token': "9koXpg98eAheJpvBs5tK" +} + +requests.post(url, headers=headers, data=data, files=files) +``` + ```json { "id": 1, |