我需要添加此模型:
{ "sourceVersion": "5ddcada97436a83dfedf5b41261ef9bfb8b718d7", "debug": true }
但PowerShell控制台显示错误“错误请求”。
这是我的代码:
try {
$serverHost = "api.appcenter.ms"
$service = "https://$serverHost/v0.1/apps/App/App/branches/dev/builds"
$ContentType = "application/json" # Add the content type
$Method = 'POST' # Add the method type
$Body = '{ "sourceVersion" = "5ddcada97436a83dfedf5b41261ef9bfb8b718d7", "debug" = True }'
$Headers = @{'accept'='application/json';'X-API- Token'='efa699e279155919d4ed7ca880e335ebd7ad8191'}
$result = Invoke-RestMethod -Method POST -Uri $service -Headers $Headers - Body $Body
Read-Host -Prompt $result
}
catch {
Write-Error $_.Exception.ToString()
Read-Host -Prompt "The above error occurred. Press Enter to exit."
}