Share via


Comments - Update

Update a comment on a work item.

PATCH https://dev.azure.com/{organization}/{project}/_apis/wit/workItems/{workItemId}/comments/{commentId}?api-version=7.0-preview.3

URI Parameters

Name In Required Type Description
commentId
path True

integer

int32
organization
path True

string

The name of the Azure DevOps organization.

project
path True

string

Project ID or project name

workItemId
path True

integer

int32

Id of a work item.

api-version
query True

string

Version of the API to use. This should be set to '7.0-preview.3' to use this version of the api.

Request Body

Name Type Description
text

string

The updated text of the comment.

Responses

Name Type Description
200 OK

Comment

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.work_write Grants the ability to read, create, and update work items and queries, update board metadata, read area and iterations paths other work item tracking related metadata, execute queries, and to receive notifications about work item events via service hooks.

Examples

Update a comment

Sample request

PATCH https://dev.azure.com/fabrikam/Fabrikam-Fiber-Git/_apis/wit/workItems/299/comments/50?api-version=7.0-preview.3

{
  "text": "Moving to the right area path - Fabrikam-Git"
}

Sample response

{
  "workItemId": 299,
  "commentId": 50,
  "version": 2,
  "text": "Moving to the right area path - Fabrikam-Git",
  "createdBy": {
    "displayName": "Jamal Hartnett",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
      }
    },
    "id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "uniqueName": "fabrikamfiber4@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
  },
  "createdDate": "2019-01-16T03:03:28.97Z",
  "modifiedBy": {
    "displayName": "Jamal Hartnett",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
      }
    },
    "id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "uniqueName": "fabrikamfiber4@hotmail.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
    "descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
  },
  "modifiedDate": "2019-01-22T02:32:10.67Z",
  "isDeleted": false,
  "url": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/workItems/299/comments/50"
}

Definitions

Name Description
Comment

Comment on a Work Item.

CommentMention
CommentReaction

Contains information about work item comment reaction for a particular reaction type.

CommentReactionType

Type of the reaction.

CommentUpdate

Represents a request to update a work item comment.

IdentityRef
ReferenceLinks

The class to represent a collection of REST reference links.

Comment

Comment on a Work Item.

Name Type Description
_links

ReferenceLinks

Link references to related REST resources.

createdBy

IdentityRef

IdentityRef of the creator of the comment.

createdDate

string

The creation date of the comment.

createdOnBehalfDate

string

Effective Date/time value for adding the comment. Can be optionally different from CreatedDate.

createdOnBehalfOf

IdentityRef

Identity on whose behalf this comment has been added. Can be optionally different from CreatedBy.

id

integer

The id assigned to the comment.

isDeleted

boolean

Indicates if the comment has been deleted.

mentions

CommentMention[]

The mentions of the comment.

modifiedBy

IdentityRef

IdentityRef of the user who last modified the comment.

modifiedDate

string

The last modification date of the comment.

reactions

CommentReaction[]

The reactions of the comment.

text

string

The text of the comment.

url

string

version

integer

The current version of the comment.

workItemId

integer

The id of the work item this comment belongs to.

CommentMention

Name Type Description
_links

ReferenceLinks

Link references to related REST resources.

artifactId

string

The artifact portion of the parsed text. (i.e. the work item's id)

artifactType

string

The type the parser assigned to the mention. (i.e. person, work item, etc)

commentId

integer

The comment id of the mention.

targetId

string

The resolved target of the mention. An example of this could be a user's tfid

url

string

CommentReaction

Contains information about work item comment reaction for a particular reaction type.

Name Type Description
_links

ReferenceLinks

Link references to related REST resources.

commentId

integer

The id of the comment this reaction belongs to.

count

integer

Total number of reactions for the CommentReactionType.

isCurrentUserEngaged

boolean

Flag to indicate if the current user has engaged on this particular EngagementType (e.g. if they liked the associated comment).

type

CommentReactionType

Type of the reaction.

url

string

CommentReactionType

Type of the reaction.

Name Type Description
confused

string

dislike

string

heart

string

hooray

string

like

string

smile

string

CommentUpdate

Represents a request to update a work item comment.

Name Type Description
text

string

The updated text of the comment.

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

Deprecated - Can be retrieved by querying the Graph user referenced in the "self" entry of the IdentityRef "_links" dictionary

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

Deprecated - Available in the "avatar" entry of the IdentityRef "_links" dictionary

inactive

boolean

Deprecated - Can be retrieved by querying the Graph membership state referenced in the "membershipState" entry of the GraphUser "_links" dictionary

isAadIdentity

boolean

Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsAadUserType/Descriptor.IsAadGroupType)

isContainer

boolean

Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsGroupType)

isDeletedInOrigin

boolean

profileUrl

string

Deprecated - not in use in most preexisting implementations of ToIdentityRef

uniqueName

string

Deprecated - use Domain+PrincipalName instead

url

string

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

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.