Update an import

An import can be updated with credentials or a project choice by passing in the appropriate parameters in this API request. If no parameters are provided, the import will be restarted.

PATCH /repos/:owner/:repo/import

Parameters for updating authentication

Name Type Description
vcs_username string The username to provide to the originating repository.
vcs_password string The password to provide to the originating repository.

Example

{
  "vcs_username": "octocat",
  "vcs_password": "secret"
}

Response

Status: 200 OK
{
  "vcs": "subversion",
  "use_lfs": "undecided",
  "vcs_url": "http://svn.mycompany.com/svn/myproject",
  "status": "detecting",
  "url": "https://api.github.com/repos/octocat/socm/import",
  "html_url": "https://import.github.com/octocat/socm/import",
  "authors_url": "https://api.github.com/repos/octocat/socm/import/authors",
  "repository_url": "https://api.github.com/repos/octocat/socm"
}

Parameters for updating project choice

Some servers (e.g. TFS servers) can have several projects at a single URL. In those cases the import progress will have the status detection_found_multiple and the Import Progress response will include a project_choices array. You can select the project to import by providing one of the objects in the project_choices array in the update request.

The following example demonstrates the workflow for updating an import with "project1" as the project choice. Given a project_choices array like such:

[
  {
    "vcs": "tfvc",
    "tfvc_project": "project0",
    "human_name": "project0 (tfs)"
  },
  {
    "vcs": "tfvc",
    "tfvc_project": "project1",
    "human_name": "project1 (tfs)"
  },
  {
    "vcs": "tfvc",
    "tfvc_project": "project2",
    "human_name": "project2 (tfs)"
  },
  {
    "vcs": "tfvc",
    "tfvc_project": "project3",
    "human_name": "project3 (tfs)"
  }
]

Example

{
  "vcs": "tfvc",
  "tfvc_project": "project1",
  "human_name": "project1 (tfs)"
}

Response

Status: 200 OK
{
  "vcs": "tfvc",
  "use_lfs": "undecided",
  "vcs_url": "http://tfs.mycompany.com/tfs/myproject",
  "tfvc_project": "project1",
  "status": "importing",
  "status_text": "Importing...",
  "has_large_files": false,
  "large_files_size": 0,
  "large_files_count": 0,
  "authors_count": 0,
  "percent": 42,
  "commit_count": 1042,
  "url": "https://api.github.com/repos/octocat/socm/import",
  "html_url": "https://import.github.com/octocat/socm/import",
  "authors_url": "https://api.github.com/repos/octocat/socm/import/authors",
  "repository_url": "https://api.github.com/repos/octocat/socm"
}

Parameters for restarting import

To restart an import, no parameters are provided in the update request.

Response

Status: 200 OK
Location: https://api.github.com/repos/spraints/socm/import
{
  "vcs": "subversion",
  "use_lfs": "undecided",
  "vcs_url": "http://svn.mycompany.com/svn/myproject",
  "status": "importing",
  "status_text": "Importing...",
  "has_large_files": false,
  "large_files_size": 0,
  "large_files_count": 0,
  "authors_count": 0,
  "percent": 42,
  "commit_count": 1042,
  "url": "https://api.github.com/repos/octocat/socm/import",
  "html_url": "https://import.github.com/octocat/socm/import",
  "authors_url": "https://api.github.com/repos/octocat/socm/import/authors",
  "repository_url": "https://api.github.com/repos/octocat/socm"
}