Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Scottly's avatar

Put/Patch via API with Powershell

I'm implementing an API mostly so I can do bulk upload of records to my application from CSVs using PowerShell. I've got the POST side of things working just fine, but I'm stumped with updating existing records.

My understanding is that Powershell sends JSON as 'raw' by default, and this seems to have been the case with my add methods which worked fine.

When I attempt to Put/patch via Powershell I get a 422 error, and doing dd(request()) to troubleshoot tells me that my json is null. Why on earth would this be happening? Sending exactly the same request via Postman with the JSON format set to raw works perfectly.

0 likes
1 reply
aurawindsurfing's avatar

I'm not sure about API calls but laravel forms only accept GET and POST resuests if you need a patch you do it like that in blade:

<form method="POST" action="patchlink">
    @method('patch')
    . . .
</form>

probably the same applies to API calls as well.

Please or to participate in this conversation.