Import Requests - Create
Create an import request.
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/importRequests?api-version=6.0-preview.1
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
organization
|
path | True |
string |
The name of the Azure DevOps organization. |
|
project
|
path | True |
string |
Project ID or project name |
|
repository
|
path | True |
string |
The name or ID of the repository. |
|
api-version
|
query | True |
string |
Version of the API to use. This should be set to '6.0-preview.1' to use this version of the api. |
Request Body
| Name | Type | Description |
|---|---|---|
| _links |
Links to related resources. |
|
| detailedStatus |
Detailed status of the import, including the current step and an error message, if applicable. |
|
| importRequestId |
integer (int32) |
The unique identifier for this import request. |
| parameters |
Parameters for creating the import request. |
|
| repository |
The target repository for this import. |
|
| status |
Current status of the import. |
|
| url |
string |
A link back to this import request resource. |
Responses
| Name | Type | Description |
|---|---|---|
| 200 OK |
successful operation |
Security
oauth2
Type:
oauth2
Flow:
accessCode
Authorization URL:
https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token URL:
https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
Scopes
| Name | Description |
|---|---|
| vso.code_manage | Grants the ability to read, update, and delete source code, access metadata about commits, changesets, branches, and other version control artifacts. Also grants the ability to create and manage code repositories, create and manage pull requests and code reviews, and to receive notifications about version control events via service hooks. |
Examples
Sample request
POST https://dev.azure.com/fabrikam/Test/_apis/git/repositories/0eb02d2e-fff9-4990-bd45-2f7503f5aae5/importRequests?api-version=6.0-preview.1
{
"parameters": {
"gitSource": {
"url": "https://github.com/Microsoft/vsts-agent.git"
}
}
}
Sample response
{
"importRequestId": 2,
"repository": {
"id": "0eb02d2e-fff9-4990-bd45-2f7503f5aae5",
"name": "EmptyGitRepo",
"url": "https://dev.azure.com/fabrikam/_apis/git/repositories/0eb02d2e-fff9-4990-bd45-2f7503f5aae5",
"project": {
"id": "5745879a-8531-41c3-9ed3-ae7fc07309ff",
"name": "Test",
"url": "https://dev.azure.com/fabrikam/_apis/projects/5745879a-8531-41c3-9ed3-ae7fc07309ff",
"state": "wellFormed",
"revision": 7
},
"remoteUrl": "https://dev.azure.com/fabrikam/Test/_git/EmptyGitRepo"
},
"parameters": {
"gitSource": {
"url": "https://github.com/Microsoft/vsts-agent.git"
}
},
"status": "queued",
"detailedStatus": {
"currentStep": 1,
"allSteps": [
"Processing request",
"Analyzing repository objects",
"Storing objects",
"Storing index file",
"Updating references",
"Import completed successfully"
]
},
"_links": {
"self": {
"href": "https://dev.azure.com/fabrikam/Test/_apis/git/repositories/0eb02d2e-fff9-4990-bd45-2f7503f5aae5/importRequests/2"
},
"repository": {
"href": "https://dev.azure.com/fabrikam/_apis/git/repositories/0eb02d2e-fff9-4990-bd45-2f7503f5aae5"
}
},
"url": "https://dev.azure.com/fabrikam/Test/_apis/git/repositories/0eb02d2e-fff9-4990-bd45-2f7503f5aae5/importRequests/2"
}
Definitions
| Name | Description |
|---|---|
|
Git |
|
|
Git |
Parameter for creating a git import request when source is Git version control |
|
Git |
A request to import data from a remote source control system. |
|
Git |
Parameters for creating an import request |
|
Git |
Additional status information about an import request. |
|
Git |
Parameter for creating a git import request when source is tfvc version control |
|
Git |
|
|
Git |
|
|
Project |
Project state. |
|
Project |
Project visibility. |
|
Reference |
The class to represent a collection of REST reference links. |
|
Team |
Reference object for a TeamProjectCollection. |
|
Team |
Represents a shallow reference to a TeamProject. |
GitAsyncOperationStatus
| Value | Description |
|---|---|
| queued |
The operation is waiting in a queue and has not yet started. |
| inProgress |
The operation is currently in progress. |
| completed |
The operation has completed. |
| failed |
The operation has failed. Check for an error message. |
| abandoned |
The operation has been abandoned. |
GitImportGitSource
Parameter for creating a git import request when source is Git version control
| Name | Type | Description |
|---|---|---|
| overwrite |
boolean |
Tells if this is a sync request or not |
| url |
string |
Url for the source repo |
GitImportRequest
A request to import data from a remote source control system.
| Name | Type | Description |
|---|---|---|
| _links |
Links to related resources. |
|
| detailedStatus |
Detailed status of the import, including the current step and an error message, if applicable. |
|
| importRequestId |
integer (int32) |
The unique identifier for this import request. |
| parameters |
Parameters for creating the import request. |
|
| repository |
The target repository for this import. |
|
| status |
Current status of the import. |
|
| url |
string |
A link back to this import request resource. |
GitImportRequestParameters
Parameters for creating an import request
| Name | Type | Description |
|---|---|---|
| deleteServiceEndpointAfterImportIsDone |
boolean |
Option to delete service endpoint when import is done |
| gitSource |
Source for importing git repository |
|
| serviceEndpointId |
string (uuid) |
Service Endpoint for connection to external endpoint |
| tfvcSource |
Source for importing tfvc repository |
GitImportStatusDetail
Additional status information about an import request.
| Name | Type | Description |
|---|---|---|
| allSteps |
string[] |
All valid steps for the import process |
| currentStep |
integer (int32) |
Index into AllSteps for the current step |
| errorMessage |
string |
Error message if the operation failed. |
GitImportTfvcSource
Parameter for creating a git import request when source is tfvc version control
| Name | Type | Description |
|---|---|---|
| importHistory |
boolean |
Set true to import History, false otherwise |
| importHistoryDurationInDays |
integer (int32) |
Get history for last n days (max allowed value is 180 days) |
| path |
string |
Path which we want to import (this can be copied from Path Control in Explorer) |
GitRepository
| Name | Type | Description |
|---|---|---|
| _links |
The class to represent a collection of REST reference links. |
|
| defaultBranch |
string |
|
| id |
string (uuid) |
|
| isFork |
boolean |
True if the repository was created as a fork |
| name |
string |
|
| parentRepository | ||
| project |
Represents a shallow reference to a TeamProject. |
|
| remoteUrl |
string |
|
| size |
integer (int64) |
Compressed size (bytes) of the repository. |
| sshUrl |
string |
|
| url |
string |
|
| validRemoteUrls |
string[] |
|
| webUrl |
string |
GitRepositoryRef
| Name | Type | Description |
|---|---|---|
| collection |
Team Project Collection where this Fork resides |
|
| id |
string (uuid) |
|
| isFork |
boolean |
True if the repository was created as a fork |
| name |
string |
|
| project |
Represents a shallow reference to a TeamProject. |
|
| remoteUrl |
string |
|
| sshUrl |
string |
|
| url |
string |
ProjectState
Project state.
| Value | Description |
|---|---|
| deleting |
Project is in the process of being deleted. |
| new |
Project is in the process of being created. |
| wellFormed |
Project is completely created and ready to use. |
| createPending |
Project has been queued for creation, but the process has not yet started. |
| all |
All projects regardless of state. |
| unchanged |
Project has not been changed. |
| deleted |
Project has been deleted. |
ProjectVisibility
Project visibility.
| Value | Description |
|---|---|
| private |
The project is only visible to users with explicit access. |
| public |
The project is visible to all. |
ReferenceLinks
The class to represent a collection of REST reference links.
| Name | Type | Description |
|---|---|---|
| links |
object |
The readonly view of the links. Because Reference links are readonly, we only want to expose them as read only. |
TeamProjectCollectionReference
Reference object for a TeamProjectCollection.
| Name | Type | Description |
|---|---|---|
| id |
string (uuid) |
Collection Id. |
| name |
string |
Collection Name. |
| url |
string |
Collection REST Url. |
TeamProjectReference
Represents a shallow reference to a TeamProject.
| Name | Type | Description |
|---|---|---|
| abbreviation |
string |
Project abbreviation. |
| defaultTeamImageUrl |
string |
Url to default team identity image. |
| description |
string |
The project's description (if any). |
| id |
string (uuid) |
Project identifier. |
| lastUpdateTime |
string (date-time) |
Project last update time. |
| name |
string |
Project name. |
| revision |
integer (int64) |
Project revision. |
| state |
Project state. |
|
| url |
string |
Url to the full version of the object. |
| visibility |
Project visibility. |