且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用 PowerShell Invoke-RestMethod 发送多部分/表单数据

更新时间:2022-05-04 07:52:46

这里的问题是 API 需要一些额外的参数.初始请求需要一些参数来接受原始内容并指定文件名/大小.设置并取回正确的链接提交后,我可以使用:

The problem here was what the API required some additional parameters. Initial request required some parameters to accept raw content and specify filename/size. After setting that and getting back proper link to submit, I was able to use:

Invoke-RestMethod -Uri $uri -Method Post -InFile $filePath -ContentType "multipart/form-data"