【发布时间】:2013-11-26 10:53:27
【问题描述】:
我想编写使用 Powershell(Hudson 版本 3.0.1-b2)创建 Hudson 作业的脚本。从Configure or Create hudson job automatically 和http://technet.microsoft.com/en-us/library/hh849971.aspx (Invoke-RestMethod) 看起来这应该很容易。但是,我是一个 powershell 初学者:
Invoke-RestMethod -Uri "http://localhost:hudsonPort/createItem?name=jobName" -Body config.xml -Method Post -ContentType "text/xml"
在浏览器中,localhost:hudsonPort 将我带到 Hudson,我正在从包含 config.xml 的目录运行上述命令,该目录是现有的 Hudson 作业的配置文件。我还尝试使用 $body = cat config.xml 预先准备 body 参数并将其提供给 Invoke-RestMethod 命令。
无论哪种方式,我都会收到 400 错误请求错误。请求有什么问题?我觉得挺好看的。
【问题讨论】:
标签: rest powershell hudson