使用 VSTS Rest API,如何更新 Markdown 小部件?
Using VSTS Rest API, how do you Update a Markdown widget?
我正在尝试使用 this REST API 更新 VSTS 仪表板上的 "Markdown" 小部件。
使用下面的 JSON
正文,根据示例,我得到 Value cannot be null
(见下文)?
错误
Invoke-RestMethod : {"$id":"1","innerException":null,"message":"Value
cannot be null.\r\nParameter name:
widget","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。
更改此行:
"size": {"rowSpan":2; "columnSpan":2},
至
"size": {"rowSpan":2, "columnSpan":2},
我正在尝试使用 this REST API 更新 VSTS 仪表板上的 "Markdown" 小部件。
使用下面的 JSON
正文,根据示例,我得到 Value cannot be null
(见下文)?
错误
Invoke-RestMethod : {"$id":"1","innerException":null,"message":"Value cannot be null.\r\nParameter name: widget","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。
更改此行:
"size": {"rowSpan":2; "columnSpan":2},
至
"size": {"rowSpan":2, "columnSpan":2},