cURL komutlarınızı JavaScript fetch, axios ve Python requests koduna anında çevirin.
cURL Komutu
İ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);import axios from 'axios';
const response = await axios({
method: "post",
url: "https://api.example.com/v1/users",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer TOKEN123"
},
data: {
"name": "Ebubekir",
"role": "admin",
"active": true
}
});
console.log(response.data);import requests
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer TOKEN123"
}
json_data = {
"name": "Ebubekir",
"role": "admin",
"active": True
}
response = requests.post(
"https://api.example.com/v1/users",
headers=headers,
json=json_data
)
print(response.status_code)
print(response.json())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.