Changesets - Create

Create a new changeset.

Accepts TfvcChangeset as JSON body

POST https://dev.azure.com/{organization}/{project}/_apis/tfvc/changesets?api-version=5.0

URI Parameters

Name In Required Type Description
organization
path True

string

The name of the Azure DevOps organization.

project
path

string

Project ID or project name

api-version
query True

string

Version of the API to use. This should be set to '5.0' to use this version of the api.

Request Body

Name Type Description
_links

ReferenceLinks

A collection of REST reference links.

accountId

string

Changeset Account Id also known as Organization Id.

author

IdentityRef

Alias or display name of user.

changes

TfvcChange[]

List of associated changes.

changesetId

integer

Changeset Id.

checkedInBy

IdentityRef

Alias or display name of user.

checkinNotes

CheckinNote[]

List of Checkin Notes for the changeset.

collectionId

string

Changeset collection Id.

comment

string

Comment for the changeset.

commentTruncated

boolean

Was the Comment result truncated?

createdDate

string

Creation date of the changeset.

hasMoreChanges

boolean

True if more changes are available.

policyOverride

TfvcPolicyOverrideInfo

Policy Override for the changeset.

teamProjectIds

string[]

Team Project Ids for the changeset.

url

string

URL to retrieve the item.

workItems

AssociatedWorkItem[]

List of work items associated with the changeset.

Responses

Name Type Description
200 OK

TfvcChangesetRef

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_write 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 pull requests and code reviews and to receive notifications about version control events via service hooks.

Examples

POST a file edit changeset.
POST an add binary file changeset.
POST an add multiple file changeset.
POST an add text file changeset.

POST a file edit changeset.

Sample Request

POST https://dev.azure.com/{organization}/_apis/tfvc/changesets?api-version=5.0

{
  "changes": [
    {
      "item": {
        "version": 7,
        "path": "$/Project01/file-to-edit-2019-04-09-23-21-13-31.txt",
        "contentMetadata": {
          "encoding": 1200,
          "contentType": "text/plain"
        }
      },
      "changeType": "edit",
      "newContent": {
        "content": "Initial contents as of 4/9/2019 11:21:13 PM\nEdited contents"
      }
    }
  ],
  "comment": "(sample) Editing the file via API"
}

Sample Response

{
  "checkinNotes": [],
  "policyOverride": {
    "policyFailures": []
  },
  "changesetId": 8,
  "url": "https://codedev.ms/fabrikam/_apis/tfvc/changesets/8",
  "author": {
    "displayName": "Normal Paulk",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d6245f20-2af8-44f4-9451-8107cb2767db",
    "id": "d6245f20-2af8-44f4-9451-8107cb2767db",
    "uniqueName": "fabrikamfiber16@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d6245f20-2af8-44f4-9451-8107cb2767db"
  },
  "checkedInBy": {
    "displayName": "Normal Paulk",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d6245f20-2af8-44f4-9451-8107cb2767db",
    "id": "d6245f20-2af8-44f4-9451-8107cb2767db",
    "uniqueName": "fabrikamfiber16@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d6245f20-2af8-44f4-9451-8107cb2767db"
  },
  "createdDate": "2019-04-09T23:21:27.197Z",
  "comment": "(sample) Editing the file via API"
}

POST an add binary file changeset.

Sample Request

POST https://dev.azure.com/{organization}/_apis/tfvc/changesets?api-version=5.0

{
  "changes": [
    {
      "item": {
        "path": "$/Project01/testzip.zip",
        "contentMetadata": {
          "encoding": -1
        }
      },
      "changeType": "add",
      "newContent": {
        "content": "UEsDBAoAAAAAAPxQJk8Mfn/YBAAAAAQAAAAIAAAAdGVzdC50eHR0ZXN0UEsBAj8ACgAAAAAA/FAmTwx+f9gEAAAABAAAAAgAJAAAAAAAAAAgAAAAAAAAAHRlc3QudHh0CgAgAAAAAAABABgAHDH5ebxk1QEcMfl5vGTVAe/BonO8ZNUBUEsFBgAAAAABAAEAWgAAACoAAAAAAA==",
        "contentType": "base64Encoded"
      }
    }
  ],
  "comment": "(sample) Adding a new changeset via API"
}

Sample Response

