هذه الإجراءات متاحة في جميع Runbooks كجزء من المكتبة القياسية.
send_http_request
يقوم الإجراء std::send_http_request بإرسال طلب HTTP إلى عنوان URL المحدد.
المدخلات
| الاسم | مطلوب | النوع | الوصف |
|---|---|---|---|
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?