我尝试使用this REST API来更新" Markdown" VSTS中仪表板上的小部件。
使用下面的JSON
正文,根据示例,我得到Value cannot be null
(见下文)?
Invoke-RestMethod:{" $ id":" 1"," innerException":null," message":&#34 ;值 不能为空。\ r \ nParameter名称: 插件""的typeName":" System.ArgumentNullException,mscorlib程序"" typeKey":" ArgumentNullException""的errorCode& #34;:0," EVENTID":0}在 C:\用户\亚历克斯\ OneDrive \文件\脚本\ 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
{
"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
,我使用获取信息中心和WidgetId
验证,而eTag=35
就是信息中心。
答案 0 :(得分:2)
更改此行:
"size": {"rowSpan":2; "columnSpan":2},
到
"size": {"rowSpan":2, "columnSpan":2},