Recyclebin - Restore Work Item

Restores the deleted work item from Recycle Bin.

PATCH https://dev.azure.com/{organization}/{project}/_apis/wit/recyclebin/{id}?api-version=7.1

URI Parameters

Name In Required Type Description
id
path True

integer

int32

ID of the work item to be restored

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 '7.1' to use this version of the api.

Request Body

Name Type Description
isDeleted

boolean

Sets a value indicating whether this work item is deleted.

Responses

Name Type Description
200 OK

WorkItemDelete

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

Restore a work item

Sample request

PATCH https://dev.azure.com/{organization}/_apis/wit/recyclebin/403?api-version=7.1

{
  "isDeleted": false
}

Sample response

{
  "id": 403,
  "code": 200,
  "type": "Bug",
  "name": "Test bug to be deleted and then restored",
  "project": "Fabrikam-Fiber-Git",
  "deletedDate": "1/11/2017 11:18:16 PM",
  "deletedBy": "Jamal Hartnett <fabrikamfiber4@hotmail.com>",
  "url": "https://dev.azure.com/fabrikam/_apis/wit/workItems/403",
  "resource": {
    "id": 403,
    "rev": 3,
    "fields": {
      "System.AreaPath": "Fabrikam-Fiber-Git",
      "System.TeamProject": "Fabrikam-Fiber-Git",
      "System.IterationPath": "Fabrikam-Fiber-Git\\Release 1\\Sprint 2",
      "System.WorkItemType": "Bug",
      "System.State": "New",
      "System.Reason": "New defect reported",
      "System.CreatedDate": "2017-01-11T23:14:16.37Z",
      "System.CreatedBy": "Jamal Hartnett <fabrikamfiber4@hotmail.com>",
      "System.ChangedDate": "2017-01-11T23:18:16.03Z",
      "System.ChangedBy": "Jamal Hartnett <fabrikamfiber4@hotmail.com>",
      "System.Title": "Test bug to be deleted and then restored",
      "System.BoardColumn": "New",
      "System.BoardColumnDone": false,
      "Microsoft.VSTS.Common.StateChangeDate": "2017-01-11T23:14:16.37Z",
      "Microsoft.VSTS.Common.Priority": 2,
      "Microsoft.VSTS.Common.Severity": "3 - Medium",
      "WEF_6CB513B6E70E43499D9FC94E5BBFB784_Kanban.Column": "New",
      "WEF_6CB513B6E70E43499D9FC94E5BBFB784_Kanban.Column.Done": false,
      "Microsoft.VSTS.Common.ValueArea": "Business"
    },
    "_links": {
      "self": {
        "href": "https://dev.azure.com/fabrikam/_apis/wit/workItems/403"
      },
      "workItemUpdates": {
        "href": "https://dev.azure.com/fabrikam/_apis/wit/workItems/403/updates"
      },
      "workItemRevisions": {
        "href": "https://dev.azure.com/fabrikam/_apis/wit/workItems/403/revisions"
      },
      "workItemHistory": {
        "href": "https://dev.azure.com/fabrikam/_apis/wit/workItems/403/history"
      },
      "html": {
        "href": "https://dev.azure.com/fabrikam/web/wi.aspx?pcguid=d81542e4-cdfa-4333-b082-1ae2d6c3ad16&id=403"
      },
      "workItemType": {
        "href": "https://dev.azure.com/fabrikam/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/workItemTypes/Bug"
      },
      "fields": {
        "href": "https://dev.azure.com/fabrikam/_apis/wit/fields"
      }
    },
    "url": "https://dev.azure.com/fabrikam/_apis/wit/workItems/403"
  }
}

Definitions

Name Description
ReferenceLinks

The class to represent a collection of REST reference links.

WorkItem

Describes a work item.

WorkItemCommentVersionRef

Represents the reference to a specific version of a comment on a Work Item.

WorkItemDelete

Full deleted work item object. Includes the work item itself.

WorkItemDeleteUpdate

Describes an update request for a deleted work item.

WorkItemRelation

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.

WorkItem

Describes a work item.

Name Type Description
_links

ReferenceLinks

Link references to related REST resources.

commentVersionRef

WorkItemCommentVersionRef

Reference to a specific version of the comment added/edited/deleted in this revision.

fields

object

Map of field and values for the work item.

id

integer

The work item ID.

relations

WorkItemRelation[]

Relations of the work item.

rev

integer

Revision number of the work item.

url

string

WorkItemCommentVersionRef

Represents the reference to a specific version of a comment on a Work Item.

Name Type Description
commentId

integer

The id assigned to the comment.

createdInRevision

integer

[Internal] The work item revision where this comment was originally added.

isDeleted

boolean

[Internal] Specifies whether comment was deleted.

text

string

[Internal] The text of the comment.

url

string

version

integer

The version number.

WorkItemDelete

Full deleted work item object. Includes the work item itself.

Name Type Description
code

integer

The HTTP status code for work item operation in a batch request.

deletedBy

string

The user who deleted the work item type.

deletedDate

string

The work item deletion date.

id

integer

Work item ID.

message

string

The exception message for work item operation in a batch request.

name

string

Name or title of the work item.

project

string

Parent project of the deleted work item.

resource

WorkItem

The work item object that was deleted.

type

string

Type of work item.

url

string

REST API URL of the resource

WorkItemDeleteUpdate

Describes an update request for a deleted work item.

Name Type Description
isDeleted

boolean

Sets a value indicating whether this work item is deleted.

WorkItemRelation

Name Type Description
attributes

object

Collection of link attributes.

rel

string

Relation type.

url

string

Link url.