Solana-DokumentationInfrastructure as CodeStandardbibliothek

Standardaktionen

Diese Aktionen sind in allen Runbooks als Teil der Standardbibliothek verfügbar.

send_http_request

Die Aktion std::send_http_request sendet eine HTTP-Anfrage an die angegebene URL.

Eingaben

NameErforderlichTypBeschreibung
urlerforderlichstringDie URL, an die die Anfrage gesendet werden soll
methodoptionalstringDie HTTP-Methode (GET, POST, PUT, DELETE). Standard: GET
headersoptionalmapHTTP-Header, die in der Anfrage enthalten sein sollen
bodyoptionalstringDer Anfrage-Body (für POST/PUT-Anfragen)
timeout_msoptionalintegerAnfrage-Timeout in Millisekunden

Ausgaben

NameTypBeschreibung
status_codeintegerDer HTTP-Statuscode
bodystringDer Antwort-Body
headersmapDie Antwort-Header
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-Anfrage Beispiel

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?

Inhaltsverzeichnis

Seite bearbeiten
© 2026 Solana Foundation. Alle Rechte vorbehalten.