前提
PostmanでPATCHリクエストに応答があることを確認したうえで、
PowerShellにて同じリクエストを送信すると403エラーになってしまいます。
powershell
1Invoke-RestMethod -Uri $url -Body ($body|ConvertTo-Json) -Method 'patch' -Credential $cred -ContentType 'application/json'
実現したいこと
Postmanと同様の変動が返ってくること。
発生している問題・エラーメッセージ
Invoke-RestMethod : Error 403--Forbidden Error 403--Forbidden From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1: 10.4.4 403 Forbidden The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. This stat us code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable. 発生場所 行:1 文字:1 + Invoke-RestMethod -Uri $url -Body ($body|ConvertTo-Json) -Method 'pat ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod]、WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
試したこと
$bodyの中身がPostmanと一致していることは確認済みです。
オプションの過不足なども確認していますが…
Invoke-RestMethodのリファレンスを見ても不足はないように思えます。
署名まわりが怪しいかもしれません。
回答1件
あなたの回答
tips
プレビュー