LoginSignup
3
9

More than 5 years have passed since last update.

PowerShellで日本語を含むJSONをPOST

Posted at

リクエストボディを[byte]型の配列にしてからInvoke-RestMethodコマンドレットで送信します。

$postText = @{text="日本語"} | ConvertTo-Json -Compress
$postBody = [Text.Encoding]::UTF8.GetBytes($postText)
$postUri = "http://localhost:3000/api/texts"
Invoke-RestMethod -Method POST -Uri $postUri -Body $postBody -ContentType application/json
3
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
9