{
  "checkinNotes": [],
  "policyOverride": {
    "policyFailures": []
  },
  "changesetId": 5,
  "url": "https://codedev.ms/fabrikam/_apis/tfvc/changesets/5",
  "author": {
    "displayName": "Normal Paulk",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d6245f20-2af8-44f4-9451-8107cb2767db",
    "id": "d6245f20-2af8-44f4-9451-8107cb2767db",
    "uniqueName": "fabrikamfiber16@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d6245f20-2af8-44f4-9451-8107cb2767db"
  },
  "checkedInBy": {
    "displayName": "Normal Paulk",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d6245f20-2af8-44f4-9451-8107cb2767db",
    "id": "d6245f20-2af8-44f4-9451-8107cb2767db",
    "uniqueName": "fabrikamfiber16@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d6245f20-2af8-44f4-9451-8107cb2767db"
  },
  "createdDate": "2019-04-09T23:20:51.94Z",
  "comment": "(sample) Adding a new changeset via API"
}

POST an add multiple file changeset.

Sample Request

POST https://dev.azure.com/{organization}/_apis/tfvc/changesets?api-version=5.0

{
  "changes": [
    {
      "item": {
        "path": "$/Project01/example-file-2019-04-09-23-21-00-40.1.txt",
        "contentMetadata": {
          "encoding": 1200
        }
      },
      "changeType": "add",
      "newContent": {
        "content": "File 1 contents as of 4/9/2019 11:21:00 PM",
        "contentType": "rawText"
      }
    },
    {
      "item": {
        "path": "$/Project01/example-file-2019-04-09-23-21-00-40.2.txt",
        "contentMetadata": {
          "encoding": 1200
        }
      },
      "changeType": "add",
      "newContent": {
        "content": "File 2 contents as of 4/9/2019 11:21:00 PM",
        "contentType": "rawText"
      }
    }
  ],
  "comment": "(sample) Adding multiple files via API"
}

Sample Response

{
  "checkinNotes": [],
  "policyOverride": {
    "policyFailures": []
  },
  "changesetId": 6,
  "url": "https://codedev.ms/fabrikam/_apis/tfvc/changesets/6",
  "author": {
    "displayName": "Normal Paulk",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d6245f20-2af8-44f4-9451-8107cb2767db",
    "id": "d6245f20-2af8-44f4-9451-8107cb2767db",
    "uniqueName": "fabrikamfiber16@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d6245f20-2af8-44f4-9451-8107cb2767db"
  },
  "checkedInBy": {
    "displayName": "Normal Paulk",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d6245f20-2af8-44f4-9451-8107cb2767db",
    "id": "d6245f20-2af8-44f4-9451-8107cb2767db",
    "uniqueName": "fabrikamfiber16@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d6245f20-2af8-44f4-9451-8107cb2767db"
  },
  "createdDate": "2019-04-09T23:21:11.55Z",
  "comment": "(sample) Adding multiple files via API"
}

POST an add text file changeset.

Sample Request

POST https://dev.azure.com/{organization}/_apis/tfvc/changesets?api-version=5.0

{
  "changes": [
    {
      "item": {
        "path": "$/Project01/example-file-2019-04-09-23-20-28-70.txt",
        "contentMetadata": {
          "encoding": 1200
        }
      },
      "changeType": "add",
      "newContent": {
        "content": "File contents as of 4/9/2019 11:20:28 PM",
        "contentType": "rawText"
      }
    }
  ],
  "comment": "(sample) Adding a new changeset via API"
}

Sample Response

{
  "checkinNotes": [],
  "policyOverride": {
    "policyFailures": []
  },
  "changesetId": 5,
  "url": "https://codedev.ms/fabrikam/_apis/tfvc/changesets/5",
  "author": {
    "displayName": "Normal Paulk",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d6245f20-2af8-44f4-9451-8107cb2767db",
    "id": "d6245f20-2af8-44f4-9451-8107cb2767db",
    "uniqueName": "fabrikamfiber16@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d6245f20-2af8-44f4-9451-8107cb2767db"
  },
  "checkedInBy": {
    "displayName": "Normal Paulk",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d6245f20-2af8-44f4-9451-8107cb2767db",
    "id": "d6245f20-2af8-44f4-9451-8107cb2767db",
    "uniqueName": "fabrikamfiber16@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d6245f20-2af8-44f4-9451-8107cb2767db"
  },
  "createdDate": "2019-04-09T23:20:51.94Z",
  "comment": "(sample) Adding a new changeset via API"
}

