Git Annotated Tags
TFS 2017 | TFS 2015 | TFS 2013
Note
Looking for REST APIS that support TFS 2018 or later versions? See the Azure DevOps REST API Reference.
api-version = 4.0-preview.2
Git annotated tags are tags with additional metadata including the person who created the tag and a comment.
If you haven't already, look at the information on getting started with these APIs.
Get annotated tag
GET https://{instance}/DefaultCollection/{project}/_apis/repos/git/repositories/{repository}/annotatedTags/{objectId}?api-version={version}
Parameter | Type | Notes |
---|---|---|
URL | ||
instance | string | TFS server name ({server:port}). |
project | string | Project ID or name. |
repository | string | ID or name of the repository. |
objectId | string | objectId of Tag to be fetched, returned only if it is annotated tag |
Query | ||
api-version | string | Version of the API to use. |
Sample request
GET https://mytfsserver/DefaultCollection/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/ca93c3a5-87bb-4b5b-a62f-1f971d677c79/annotatedTags/69080710948ac8ba63e44eca2daf0b30f38c428d
Sample response
{
"name": "refs/tags/v0.1-beta2",
"objectId": "69080710948ac8ba63e44eca2daf0b30f38c428d",
"taggedObject": {
"objectId": "c60be62ebf0e86b5aa01dbb98657b4b7e5905234",
"objectType": "commit"
},
"taggedBy": {
"name": "Norman Paulk",
"email": "Fabrikamfiber16@hotmail.com",
"date": "2017-06-22T04:28:23"
},
"message": "First beta release",
"url": "https://mytfsserver/DefaultCollection/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/ca93c3a5-87bb-4b5b-a62f-1f971d677c79/annotatedTags/69080710948ac8ba63e44eca2daf0b30f38c428d"
}
Create annotated tag
POST https://{instance}/DefaultCollection/{project}/_apis/repos/git/repositories/{repository}/annotatedTags?api-version={version}
Content-Type: application/json
{
"name": {string},
"taggedObject": {
objectId: {string}
},
"message": {string}
}
Parameter | Type | Notes |
---|---|---|
URL | ||
instance | string | TFS server name ({server:port}). |
project | string | Project ID or name. |
repository | string | ID or name of the repository. |
Query | ||
name | string | name of the tag to be created |
taggedObject.objectId | string | ID of the object the tag is pointing to |
message | string | tag description field |
api-version | string | Version of the API to use. |
Sample request
POST https://mytfsserver/DefaultCollection/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/ca93c3a5-87bb-4b5b-a62f-1f971d677c79/annotatedTags
{
"name": "v0.1-beta",
"taggedObject": {
"objectId": "c60be62ebf0e86b5aa01dbb98657b4b7e5905234"
},
"message": "First beta release"
}
Sample response
{
"name": "refs/tags/v0.1-beta",
"objectId": "bc57849b33949a15fa3cb889bb82d9ce21d5b6ee",
"taggedObject": {
"objectId": "c60be62ebf0e86b5aa01dbb98657b4b7e5905234",
"objectType": "commit"
},
"taggedBy": {
"name": "Norman Paulk",
"email": "Fabrikamfiber16@hotmail.com",
"date": "2017-06-22T05:09:23"
},
"message": "First beta release",
"url": "https://mytfsserver/DefaultCollection/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/ca93c3a5-87bb-4b5b-a62f-1f971d677c79/annotatedTags/bc57849b33949a15fa3cb889bb82d9ce21d5b6ee"
}