共用方式為


Records - Update

如果時間軸記錄已經存在,請更新記錄,否則請為相同的時間軸建立新的記錄。

PATCH https://dev.azure.com/{organization}/{scopeIdentifier}/_apis/distributedtask/hubs/{hubName}/plans/{planId}/timelines/{timelineId}/records?api-version=7.1

URI 參數

名稱 位於 必要 類型 Description
hubName
path True

string

伺服器中樞的名稱。 常見範例:“build”、“rm”、“checks”

organization
path True

string

Azure DevOps 組織的名稱。

planId
path True

string (uuid)

方案的標識碼。

scopeIdentifier
path True

string (uuid)

要設定要求範圍的專案 GUID

timelineId
path True

string (uuid)

時程表的識別碼。

api-version
query True

string

要使用的 API 版本。 這應該設定為 『7.1』 以使用此版本的 API。

要求本文

名稱 類型 Description
count

integer (int32)

串行化項目的數目。

value

string (T)

串行化專案。

回應

名稱 類型 Description
200 OK

TimelineRecord[]

成功作業

安全性

accessToken

個人存取令牌。 針對使用者名稱和令牌使用任何值做為密碼。

類型: basic

範例

Update timeline's records

範例要求

PATCH https://dev.azure.com/{organization}/{scopeIdentifier}/_apis/distributedtask/hubs/{hubName}/plans/{planId}/timelines/{timelineId}/records?api-version=7.1

{
  "value": [
    {
      "id": "5e6d5dbf-ac69-5f56-8b85-8e9038703a8b",
      "parentId": null,
      "type": null,
      "name": null,
      "startTime": null,
      "finishTime": null,
      "currentOperation": null,
      "percentComplete": null,
      "state": null,
      "result": null,
      "resultCode": null,
      "changeId": 0,
      "lastModified": "0001-01-01T00:00:00",
      "workerName": null,
      "log": {
        "path": "logs\\5e6d5dbf-ac69-5f56-8b85-8e9038703a8b",
        "createdOn": "0001-01-01T00:00:00",
        "lastChangedOn": "0001-01-01T00:00:00",
        "id": 0,
        "location": null
      },
      "details": null,
      "errorCount": null,
      "warningCount": null,
      "location": null,
      "attempt": 1,
      "identifier": null
    }
  ],
  "count": 1
}

範例回覆

{
  "count": 1,
  "value": [
    {
      "id": "5e6d5dbf-ac69-5f56-8b85-8e9038703a8b",
      "parentId": "096e11e7-c8bb-5a90-1a73-4e639c9ea0f9",
      "type": "Task",
      "name": "Invoke REST API",
      "startTime": "2022-12-02T09:33:15.0466667Z",
      "finishTime": "2022-12-02T09:37:37.8433333Z",
      "currentOperation": null,
      "percentComplete": null,
      "state": "completed",
      "result": "succeeded",
      "resultCode": null,
      "changeId": 13,
      "lastModified": "0001-01-01T00:00:00",
      "workerName": null,
      "order": 1,
      "refName": "InvokeRESTAPI0",
      "log": {
        "id": 0,
        "location": "https://dev.azure.com/fabrikam/_apis/distributedtask/plans/787562d7-f1da-59cf-22c4-8a94fa784503/logs/0"
      },
      "details": null,
      "errorCount": 0,
      "warningCount": 0,
      "task": {
        "id": "9c3e8943-130d-4c78-ac63-8af81df62dfb",
        "name": "InvokeRESTAPI",
        "version": "1.198.0"
      },
      "location": "https://dev.azure.com/fabrikam/_apis/distributedtask/plans/787562d7-f1da-59cf-22c4-8a94fa784503/timelines/787562d7-f1da-59cf-22c4-8a94fa784503/records/5e6d5dbf-ac69-5f56-8b85-8e9038703a8b",
      "attempt": 1,
      "identifier": null
    }
  ]
}

定義

名稱 Description
Issue

與管線執行相關聯的問題(錯誤、警告)。

IssueType

問題的型別(錯誤、警告)。

JObject

表示 JSON 物件。

TaskLogReference

工作記錄檔的參考。 此類別包含管線執行期間列印到時間軸記錄記錄主控台之輸出的相關信息。

TaskReference

工作的參考。

TaskResult
TimelineAttempt

嘗試更新 TimelineRecord。

TimelineRecord

管線執行期間執行不同作業的詳細資訊。

TimelineRecordState

記錄的狀態。

TimelineReference

時程表的參考。

VariableValue

泛型變數的包裝函式類別。

VssJsonCollectionWrapper

這個類別是用來將集合串行化為連線上的單一 JSON 物件。

Issue

與管線執行相關聯的問題(錯誤、警告)。

名稱 類型 Description
category

string

問題的類別。
範例:程序代碼 - 參考編譯錯誤
範例:一般 - 參考一般錯誤