Definitions

Name Description
AssociatedWorkItem
CheckinNote
IdentityRef
ItemContent
ItemContentType
ReferenceLinks

The class to represent a collection of REST reference links.

TfvcChange

A change.

TfvcChangeset

A collection of changes.

TfvcChangesetRef

Metadata for a changeset.

TfvcMergeSource
TfvcPolicyFailureInfo

Policy failure information.

TfvcPolicyOverrideInfo

Information on the policy override.

VersionControlChangeType

The type of change that was made to the item.

AssociatedWorkItem

Name Type Description
assignedTo

string

id

integer

Id of associated the work item.

state

string

title

string

url

string

REST Url of the work item.

webUrl

string

workItemType

string

CheckinNote

Name Type Description
name

string

value

string

IdentityRef

Name Type Description
_links

ReferenceLinks

This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject.

descriptor

string

The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations.

directoryAlias

string

displayName

string

This is the non-unique display name of the graph subject. To change this field, you must alter its value in the source provider.

id

string

imageUrl

string

inactive

boolean

isAadIdentity

boolean

isContainer

boolean

isDeletedInOrigin

boolean

profileUrl

string

uniqueName

string

url

string

This url is the full route to the source resource of this graph subject.

ItemContent

Name Type Description
content

string

contentType

ItemContentType

ItemContentType

Name Type Description
base64Encoded

string

rawText

string

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.

TfvcChange

A change.

Name Type Description
changeType

VersionControlChangeType

The type of change that was made to the item.

item

string

Current version.

mergeSources

TfvcMergeSource[]

List of merge sources in case of rename or branch creation.

newContent

ItemContent

Content of the item after the change.

pendingVersion

integer

Version at which a (shelved) change was pended against

sourceServerItem

string

Path of the item on the server.

url

string

URL to retrieve the item.

TfvcChangeset

A collection of changes.

Name Type Description
_links

ReferenceLinks

A collection of REST reference links.

accountId

string

Changeset Account Id also known as Organization Id.

author

IdentityRef

Alias or display name of user.

changes

TfvcChange[]

List of associated changes.

changesetId

integer

Changeset Id.

checkedInBy

IdentityRef

Alias or display name of user.

checkinNotes

CheckinNote[]

List of Checkin Notes for the changeset.

collectionId

string

Changeset collection Id.

comment

string

Comment for the changeset.

commentTruncated

boolean

Was the Comment result truncated?

createdDate

string

Creation date of the changeset.

hasMoreChanges

boolean

True if more changes are available.

policyOverride

TfvcPolicyOverrideInfo

Policy Override for the changeset.

teamProjectIds

string[]

Team Project Ids for the changeset.

url

string

URL to retrieve the item.

workItems

AssociatedWorkItem[]

List of work items associated with the changeset.

TfvcChangesetRef

Metadata for a changeset.

Name Type Description
_links

ReferenceLinks

A collection of REST reference links.

author

IdentityRef

Alias or display name of user.

changesetId

integer

Changeset Id.

checkedInBy

IdentityRef

Alias or display name of user.

comment

string

Comment for the changeset.

commentTruncated

boolean

Was the Comment result truncated?

createdDate

string

Creation date of the changeset.

url

string

URL to retrieve the item.

TfvcMergeSource

Name Type Description
isRename

boolean

Indicates if this a rename source. If false, it is a merge source.

serverItem

string

The server item of the merge source.

versionFrom

integer

Start of the version range.

versionTo

integer

End of the version range.

TfvcPolicyFailureInfo

Policy failure information.

Name Type Description
message

string

Policy failure message.

policyName

string

Name of the policy that failed.

TfvcPolicyOverrideInfo

Information on the policy override.

Name Type Description
comment

string

Overidden policy comment.

policyFailures

TfvcPolicyFailureInfo[]

Information on the failed policy that was overridden.

VersionControlChangeType

The type of change that was made to the item.

Name Type Description
add

string

all

string

branch

string

delete

string

edit

string

encoding

string

lock

string

merge

string

none

string

property

string

rename

string

rollback

string

sourceRename

string

targetRename

string

undelete

string