これらのアクションは、標準ライブラリの一部としてすべてのRunbookで利用できます。
send_http_request
std::send_http_request
アクションは、指定されたURLにHTTPリクエストを送信します。
入力
| 名前 | 必須 | 型 | 説明 |
|---|---|---|---|
url | 必須 | string | リクエストの送信先URL |
method | 任意 | string | HTTPメソッド(GET、POST、PUT、DELETE)。デフォルト: GET |
headers | 任意 | map | リクエストに含めるHTTPヘッダー |
body | 任意 | string | リクエストボディ(POST/PUTリクエスト用) |
timeout_ms | 任意 | integer | リクエストのタイムアウト(ミリ秒単位) |
出力
| 名前 | 型 | 説明 |
|---|---|---|
status_code | integer | HTTPステータスコード |
body | string | レスポンスボディ |
headers | map | レスポンスヘッダー |
action "api_call" "std::send_http_request" {description = "Fetch data from API"url = "https://api.example.com/data"method = "GET"headers = {"Authorization" = "Bearer ${variable.token}"}}output "response" {value = action.api_call.body}output "status" {value = action.api_call.status_code}
POSTリクエストの例
action "create_resource" "std::send_http_request" {description = "Create a new resource"url = "https://api.example.com/resources"method = "POST"headers = {"Content-Type" = "application/json"}body = {"name" = variable.name,"value" = variable.value}}
Is this page helpful?