Tüm Araçlar

cURL → Kod Dönüştürücü

cURL komutlarınızı JavaScript fetch, axios ve Python requests koduna anında çevirin.

cURL Komutu

POST2 başlıkJSON gövde

İstek Özeti

Yöntem

POST

URL

https://api.example.com/v1/users

Content-Type

application/json

Authorization

Bearer TOKEN123

Üretilen Kod

const response = await fetch("https://api.example.com/v1/users", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer TOKEN123"
  },
  body: JSON.stringify({
    "name": "Ebubekir",
    "role": "admin",
    "active": true
  })
});

if (!response.ok) {
  throw new Error(`İstek başarısız: ${response.status}`);
}

const data = await response.json();
console.log(data);

Desteklenen bayraklar: -X, -H, -d / --data-raw / --data-binary / --data-urlencode, --json, -F, -u, -b, -A, -e, -G, -I, -k, --url. Komutlar tarayıcınızda çözümlenir, hiçbir veri sunucuya gönderilmez.