طلب POST بصيغة JSON
الإدخال
curl -X POST "https://api.example.com/orders" -H "Content-Type: application/json" -d '{"sku":"A100","qty":2}'الإخراج
method: "POST", body: "{\"sku\":\"A100\",\"qty\":2}"AppHelp
حوّل أمر cURL إلى كود fetch يتضمن الرابط والطريقة والترويسات وجسم الطلب. التحويل محلي ولا يرسل أي طلب.
const response = await fetch("https://api.example.com/orders", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer TOKEN"
},
body: "{\"sku\":\"A100\",\"qty\":2}",
});
const data = await response.text();حوّل أمر cURL إلى كود fetch يتضمن الرابط والطريقة والترويسات وجسم الطلب. التحويل محلي ولا يرسل أي طلب.
curl -X POST "https://api.example.com/orders" -H "Content-Type: application/json" -d '{"sku":"A100","qty":2}'method: "POST", body: "{\"sku\":\"A100\",\"qty\":2}"