Last Update: 9/26/2016

BuildHttpClient2_2

This API is in private preview and subject to change.

Module path: TFS/Build/RestClient

Initialization sample

  import RestClient = require("TFS/Build/RestClient");

  // Get an instance of the client
  var client = RestClient.getClient();

  // Call a method on the client
  // e.g. client.getResource(...).then(...);

Methods

addBuildTag()

Adds a tag to a build

Syntax

 IPromise<string[]> addBuildTag(project, buildId, tag)

Parameters

  • project: string. Project ID or project name
  • buildId: number.
  • tag: string.

Returns

addBuildTags()

Adds tag to a build

Syntax

 IPromise<string[]> addBuildTags(tags, project, buildId)

Parameters

  • tags: string[].
  • project: string.
  • buildId: number.

Returns

createArtifact()

Associates an artifact with a build

Syntax

 IPromise<Contracts.BuildArtifact> createArtifact(artifact, buildId, project)

Parameters

Returns

createDefinition()

Creates a new definition

Syntax

 IPromise<Contracts.BuildDefinition> createDefinition(definition, project, definitionToCloneId, definitionToCloneRevision)

Parameters

  • definition: Contracts.BuildDefinition.
  • project: string. Optional.
  • definitionToCloneId: number. Optional.
  • definitionToCloneRevision: number. Optional.

Returns

createQueue()

Creates a build queue

Syntax

 IPromise<Contracts.AgentPoolQueue> createQueue(queue)

Parameters

Returns

deleteBuild()

Deletes a build

Syntax

 IPromise<void> deleteBuild(buildId, project)

Parameters

  • buildId: number.
  • project: string. Optional.

Returns

deleteBuildTag()

Deletes a tag from a build

Syntax

 IPromise<string[]> deleteBuildTag(project, buildId, tag)

Parameters

  • project: string. Project ID or project name
  • buildId: number.
  • tag: string.

Returns

deleteDefinition()

Deletes a definition and all associated builds

Syntax

 IPromise<void> deleteDefinition(definitionId, project)

Parameters

  • definitionId: number.
  • project: string. Optional.

Returns

deleteQueue()

Deletes a build queue

Syntax

 IPromise<void> deleteQueue(id)

Parameters

  • id: number.

Returns

deleteTemplate()

Deletes a definition template

Syntax

 IPromise<void> deleteTemplate(project, templateId)

Parameters

  • project: string. Project ID or project name
  • templateId: string.

Returns

getAgentPoolQueue()

Gets a queue

Syntax

 IPromise<Contracts.AgentPoolQueue> getAgentPoolQueue(controllerId)

Parameters

  • controllerId: number.

Returns

getArtifact()

Gets a specific artifact for a build

Syntax

 IPromise<Contracts.BuildArtifact> getArtifact(buildId, artifactName, project)

Parameters

  • buildId: number.
  • artifactName: string.
  • project: string. Optional.

Returns

getArtifactContentZip()

Gets a specific artifact for a build

Syntax

 IPromise<ArrayBuffer> getArtifactContentZip(buildId, artifactName, project)

Parameters

  • buildId: number.
  • artifactName: string.
  • project: string. Optional.

Returns

getArtifacts()

Gets all artifacts for a build

Syntax

 IPromise<Contracts.BuildArtifact[]> getArtifacts(buildId, project)

Parameters

  • buildId: number.
  • project: string. Optional.

Returns

getBadge()

Syntax

 IPromise<string> getBadge(project, definitionId, branchName)

Parameters

  • project: string.
  • definitionId: number.
  • branchName: string. Optional.

Returns

getBuild()

Gets a build

Syntax

 IPromise<Contracts.Build> getBuild(buildId, project, propertyFilters)

Parameters

  • buildId: number.
  • project: string. Optional.
  • propertyFilters: string. Optional.

Returns

getBuildBadge()

Syntax

 IPromise<Contracts.BuildBadge> getBuildBadge(project, repoType, repoId, branchName)

Parameters

  • project: string. Project ID or project name
  • repoType: string.
  • repoId: string. Optional.
  • branchName: string. Optional.

Returns

getBuildBadgeData()

Syntax

 IPromise<string> getBuildBadgeData(project, repoType, repoId, branchName)

