大佬教程收集整理的这篇文章主要介绍了Powershell v3 Invoke-RestMethod,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
有人可以解释我如何从服务器获得预期的响应?下面是使用Invoke-RestMethod的两个命令1st in CURL,2nd命令. curl命令将执行正确的POST并返回响应. PowersHell命令将执行正确的POST但不会返回响应.
谢谢
编辑:我认为我试图从ps输出获得的主要内容是“响应头”即. curl命令下面的输出
< http/1.1 201 Created < Date: Thu,26 Jul 2012 01:20:06 GMT < Server: Apache < X-EM7-Implemented-methods: GET,PUT,POST < X-Powered-By: ScienceLogic,LLC - EM7 API/Integration Server < LOCATIOn: /ticket/321750 < X-EM7-status-message: ticket /ticket/321750 added. < X-EM7-status-code: CREATED < Content-Length: 830 < Content-Type: application/json <
卷曲命令
curl -f -v -s -k --no-sessionid -H X-em7-beautify-response:1 -H content- type:application/json https://URLHERE --data-binary @jsonfile.json
$cert=New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("certfile.crt") $json = Get-Content jsonfile.json $cred = Get-Credential -message "Enter Credentials" Invoke-RestMethod -Uri https://URLHERE -Credential $cred -Body $json -Certificate $cert -ContentType application/json -Method POST
以上是大佬教程为你收集整理的Powershell v3 Invoke-RestMethod全部内容,希望文章能够帮你解决Powershell v3 Invoke-RestMethod所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。