Import Requests - Create
Create an import request.
POST https://{instance}/{collection}/{project}/_apis/git/repositories/{repositoryId}/importRequests?api-version=5.0-preview.1
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
collection
|
path | True |
string |
The name of the Azure DevOps collection. |
instance
|
path | True |
string |
Azure DevOps server name ({server:port}) |
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 '5.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 |
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://{instance}/fabrikam/Test/_apis/git/repositories/0eb02d2e-fff9-4990-bd45-2f7503f5aae5/importRequests?api-version=5.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://fabrikam:8080/tfs/_apis/git/repositories/0eb02d2e-fff9-4990-bd45-2f7503f5aae5",
"project": {
"id": "5745879a-8531-41c3-9ed3-ae7fc07309ff",
"name": "Test",
"url": "https://fabrikam:8080/tfs/_apis/projects/5745879a-8531-41c3-9ed3-ae7fc07309ff",
"state": "wellFormed",
"revision": 7
},
"remoteUrl": "https://fabrikam:8080/tfs/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://fabrikam:8080/tfs/Test/_apis/git/repositories/0eb02d2e-fff9-4990-bd45-2f7503f5aae5/importRequests/2"
},
"repository": {
"href": "https://fabrikam:8080/tfs/_apis/git/repositories/0eb02d2e-fff9-4990-bd45-2f7503f5aae5"
}
},
"url": "https://fabrikam:8080/tfs/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
Name | Type | Description |
---|---|---|
abandoned |
string |
The operation has been abandoned. |
completed |
string |
The operation has completed. |
failed |
string |
The operation has failed. Check for an error message. |
inProgress |
string |
The operation is currently in progress. |
queued |
string |
The operation is waiting in a queue and has not yet started. |
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 |
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 |
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 |
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 |
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 |
|
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 |
Compressed size (bytes) of the repository. |
sshUrl |
string |
|
url |
string |
|
validRemoteUrls |
string[] |
GitRepositoryRef
Name | Type | Description |
---|---|---|
collection |
Team Project Collection where this Fork resides |
|
id |
string |
|
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.
Name | Type | Description |
---|---|---|
all |
string |
All projects regardless of state. |
createPending |
string |
Project has been queued for creation, but the process has not yet started. |
deleted |
string |
Project has been deleted. |
deleting |
string |
Project is in the process of being deleted. |
new |
string |
Project is in the process of being created. |
unchanged |
string |
Project has not been changed. |
wellFormed |
string |
Project is completely created and ready to use. |
ProjectVisibility
Project visibility.
Name | Type | Description |
---|---|---|
private |
string |
|
public |
string |
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 |
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 |
Project identifier. |
name |
string |
Project name. |
revision |
integer |
Project revision. |
state |
Project state. |
|
url |
string |
Url to the full version of the object. |
visibility |
Project visibility. |