Parameters

  • project: string. Project ID or project name
  • repoType: string.
  • repoId: string. Optional.
  • branchName: string. Optional.

Returns

getBuildChanges()

Gets the changes associated with a build

Syntax

 IPromise<Contracts.Change[]> getBuildChanges(project, buildId, continuationToken, top)

Parameters

  • project: string. Project ID or project name
  • buildId: number.
  • continuationToken: string. Optional.
  • top: number. Optional.

Returns

getBuildController()

Gets a controller

Syntax

 IPromise<Contracts.BuildController> getBuildController(controllerId)

Parameters

  • controllerId: number.

Returns

getBuildControllers()

Gets controller, optionally filtered by name

Syntax

 IPromise<Contracts.BuildController[]> getBuildControllers(name)

Parameters

  • name: string. Optional.

Returns

getBuildDeployments()

Gets the deployment information associated with a build

Syntax

 IPromise<Contracts.Deployment[]> getBuildDeployments(project, buildId)

Parameters

  • project: string. Project ID or project name
  • buildId: number.

Returns

getBuildLog()

Gets a log

Syntax

 IPromise<ArrayBuffer> getBuildLog(project, buildId, logId, startLine, endLine)

Parameters

  • project: string. Project ID or project name
  • buildId: number.
  • logId: number.
  • startLine: number. Optional.
  • endLine: number. Optional.

Returns

getBuildLogs()

Gets logs for a build

Syntax

 IPromise<Contracts.BuildLog[]> getBuildLogs(project, buildId)

Parameters

  • project: string. Project ID or project name
  • buildId: number.

Returns

getBuildLogsZip()

Gets logs for a build

Syntax

 IPromise<ArrayBuffer> getBuildLogsZip(project, buildId)

Parameters

  • project: string. Project ID or project name
  • buildId: number.

Returns

getBuildOptionDefinitions()

Syntax

 IPromise<Contracts.BuildOptionDefinition[]> getBuildOptionDefinitions(project)

Parameters

  • project: string. Optional. Project ID or project name

Returns

getBuilds()

Gets builds

Syntax

 IPromise<Contracts.Build[]> getBuilds(project, definitions, queues, buildNumber, minFinishTime, maxFinishTime, requestedFor, reasonFilter, statusFilter, resultFilter, tagFilters, properties, type, top, continuationToken, maxBuildsPerDefinition, deletedFilter, queryOrder, branchName)

Parameters

  • project: string. Optional. Project ID or project name
  • definitions: number[]. Optional. A comma-delimited list of definition IDs
  • queues: number[]. Optional. A comma-delimited list of queue IDs
  • buildNumber: string. Optional.
  • minFinishTime: Date. Optional.
  • maxFinishTime: Date. Optional.
  • requestedFor: string. Optional.
  • reasonFilter: Contracts.BuildReason. Optional.
  • statusFilter: Contracts.BuildStatus. Optional.
  • resultFilter: Contracts.BuildResult. Optional.
  • tagFilters: string[]. Optional.
  • properties: string[]. Optional.
  • type: Contracts.DefinitionType. Optional.
  • top: number. Optional.
  • continuationToken: string. Optional.
  • maxBuildsPerDefinition: number. Optional.
  • deletedFilter: Contracts.QueryDeletedOption. Optional.
  • queryOrder: Contracts.BuildQueryOrder. Optional.
  • branchName: string. Optional.

Returns

getBuildSettings()

Syntax

 IPromise<Contracts.BuildSettings> getBuildSettings()

Parameters

Returns

getBuildTags()

Gets the tags for a build

Syntax

 IPromise<string[]> getBuildTags(project, buildId)

Parameters

  • project: string. Project ID or project name
  • buildId: number.

Returns

getBuildTimeline()

Gets details for a build

Syntax

 IPromise<Contracts.Timeline> getBuildTimeline(project, buildId, timelineId, changeId)

Parameters

  • project: string. Project ID or project name
  • buildId: number.
  • timelineId: string. Optional.
  • changeId: number. Optional.

Returns

getBuildWorkItemsRefs()

Gets the work item IDs associated with a build

Syntax

 IPromise<VSS_Common_Contracts.ResourceRef[]> getBuildWorkItemsRefs(project, buildId, top)

