【PowerShell】Invoke-RestMethod

PowerShell

Invoke-WebRequest は、HTTP、HTTPS、FTP 要求をウェブサーバーやウェブサービスに送信するための PowerShell コマンドレットです。

使い方

Invoke-WebRequest [-Uri] <Uri> [-Method <WebRequestMethod>] [-Headers <IDictionary>] [-Body <Object>]

例(POST)

    Invoke-RestMethod `
        -Uri $WebhookUrl `
        -Method POST `
        -ContentType 'application/json; charset=UTF-8' `
        -Body (ConvertTo-Json $botMessage)

-Uri ・・・ 呼び出す、APIのURLを指定します。
-InFile ・・・ bodyになるファイルを指定します。
-ContentType ・・・ ContentTypeを指定します。 (content-type一覧
-Method ・・・ HTTPメソッドを指定します。

Invoke-RestMethod (Microsoft.PowerShell.Utility) - PowerShell
Invoke-RestMethod コマンドレットは、高度に構造化されたデータを返す Representational State Transfer (REST) Web サービスに HTTP 要求と HTTPS 要求を送信します。 Pow...
PowerShell で Web API を叩く(kintone 編)

コメント