data

object

包含問題詳細數據的字典。

message

string

問題的描述。

type

IssueType

問題的型別(錯誤、警告)。

IssueType

問題的型別(錯誤、警告)。

Description
error
warning

JObject

表示 JSON 物件。

名稱 類型 Description
item

string (JToken)

type

string (JTokenType)

取得這個 JToken 的節點類型。

TaskLogReference

工作記錄檔的參考。 此類別包含管線執行期間列印到時間軸記錄記錄主控台之輸出的相關信息。

名稱 類型 Description
id

integer (int32)

工作記錄檔的標識碼。

location

string

工作記錄的 REST URL。

TaskReference

工作的參考。

名稱 類型 Description
id

string (uuid)

工作定義的識別碼。 對應至 task.json 檔案的標識碼值。
範例:CmdLineV2 { “id”: “D9BAFED4-0B18-4F58-968D-86655B4D2CE9” }

inputs

object

工作定義特有的輸入字典。 對應至檔案 task.json 的輸入值。

name

string

工作定義的名稱。 對應至 task.json 檔案的名稱值。
範例:CmdLineV2 { “name”: “CmdLine” }

version

string

工作定義的版本。 對應至 task.json 檔案的版本值。
範例:CmdLineV2 { “version”: { “Major”: 2, “Minor”: 212, “Patch”: 0 } }

TaskResult

Description
abandoned
canceled
failed
skipped
succeeded
succeededWithIssues

TimelineAttempt

嘗試更新 TimelineRecord。

名稱 類型 Description
attempt

integer (int32)

記錄的嘗試。

identifier

string

記錄的唯一標識碼。

recordId

string (uuid)

位於指定時間軸內的記錄標識碼。

timelineId

string (uuid)

擁有代表此嘗試之記錄的時程表標識碼。

TimelineRecord

管線執行期間執行不同作業的詳細資訊。

名稱 類型 Description
agentSpecification

JObject

以二進位格式執行管線作業的代理程序規格。 當記錄的類型為 Job 時適用。
範例: { “VMImage” : “windows-2019” }

attempt

integer (int32)

記錄嘗試次數。

changeId

integer (int32)

同時更新所有記錄的標識碼。 此值取自時間軸的 ChangeId。

currentOperation

string

表示目前作業的字串。

details

TimelineReference

子時程表的參考。

errorCount

integer (int32)

此作業所產生的錯誤數目。

finishTime

string (date-time)

記錄的完成時間。

id

string (uuid)

記錄的標識碼。

identifier

string

嘗試之間一致的字串標識碼。

issues

Issue[]

此作業所產生的問題清單。

lastModified

string (date-time)

上次修改記錄的時間。

location

string

記錄的 REST URL。

log

TaskLogReference

這個作業所產生記錄檔的參考。

name

string

記錄的名稱。

order

integer (int32)

相對於時間軸內其他記錄的序數值。

parentId

string (uuid)

記錄父系的標識碼。
範例:階段是階段的父代,階段是作業的父系,作業是工作的父系。

percentComplete

integer (int32)

記錄完成百分比。

previousAttempts

TimelineAttempt[]

先前的記錄嘗試。

queueId

integer (int32)

將專案連線到作業執行所在的代理程式集區的佇列標識碼。 當記錄的類型為 Job 時適用。

refName

string

參考記錄的名稱。

result

TaskResult

記錄的結果。

resultCode

string

在記錄作業完成時評估預先定義的條件。
範例:評估 succeeded(),結果 = True
範例:評估 and(succeeded(), eq(variables['system.debug'], False)),結果 = False

startTime

string (date-time)

記錄的開始時間。

state

TimelineRecordState

記錄的狀態。

task

TaskReference

工作的參考。 當記錄的類型為Task時適用。

type

string

記錄所追蹤的作業類型。
範例:階段、階段、作業、工作...

variables

<string,  VariableValue>

記錄的變數。

warningCount

integer (int32)

這項作業所產生的警告數目。

workerName

string

執行作業的代理程式名稱。 當記錄的類型為 Job 時適用。

TimelineRecordState

記錄的狀態。

Description
completed
inProgress
pending

TimelineReference

時程表的參考。

名稱 類型 Description
changeId

integer (int32)

變更標識碼。

id

string (uuid)

時程表的識別碼。

location

string

時程表的 REST URL。

VariableValue

泛型變數的包裝函式類別。

名稱 類型 Description
isReadOnly

boolean

指出變數是否可以在腳本的執行運行時間期間變更。

isSecret

boolean

指出變數是否應該在待用時加密。

value

string

變數的值。

VssJsonCollectionWrapper

這個類別是用來將集合串行化為連線上的單一 JSON 物件。

名稱 類型 Description
count

integer (int32)

串行化項目的數目。

value

string (T)

串行化專案。