Parameters

  • project: string. Project ID or project name
  • buildId: number.
  • top: number. Optional.

Returns

getBuildWorkItemsRefsFromCommits()

Gets the work item IDs associated with build commits

Syntax

 IPromise<VSS_Common_Contracts.ResourceRef[]> getBuildWorkItemsRefsFromCommits(commitIds, project, buildId, top)

Parameters

  • commitIds: string[].
  • project: string.
  • buildId: number.
  • top: number. Optional.

Returns

getChangesBetweenBuilds()

Gets the changes associated between given builds

Syntax

 IPromise<Contracts.Change[]> getChangesBetweenBuilds(project, fromBuildId, toBuildId, top)

Parameters

  • project: string. Project ID or project name
  • fromBuildId: number. Optional.
  • toBuildId: number. Optional.
  • top: number. Optional.

Returns

getDefinition()

Gets a definition, optionally at a specific revision

Syntax

 IPromise<Contracts.DefinitionReference> getDefinition(definitionId, project, revision, propertyFilters)

Parameters

  • definitionId: number.
  • project: string. Optional.
  • revision: number. Optional.
  • propertyFilters: string[]. Optional.

Returns

getDefinitionRevisions()

Gets revisions of a definition

Syntax

 IPromise<Contracts.BuildDefinitionRevision[]> getDefinitionRevisions(project, definitionId)

Parameters

  • project: string. Project ID or project name
  • definitionId: number.

Returns

getDefinitions()

Gets definitions, optionally filtered by name

Syntax

 IPromise<Contracts.DefinitionReference[]> getDefinitions(project, name, type, repositoryId, repositoryType, queryOrder, top)

Parameters

Returns

getQueues()

Gets queues, optionally filtered by name

Syntax

 IPromise<Contracts.AgentPoolQueue[]> getQueues(name)

Parameters

  • name: string. Optional.

Returns

getResourceUsage()

Syntax

 IPromise<Contracts.BuildResourceUsage> getResourceUsage()

Parameters

Returns

getTags()

Syntax

 IPromise<string[]> getTags(project)

Parameters

  • project: string. Project ID or project name

Returns

getTemplate()

Gets definition template filtered by id

Syntax

 IPromise<Contracts.BuildDefinitionTemplate> getTemplate(project, templateId)

Parameters

  • project: string. Project ID or project name
  • templateId: string.

Returns

getTemplates()

Syntax

 IPromise<Contracts.BuildDefinitionTemplate[]> getTemplates(project)

Parameters

  • project: string. Project ID or project name

Returns

getWorkItemsBetweenBuilds()

Gets all the work item IDs inbetween fromBuildId to toBuildId

Syntax

 IPromise<VSS_Common_Contracts.ResourceRef[]> getWorkItemsBetweenBuilds(project, fromBuildId, toBuildId, top)

Parameters

  • project: string. Project ID or project name
  • fromBuildId: number.
  • toBuildId: number.
  • top: number. Optional.

Returns

queueBuild()

Queues a build

Syntax

 IPromise<Contracts.Build> queueBuild(build, project, ignoreWarnings)

Parameters

  • build: Contracts.Build.
  • project: string. Optional.
  • ignoreWarnings: boolean. Optional.

Returns

saveTemplate()

Saves a definition template

Syntax

 IPromise<Contracts.BuildDefinitionTemplate> saveTemplate(template, project, templateId)

Parameters

Returns

updateBuild()

Updates a build

Syntax

 IPromise<Contracts.Build> updateBuild(build, buildId, project)

Parameters

Returns

updateBuildSettings()

Updates the build settings

Syntax

 IPromise<Contracts.BuildSettings> updateBuildSettings(settings)

Parameters

Returns

updateDefinition()

Updates an existing definition

Syntax

 IPromise<Contracts.BuildDefinition> updateDefinition(definition, definitionId, project, secretsSourceDefinitionId, secretsSourceDefinitionRevision)

Parameters

  • definition: Contracts.BuildDefinition.
  • definitionId: number.
  • project: string. Optional.
  • secretsSourceDefinitionId: number. Optional.
  • secretsSourceDefinitionRevision: number. Optional.

Returns