Share via


Result retention settings

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 = 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 project. To get list of projects, look here.

Get result retention settings

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

Sample request

GET https://mytfsserver/DefaultCollection/Fabrikam-Fiber-TFVC/_apis/test/resultretentionsettings?api-version=2.0-preview

Sample response

{
  "lastUpdatedBy": {
    "id": "33d33df3-88ea-4704-a787-91092e0aa295",
    "displayName": "Fabrikam",
    "uniqueName": "fabrikamfiber.vsin@hotmail.com",
    "url": "https://mytfsserver/DefaultCollection/_apis/Identities/33d33df3-88ea-4704-a787-91092e0aa295",
    "imageUrl": "https://mytfsserver/DefaultCollection/_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 TFS server name ({server:port}).
project string Name or ID of the 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://mytfsserver/DefaultCollection/Fabrikam-Fiber-TFVC/_apis/test/resultretentionsettings?api-version=2.0-preview
{
  "automatedResultsRetentionDuration": 30,
  "manualResultsRetentionDuration": 100
}

Sample response

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