Queste azioni sono disponibili in tutti i Runbook come parte della libreria standard.
send_http_request
L'azione std::send_http_request effettua una richiesta HTTP all'URL
specificato.
Input
| Nome | Obbligatorio | Tipo | Descrizione |
|---|---|---|---|
url | obbligatorio | string | L'URL a cui inviare la richiesta |
method | opzionale | string | Il metodo HTTP (GET, POST, PUT, DELETE). Predefinito: GET |
headers | opzionale | map | Intestazioni HTTP da includere nella richiesta |
body | opzionale | string | Il corpo della richiesta (per richieste POST/PUT) |
timeout_ms | opzionale | integer | Timeout della richiesta in millisecondi |
Output
| Nome | Tipo | Descrizione |
|---|---|---|
status_code | integer | Il codice di stato HTTP |
body | string | Il corpo della risposta |
headers | map | Le intestazioni della risposta |
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}
Esempio di Richiesta 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?