0
votes

Someone on my team accidentally deleted a VSTS work item. I'm looking at Get Started with REST APIs it looks like I can do this with a small C# program. I'm wondering what I should put in for the personal access token though. Can I get this by doing a fiddler trace while logging into VSTS? Alternatively, is it possible to do this without writing a custom program? I'm using VS 2017 Enterprise.

3

3 Answers

1
votes

You can send the REST API request through CURL or Postman tool.

For CURL:

curl -u test:[personal access token] --data {"IsDeleted":false} -X PATCH https://[account].visualstudio.com/DefaultCollection/_apis/wit/recyclebin/[work item id]?api-version=3.0-preview -H "Content-Type:application/json"

For Postman:

enter image description here

enter image description here

0
votes

The recycle bin icon is (currently) in the lower left hand corner in VSTS, so you can go there to undelete items that you've deleted accidentally. Still be curious for more information on using the REST APIs though.

0
votes

To programmatically play with the Recycle Bin of the Work Items there are these specific REST APIs for Visual Studio Team Services (aka VSTS or VSO).

In particular you can read how to restore a work item

As per Personal Access Token (aka PAT), you should:

  • Create one with proper scope (e.g. Work Item (Read and Write));
  • treat it as a password (e.g. keep it secret and safely stored);
  • use it in place of the password field with HTTPS Basic authentication;