Share via


Variables - Get

Get a test variable by its ID.

GET https://dev.azure.com/{organization}/{project}/_apis/test/variables/{testVariableId}?api-version=5.0-preview.1

URI Parameters

Name In Required Type Description
organization
path True

string

The name of the Azure DevOps organization.

project
path True

string

Project ID or project name

testVariableId
path True

integer (int32)

ID of the test variable to get.

api-version
query True

string

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

Responses

Name Type Description
200 OK

TestVariable

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.test Grants the ability to read test plans, cases, results and other test management related artifacts.

Examples

Sample request

GET https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/variables/1?api-version=5.0-preview.1

Sample response

{
  "id": 1,
  "name": "Operating System",
  "url": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/Variables/1",
  "project": {
    "name": "fabrikam-fiber-tfvc",
    "url": "https://dev.azure.com/fabrikam/_apis/projects/fabrikam-fiber-tfvc"
  },
  "description": "Default operating systems",
  "revision": 1,
  "values": [
    "Windows 10",
    "Windows 7",
    "Windows 8",
    "Windows 8.1"
  ]
}

Definitions

Name Description
ShallowReference

An abstracted reference to some other resource. This class is used to provide the build data contracts with a uniform way to reference other resources in a way that provides easy traversal through links.

TestVariable

ShallowReference

An abstracted reference to some other resource. This class is used to provide the build data contracts with a uniform way to reference other resources in a way that provides easy traversal through links.

Name Type Description
id

string

ID of the resource

name

string

Name of the linked resource (definition name, controller name, etc.)

url

string

Full http link to the resource

TestVariable

Name Type Description
description

string

Description of the test variable

id

integer (int32)

Id of the test variable

name

string

Name of the test variable

project

ShallowReference

Project to which the test variable belongs

revision

integer (int32)

Revision

url

string

Url of the test variable

values

string[]

List of allowed values