<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # Project import/export API > 原文:[https://docs.gitlab.com/ee/api/project_import_export.html](https://docs.gitlab.com/ee/api/project_import_export.html) * [Schedule an export](#schedule-an-export) * [Export status](#export-status) * [Export download](#export-download) * [Import a file](#import-a-file) * [Import status](#import-status) # Project import/export API[](#project-importexport-api "Permalink") 在 GitLab 10.6 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/41899) . 也可以看看: * [Project import/export documentation](../user/project/settings/import_export.html). * [Project import/export administration Rake tasks](../administration/raketasks/project_import_export.html). ## Schedule an export[](#schedule-an-export "Permalink") 開始新的導出. 端點還接受`upload`參數. 此參數是一個哈希,其中包含將導出的項目上載到 Web 服務器或任何 S3 兼容平臺的所有必要信息. 目前,我們僅支持將二進制數據文件上傳到最終服務器. 從 GitLab 10.7 開始,如果存在`upload`參數,則需要`upload[url]`參數. ``` POST /projects/:id/export ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 經過身份驗證的用戶擁有[的項目](README.html#namespaced-path-encoding)的 ID 或[URL 編碼路徑](README.html#namespaced-path-encoding) | | `description` | string | no | 覆蓋項目描述 | | `upload` | hash | no | Hash that contains the information to upload the exported project to a web server | | `upload[url]` | string | yes | 上傳項目的網址 | | `upload[http_method]` | string | no | 上傳輸出項目的 HTTP 方法. 僅允許使用`PUT`和`POST`方法. 默認為`PUT` | ``` curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "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" ``` ``` { "message": "202 Accepted" } ``` **注意:**上載請求將與`Content-Type: application/gzip`標頭一起發送. 確保您的預簽名 URL 將此內容作為簽名的一部分. ## Export status[](#export-status "Permalink") 獲取導出狀態. ``` GET /projects/:id/export ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 經過身份驗證的用戶擁有[的項目](README.html#namespaced-path-encoding)的 ID 或[URL 編碼路徑](README.html#namespaced-path-encoding) | ``` curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/export" ``` 狀態可以是以下之一: * `none` * `queued` * `started` * `finished` * `regeneration_in_progress` `queued`狀態表示已接收到導出請求,并且當前處于要處理的隊列中. `started`狀態表示導出過程已開始并且當前正在進行中. 它包括導出過程,對生成的文件執行的操作,例如發送電子郵件通知用戶下載文件,將導出的文件上傳到 Web 服務器等. `finished`狀態是在導出過程完成并且已通知用戶之后. `regeneration_in_progress`是可以下載導出文件且正在處理生成新導出文件的請求. `_links`僅在導出完成時存在. ``` { "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", "export_status": "finished", "_links": { "api_url": "https://gitlab.example.com/api/v4/projects/1/export/download", "web_url": "https://gitlab.example.com/gitlab-org/gitlab-test/download_export", } } ``` ## Export download[](#export-download "Permalink") 下載完成的導出. ``` GET /projects/:id/export/download ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 經過身份驗證的用戶擁有[的項目](README.html#namespaced-path-encoding)的 ID 或[URL 編碼路徑](README.html#namespaced-path-encoding) | ``` curl --header "PRIVATE-TOKEN: <your_access_token>" --remote-header-name --remote-name "https://gitlab.example.com/api/v4/projects/5/export/download" ``` ``` ls *export.tar.gz 2017-12-05_22-11-148_namespace_project_export.tar.gz ``` ## Import a file[](#import-a-file "Permalink") ``` POST /projects/import ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `namespace` | integer/string | no | 項目將導入到的名稱空間的 ID 或路徑. 默認為當前用戶的名稱空間 | | `name` | string | no | 要導入的項目的名稱. 如果未提供,則默認為項目的路徑 | | `file` | string | yes | 要上傳的文件 | | `path` | string | yes | 新項目的名稱和路徑 | | `overwrite` | boolean | no | 如果存在具有相同路徑的項目,則導入將覆蓋它. 默認為假 | | `override_params` | Hash | no | 支持在[Project API 中](projects.html)定義的所有字段 | 傳遞的覆蓋參數將優先于導出文件中定義的所有值. 要從文件系統上載文件,請使用`--form`參數. 這將導致 cURL 使用標題`Content-Type: multipart/form-data` . `file=`參數必須指向文件系統上的文件,并以`@`開頭. 例如: ``` curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form "path=api-project" --form "file=@/path/to/file" "https://gitlab.example.com/api/v4/projects/import" ``` cURL 不支持從遠程服務器發布文件. 從遠程服務器導入項目可以通過以下方式完成: ``` import requests from io import BytesIO s3_file = requests.get(presigned_url) url = 'https://gitlab.example.com/api/v4/projects/import' files = {'file': ('file.tar.gz', BytesIO(s3_file.content))} data = { "path": "example-project", "namespace": "example-group" } headers = { 'Private-Token': "<your_access_token>" } requests.post(url, headers=headers, data=data, files=files) ``` ``` { "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", "correlation_id": "mezklWso3Za", "failed_relations": [] } ``` **注意:**可以由管理員設置最大導入文件大小,默認為 50MB. 作為管理員,您可以修改最大導入文件大小. 為此,請在" [應用程序設置" API](settings.html#change-application-settings)或" [管理界面"中](../user/admin_area/settings/account_and_limit_settings.html)使用`max_import_size`選項. ## Import status[](#import-status "Permalink") 獲取導入狀態. ``` GET /projects/:id/import ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 經過身份驗證的用戶擁有[的項目](README.html#namespaced-path-encoding)的 ID 或[URL 編碼路徑](README.html#namespaced-path-encoding) | ``` curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/import" ``` 狀態可以是以下之一: * `none` * `scheduled` * `failed` * `started` * `finished` 如果狀態`failed` ,它將在`import_error`下包含導入錯誤消息. 如果狀態為`failed` , `started`或`finished`時, `failed_relations`陣列可能與關系的任何事件未能導入無論是由于不可恢復的錯誤或因重試次數已經用盡被填充(一個典型的例子是查詢超時.) **注意:** `failed_relations`的元素的`id`字段引用失敗記錄,而不是關系.**注意:** `failed_relations`數組當前限制為 100 個項目. ``` { "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", "correlation_id": "mezklWso3Za", "failed_relations": [ { "id": 42, "created_at": "2020-04-02T14:48:59.526Z", "exception_class": "RuntimeError", "exception_message": "A failure occurred", "source": "custom error context", "relation_name": "merge_requests" } ] } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看