查看了一些如何使用参数执行 webhook 的示例,但似乎无法与我所缺少的内容建立联系。任何关于我做错了什么的建议将不胜感激。
请考虑:我的 Powershell 运行手册
[CmdletBinding()]
Param([object]$WebhookData) #this parameter name needs to be called
WebHookData otherwise the webhook does not work as expected.
$VerbosePreference = 'continue'
Write-Output "hello"
"in the inline"
if($WebhookData -ne $null)
{
"using webhookdata"
$WebhookName = $WebhookData.WebhookName
$WebhookBody = $WebhookData.RequestBody
$webhookBodyObject = $WebhookBody | ConvertFrom-JSON
line 15 'The parameter created was ' $webhookBodyObject.strYear
我的 httpclient 发布请求看起来像这样(警告..its vb)
dim WebHookData as new StringContent("{'strYear'='2018'}",Encoding.UTF8,"application/json")
Dim resp as Task(Of HttpResponseMessage)
resp = _client.PostAsync(webhook,WebHookData)
status = resp.Result.Content.ReadAsStringAsync().Result
if(status.Contains("JobId"))
status = "Scheduled!"
End If
我的 Webhook 数据正像这样发布到我的 Webhook。
{"WebhookName":"myimportjob","RequestBody":"{'strYear'='2018'}","RequestHeader":{"Connection":"Keep-Alive","Expect":"100-continue","Host":"xxx.azure-automation.net","x-ms-request-id":"xxx"}}
我收到此错误
在 line:15 char:42 + '创建的参数是 ' $webhookBodyObject.strYear + ~~~~~~~~~~~~~~~~~~ 表达式或语句中的意外标记 '$webhookBodyObject'。