Result retention settings

Last Update: 12/5/2016

api-version = 2.0-preview

If you haven't already, look at the information on getting started with these APIs. Look here to know more about result retention settings.

Below APIs fetch or update result retention settings for a team project. To get list of team projects, look here.

Get result retention settings

GET https://{instance}/DefaultCollection/{project}/_apis/test/resultretentionsettings?api-version={version}
Parameter Type Notes
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
project string Name or ID of the team project.
Query
version string Version of the API to use.

Sample request

GET https://fabrikam-fiber-inc.visualstudio.com/Defaultcollection/Fabrikam-Fiber-TFVC/_apis/test/resultretentionsettings?api-version=2.0-preview

Sample response

Status code: 200
{
  "lastUpdatedBy": {
    "id": "33d33df3-88ea-4704-a787-91092e0aa295",
    "displayName": "Fabrikam",
    "uniqueName": "fabrikamfiber.vsin@hotmail.com",
    "url": "https://fabrikam-fiber-inc.visualstudio.com/_apis/Identities/33d33df3-88ea-4704-a787-91092e0aa295",
    "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/_api/_common/identityImage?id=33d33df3-88ea-4704-a787-91092e0aa295"
  },
  "automatedResultsRetentionDuration": 30,
  "manualResultsRetentionDuration": 365,
  "lastUpdatedDate": "2015-10-15T04:23:12.203Z"
}

Update result retention settings

PATCH https://{instance}/DefaultCollection/{project}/_apis/test/resultretentionsettings?api-version={version}
{
  "automatedResultsRetentionDuration": { int },
  "manualResultsRetentionDuration": { int }
}
Parameter Type Notes
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
project string Name or ID of the team project.
Query
version string Version of the API to use.
Body
automatedResultsRetentionDuration int Number of days to retain automated test results. Set -1 to retain indefinitely.
manualResultsRetentionDuration int Number of days to retain manual test results. Set -1 to retain indefinitely.

Sample request

PATCH https://fabrikam-fiber-inc.visualstudio.com/Defaultcollection/Fabrikam-Fiber-TFVC/_apis/test/resultretentionsettings?api-version=2.0-preview
Content-Type: application/json
{
  "automatedResultsRetentionDuration": 30,
  "manualResultsRetentionDuration": 100
}

Sample response

Status code: 200
{
  "lastUpdatedBy": {
    "id": "a5cbf24d-799f-452e-82be-f049a85b5895",
    "displayName": "Fabrikam",
    "uniqueName": "fabrikamfiber.vsin@hotmail.com",
    "url": "https://fabrikam-fiber-inc.visualstudio.com/_apis/Identities/a5cbf24d-799f-452e-82be-f049a85b5895",
    "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/_api/_common/identityImage?id=a5cbf24d-799f-452e-82be-f049a85b5895"
  },
  "automatedResultsRetentionDuration": 30,
  "manualResultsRetentionDuration": 100,
  "lastUpdatedDate": "2016-07-13T10:15:13.367Z"
}