こんにちは私はPowershell v4で次の 'Invoke-RestMethed'コマンドを実行していますが、HTTP 406エラーが発生しています。Powershell v4 Invoke-RestMethod:HTTP Status 406
$head = @{"Authorization"="Basic $auth"; "Accept"="*/*"}
私の理解では、サーバがXML形式で要求をとるが、JSON形式で返すと、多分問題を引き起こしてthatsのです:
Invoke-RestMethod -Method Post -Uri $url -Headers $head -ContentType "application/xml" -Body $body -OutFile output.txt
は、私は、ヘッダーに次の変更を行いましたか? "Accept" = "application/json"にヘッダを変更しようとしましたが、同じエラーが発生しました。
全エラー:
Invoke-RestMethod : HTTP Status 406 - type Status report message description The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.
あなたはそれに対して働いているかURL知らずして、任意の提案を与えることは困難です問題はおそらく私の経験ではそのURLに固有です。 – TravisEz13
VMware NSXマネージャの内部URL '$ Url =" https://nsxmgr-l-01a.corp.local/api/1.0/nsx/cli?action = execute "' – user3784080
Acceptヘッダーを削除しようとしましたか? PowerShellを使用してNSX APIを呼び出す他のサンプルを見ると、Authorizationヘッダーのみが使用されます。 – TravisEz13