【发布时间】:2018-10-26 17:12:40
【问题描述】:
我正在尝试使用 this REST API 更新 VSTS 仪表板上的“Markdown”小部件。
使用下面的JSON 正文,根据示例,我得到Value cannot be null(见下文)?
错误
Invoke-RestMethod : {"$id":"1","innerException":null,"message":"Value 不能为空。\r\n参数名称: 小部件","typeName":"System.ArgumentNullException,mscorlib","typeKey":"ArgumentNullException","errorCode":0,"eventId":0}At C:\Users\alex\OneDrive\Documents\Scripts\VSTSPowershell\VSTSAuthenticateAndInvoke.ps1:36 char:23+ ... $result = Invoke-RestMethod -Uri $uri -Method $method -ContentType ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
JSON
{
"id": "3b52e9ed-576e-4985-82ae-8e80b22a4b4d",
"eTag": "1",
"name": "Markdown",
"size": {"rowSpan":2; "columnSpan":2},
"settings": "# AAAAK Markdown\nAdd content using the markdown widget.\n- **Bold**\n- *Italic*\n- [Links]()",
"settingsVersion": "@{major=1; minor=0; patch=0}",
"dashboard": {
"eTag": "35"
},
"contributionId": "ms.vss-dashboards-web.Microsoft.VisualStudioOnline.Dashboards.MarkdownWidget"
}
提琴手Request/Response
我的目标只是找到并使用新的显示内容更新 Markdown 小部件。这是一个新创建的小部件,所以 eTag=1,我使用 Get Dashboard 和 WidgetId 进行了验证,eTag=35 就是 Dashboard。
【问题讨论】:
标签: json rest azure-devops azure-pipelines-release-pipeline azure-devops-rest-api